mirror of
https://github.com/thestk/stk
synced 2026-01-13 21:11:53 +00:00
Version 3.2
This commit is contained in:
committed by
Stephen Sinclair
parent
4b6500d3de
commit
3f126af4e5
44
projects/effects/Echo.cpp
Normal file
44
projects/effects/Echo.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/******************************************/
|
||||
/* 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user