Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
STK echo effect class. More...
#include <Echo.h>
Public Member Functions | |
Echo (unsigned long maximumDelay=(unsigned long) Stk::sampleRate()) | |
Class constructor, taking the longest desired delay length (one second default value). | |
void | clear () |
Reset and clear all internal state. | |
void | setMaximumDelay (unsigned long delay) |
Set the maximum delay line length in samples. | |
void | setDelay (unsigned long delay) |
Set the delay line length in samples. | |
StkFloat | lastOut (void) const |
Return the last computed output value. | |
StkFloat | tick (StkFloat input) |
Input one sample to the effect and return one output. | |
StkFrames & | tick (StkFrames &frames, unsigned int channel=0) |
Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs. | |
StkFrames & | tick (StkFrames &iFrames, StkFrames &oFrames, unsigned int iChannel=0, unsigned int oChannel=0) |
Take a channel of the iFrames object as inputs to the effect and write outputs to the oFrames object. |
STK echo effect class.
This class implements an echo effect.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
stk::Echo::Echo | ( | unsigned long | maximumDelay = (unsigned long) Stk::sampleRate() |
) |
Class constructor, taking the longest desired delay length (one second default value).
The default delay value is set to 1/2 the maximum delay length.
Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs.
The StkFrames argument reference is returned. The channel
argument must be less than the number of channels in the StkFrames argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.
00079 { 00080 #if defined(_STK_DEBUG_) 00081 if ( channel >= frames.channels() ) { 00082 oStream_ << "Echo::tick(): channel and StkFrames arguments are incompatible!"; 00083 handleError( StkError::FUNCTION_ARGUMENT ); 00084 } 00085 #endif 00086 00087 StkFloat *samples = &frames[channel]; 00088 unsigned int hop = frames.channels(); 00089 for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) { 00090 *samples = effectMix_ * ( delayLine_.tick( *samples ) - *samples ) + *samples; 00091 } 00092 00093 lastFrame_[0] = *(samples-hop); 00094 return frames; 00095 }
StkFrames & stk::Echo::tick | ( | StkFrames & | iFrames, | |
StkFrames & | oFrames, | |||
unsigned int | iChannel = 0 , |
|||
unsigned int | oChannel = 0 | |||
) | [inline] |
Take a channel of the iFrames
object as inputs to the effect and write outputs to the oFrames
object.
The iFrames
object reference is returned. Each channel argument must be less than the number of channels in the corresponding StkFrames argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.
00098 { 00099 #if defined(_STK_DEBUG_) 00100 if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) { 00101 oStream_ << "Echo::tick(): channel and StkFrames arguments are incompatible!"; 00102 handleError( StkError::FUNCTION_ARGUMENT ); 00103 } 00104 #endif 00105 00106 StkFloat *iSamples = &iFrames[iChannel]; 00107 StkFloat *oSamples = &oFrames[oChannel]; 00108 unsigned int iHop = iFrames.channels(), oHop = oFrames.channels(); 00109 for ( unsigned int i=0; i<iFrames.frames(); i++, iSamples += iHop, oSamples += oHop ) { 00110 *oSamples = effectMix_ * ( delayLine_.tick( *iSamples ) - *iSamples ) + *iSamples; 00111 } 00112 00113 lastFrame_[0] = *(oSamples-oHop); 00114 return iFrames; 00115 }
The Synthesis ToolKit in C++ (STK) |
©1995-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved. |