forked from thestk/stk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEcho.cpp
51 lines (40 loc) · 1.06 KB
/
Echo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/***************************************************/
/*! \class Echo
\brief STK echo effect class.
This class implements an echo effect.
by Perry R. Cook and Gary P. Scavone, 1995--2016.
*/
/***************************************************/
#include "Echo.h"
#include <iostream>
namespace stk {
Echo :: Echo( unsigned long maximumDelay ) : Effect()
{
this->setMaximumDelay( maximumDelay );
delayLine_.setDelay( length_ >> 1 );
effectMix_ = 0.5;
this->clear();
}
void Echo :: clear( void )
{
delayLine_.clear();
lastFrame_[0] = 0.0;
}
void Echo :: setMaximumDelay( unsigned long delay )
{
if ( delay == 0 ) {
oStream_ << "Echo::setMaximumDelay: parameter cannot be zero!";
handleError( StkError::WARNING ); return;
}
length_ = delay;
delayLine_.setMaximumDelay( delay );
}
void Echo :: setDelay( unsigned long delay )
{
if ( delay > length_ ) {
oStream_ << "Echo::setDelay: parameter is greater than maximum delay length!";
handleError( StkError::WARNING ); return;
}
delayLine_.setDelay( delay );
}
} // stk namespace