37 DelayL( StkFloat delay = 0.0,
unsigned long maxDelay = 4095 );
62 StkFloat
getDelay(
void )
const {
return delay_; };
70 StkFloat
tapOut(
unsigned long tapDelay );
73 void tapIn( StkFloat value,
unsigned long tapDelay );
76 StkFloat
lastOut(
void )
const {
return lastFrame_[0]; };
85 StkFloat
tick( StkFloat input );
111 unsigned long inPoint_;
112 unsigned long outPoint_;
116 StkFloat nextOutput_;
124 nextOutput_ = inputs_[outPoint_] * omAlpha_;
126 if (outPoint_+1 < inputs_.
size())
127 nextOutput_ += inputs_[outPoint_+1] * alpha_;
129 nextOutput_ += inputs_[0] * alpha_;
138 if ( delay + 1 > inputs_.
size() ) {
139 oStream_ <<
"DelayL::setDelay: argument (" << delay <<
") greater than maximum!";
144 oStream_ <<
"DelayL::setDelay: argument (" << delay <<
") less than zero!";
148 StkFloat outPointer = inPoint_ - delay;
151 while ( outPointer < 0 )
152 outPointer += inputs_.
size();
154 outPoint_ = (long) outPointer;
156 alpha_ = outPointer - outPoint_;
157 omAlpha_ = (StkFloat) 1.0 - alpha_;
159 if ( outPoint_ == inputs_.
size() ) outPoint_ = 0;
165 inputs_[inPoint_++] = input * gain_;
168 if ( inPoint_ == inputs_.
size() )
175 if ( ++outPoint_ == inputs_.
size() )
178 return lastFrame_[0];
183 #if defined(_STK_DEBUG_)
184 if ( channel >= frames.
channels() ) {
185 oStream_ <<
"DelayL::tick(): channel and StkFrames arguments are incompatible!";
190 StkFloat *samples = &frames[channel];
191 unsigned int hop = frames.
channels();
192 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
193 inputs_[inPoint_++] = *samples * gain_;
194 if ( inPoint_ == inputs_.
size() ) inPoint_ = 0;
197 if ( ++outPoint_ == inputs_.
size() ) outPoint_ = 0;
200 lastFrame_[0] = *(samples-hop);
206 #if defined(_STK_DEBUG_)
208 oStream_ <<
"DelayL::tick(): channel and StkFrames arguments are incompatible!";
213 StkFloat *iSamples = &iFrames[iChannel];
214 StkFloat *oSamples = &oFrames[oChannel];
216 for (
unsigned int i=0; i<iFrames.
frames(); i++, iSamples += iHop, oSamples += oHop ) {
217 inputs_[inPoint_++] = *iSamples * gain_;
218 if ( inPoint_ == inputs_.
size() ) inPoint_ = 0;
221 if ( ++outPoint_ == inputs_.
size() ) outPoint_ = 0;
224 lastFrame_[0] = *(oSamples-oHop);