28 Chorus( StkFloat baseDelay = 6000 );
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);