mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
45 lines
773 B
C++
45 lines
773 B
C++
/******************************************/
|
|
/* Echo Effect */
|
|
/* by Perry Cook, 1996 */
|
|
/******************************************/
|
|
|
|
#include "Echo.h"
|
|
|
|
Echo :: Echo(MY_FLOAT longestDelay)
|
|
{
|
|
length = (long) longestDelay + 2;
|
|
delayLine = new DLineN(length);
|
|
effectMix = 0.5;
|
|
this->clear();
|
|
this->setDelay(longestDelay);
|
|
}
|
|
|
|
Echo :: ~Echo()
|
|
{
|
|
delete delayLine;
|
|
}
|
|
|
|
void Echo :: clear()
|
|
{
|
|
delayLine->clear();
|
|
lastOut = 0.0;
|
|
}
|
|
|
|
void Echo :: setDelay(MY_FLOAT delay)
|
|
{
|
|
delayLine->setDelay(delay);
|
|
}
|
|
|
|
void Echo :: setEffectMix(MY_FLOAT mix)
|
|
{
|
|
effectMix = mix;
|
|
}
|
|
|
|
MY_FLOAT Echo :: tick(MY_FLOAT input)
|
|
{
|
|
lastOut = effectMix * delayLine->tick(input);
|
|
lastOut += input * (1.0 - effectMix);
|
|
return lastOut;
|
|
}
|
|
|