34 Delay(
unsigned long delay = 0,
unsigned long maxDelay = 4095 );
56 void setDelay(
unsigned long delay );
59 unsigned long getDelay(
void )
const {
return delay_; };
67 StkFloat
tapOut(
unsigned long tapDelay );
70 void tapIn( StkFloat value,
unsigned long tapDelay );
78 StkFloat
addTo( StkFloat value,
unsigned long tapDelay );
81 StkFloat
lastOut(
void )
const {
return lastFrame_[0]; };
87 StkFloat
nextOut(
void ) {
return inputs_[outPoint_]; };
90 StkFloat
energy(
void )
const;
93 StkFloat
tick( StkFloat input );
119 unsigned long inPoint_;
120 unsigned long outPoint_;
121 unsigned long delay_;
126 inputs_[inPoint_++] = input * gain_;
129 if ( inPoint_ == inputs_.
size() )
133 lastFrame_[0] = inputs_[outPoint_++];
135 if ( outPoint_ == inputs_.
size() )
138 return lastFrame_[0];
143 #if defined(_STK_DEBUG_)
144 if ( channel >= frames.
channels() ) {
145 oStream_ <<
"Delay::tick(): channel and StkFrames arguments are incompatible!";
150 StkFloat *samples = &frames[channel];
151 unsigned int hop = frames.
channels();
152 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
153 inputs_[inPoint_++] = *samples * gain_;
154 if ( inPoint_ == inputs_.
size() ) inPoint_ = 0;
155 *samples = inputs_[outPoint_++];
156 if ( outPoint_ == inputs_.
size() ) outPoint_ = 0;
159 lastFrame_[0] = *(samples-hop);
165 #if defined(_STK_DEBUG_)
167 oStream_ <<
"Delay::tick(): channel and StkFrames arguments are incompatible!";
172 StkFloat *iSamples = &iFrames[iChannel];
173 StkFloat *oSamples = &oFrames[oChannel];
175 for (
unsigned int i=0; i<iFrames.
frames(); i++, iSamples += iHop, oSamples += oHop ) {
176 inputs_[inPoint_++] = *iSamples * gain_;
177 if ( inPoint_ == inputs_.
size() ) inPoint_ = 0;
178 *oSamples = inputs_[outPoint_++];
179 if ( outPoint_ == inputs_.
size() ) outPoint_ = 0;
182 lastFrame_[0] = *(oSamples-oHop);