34 TapDelay( std::vector<unsigned long> taps = std::vector<unsigned long>( 1, 0 ),
unsigned long maxDelay = 4095 );
56 std::vector<unsigned long>
getTapDelays(
void )
const {
return delays_; };
67 StkFloat
lastOut(
unsigned int tap = 0 )
const;
109 unsigned long inPoint_;
110 std::vector<unsigned long> outPoint_;
111 std::vector<unsigned long> delays_;
117 #if defined(_STK_DEBUG_)
118 if ( tap >= lastFrame_.
size() ) {
119 oStream_ <<
"TapDelay::lastOut(): tap argument and number of taps are incompatible!";
124 return lastFrame_[tap];
129 #if defined(_STK_DEBUG_)
130 if ( outputs.
channels() < outPoint_.size() ) {
131 oStream_ <<
"TapDelay::tick(): number of taps > channels in StkFrames argument!";
136 inputs_[inPoint_++] = input * gain_;
139 if ( inPoint_ == inputs_.
size() )
143 StkFloat *outs = &outputs[0];
144 for (
unsigned int i=0; i<outPoint_.size(); i++ ) {
145 *outs++ = inputs_[outPoint_[i]];
146 lastFrame_[i] = *outs;
147 if ( ++outPoint_[i] == inputs_.
size() )
156 #if defined(_STK_DEBUG_)
157 if ( channel >= frames.
channels() ) {
158 oStream_ <<
"TapDelay::tick(): channel and StkFrames arguments are incompatible!";
161 if ( frames.
channels() < outPoint_.size() ) {
162 oStream_ <<
"TapDelay::tick(): number of taps > channels in StkFrames argument!";
167 StkFloat *iSamples = &frames[channel];
168 StkFloat *oSamples = &frames[0];
170 unsigned int iHop = frames.
channels();
171 std::size_t oHop = frames.
channels() - outPoint_.size();
172 for (
unsigned long i=0; i<frames.
frames(); i++, iSamples += iHop, oSamples += oHop ) {
173 inputs_[inPoint_++] = *iSamples * gain_;
174 if ( inPoint_ == inputs_.
size() ) inPoint_ = 0;
175 for ( j=0; j<outPoint_.size(); j++ ) {
176 *oSamples++ = inputs_[outPoint_[j]];
177 if ( ++outPoint_[j] == inputs_.
size() ) outPoint_[j] = 0;
182 for ( j=0; j<outPoint_.size(); j++ ) lastFrame_[j] = *oSamples++;
188 #if defined(_STK_DEBUG_)
189 if ( iChannel >= iFrames.
channels() ) {
190 oStream_ <<
"TapDelay::tick(): channel and StkFrames arguments are incompatible!";
193 if ( oFrames.
channels() < outPoint_.size() ) {
194 oStream_ <<
"TapDelay::tick(): number of taps > channels in output StkFrames argument!";
199 StkFloat *iSamples = &iFrames[iChannel];
200 StkFloat *oSamples = &oFrames[0];
202 unsigned int iHop = iFrames.
channels();
203 std::size_t oHop = oFrames.
channels() - outPoint_.size();
204 for (
unsigned long i=0; i<iFrames.
frames(); i++, iSamples += iHop, oSamples += oHop ) {
205 inputs_[inPoint_++] = *iSamples * gain_;
206 if ( inPoint_ == inputs_.
size() ) inPoint_ = 0;
207 for ( j=0; j<outPoint_.size(); j++ ) {
208 *oSamples++ = inputs_[outPoint_[j]];
209 if ( ++outPoint_[j] == inputs_.
size() ) outPoint_[j] = 0;
214 for ( j=0; j<outPoint_.size(); j++ ) lastFrame_[j] = *oSamples++;