48 StkFloat
lastOut(
unsigned int channel = 0 );
58 StkFloat
tick( StkFloat input,
unsigned int channel = 0 );
95 #if defined(_STK_DEBUG_)
97 oStream_ <<
"Chorus::lastOut(): channel argument must be less than 2!";
102 return lastFrame_[channel];
107 #if defined(_STK_DEBUG_)
109 oStream_ <<
"Chorus::tick(): channel argument must be less than 2!";
114 delayLine_[0].
setDelay( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].
tick() ) );
115 delayLine_[1].
setDelay( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].
tick() ) );
116 lastFrame_[0] = effectMix_ * ( delayLine_[0].
tick( input ) - input ) + input;
117 lastFrame_[1] = effectMix_ * ( delayLine_[1].
tick( input ) - input ) + input;
118 return lastFrame_[channel];
123 #if defined(_STK_DEBUG_)
124 if ( channel >= frames.
channels() - 1 ) {
125 oStream_ <<
"Chorus::tick(): channel and StkFrames arguments are incompatible!";
130 StkFloat *samples = &frames[channel];
131 unsigned int hop = frames.
channels() - 1;
132 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
133 delayLine_[0].
setDelay( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].
tick() ) );
134 delayLine_[1].
setDelay( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].
tick() ) );
135 *samples = effectMix_ * ( delayLine_[0].
tick( *samples ) - *samples ) + *samples;
137 *samples = effectMix_ * ( delayLine_[1].
tick( *samples ) - *samples ) + *samples;
140 lastFrame_[0] = *(samples-hop);
141 lastFrame_[1] = *(samples-hop+1);
147 #if defined(_STK_DEBUG_)
148 if ( iChannel >= iFrames.
channels() || oChannel >= oFrames.
channels() - 1 ) {
149 oStream_ <<
"Chorus::tick(): channel and StkFrames arguments are incompatible!";
154 StkFloat *iSamples = &iFrames[iChannel];
155 StkFloat *oSamples = &oFrames[oChannel];
157 for (
unsigned int i=0; i<iFrames.
frames(); i++, iSamples += iHop, oSamples += oHop ) {
158 delayLine_[0].
setDelay( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].
tick() ) );
159 delayLine_[1].
setDelay( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].
tick() ) );
160 *oSamples = effectMix_ * ( delayLine_[0].
tick( *iSamples ) - *iSamples ) + *iSamples;
161 *(oSamples+1) = effectMix_ * ( delayLine_[1].
tick( *iSamples ) - *iSamples ) + *iSamples;
164 lastFrame_[0] = *(oSamples-oHop);
165 lastFrame_[1] = *(oSamples-oHop+1);
STK chorus effect class.
Definition: Chorus.h:22
StkFloat tick(StkFloat input, unsigned int channel=0)
Input one sample to the effect and return the specified channel value of the computed stereo frame.
Definition: Chorus.h:105
Chorus(StkFloat baseDelay=6000)
Class constructor, taking the median desired delay length.
void clear(void)
Reset and clear all internal state.
void setModFrequency(StkFloat frequency)
Set modulation frequency.
StkFloat lastOut(unsigned int channel=0)
Return the specified channel value of the last computed stereo frame.
Definition: Chorus.h:93
void setModDepth(StkFloat depth)
Set modulation depth in range 0.0 - 1.0.
STK linear interpolating delay line class.
Definition: DelayL.h:28
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition: DelayL.h:163
void setDelay(StkFloat delay)
Set the delay-line length.
Definition: DelayL.h:136
STK abstract effects parent class.
Definition: Effect.h:22
STK sinusoid oscillator class.
Definition: SineWave.h:26
An STK class to handle vectorized audio data.
Definition: Stk.h:287
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition: Stk.h:415
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition: Stk.h:418
static void handleError(const char *message, StkError::Type type)
Static function for error reporting and handling using c-strings.
The STK namespace.
Definition: ADSR.h:8