34 Delay(
unsigned long delay = 0,
unsigned long maxDelay = 4095 );
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_]; };
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);
STK non-interpolating delay line class.
Definition: Delay.h:25
void setMaximumDelay(unsigned long delay)
Set the maximum delay-line length.
StkFloat energy(void) const
Calculate and return the signal energy in the delay-line.
StkFloat nextOut(void)
Return the value that will be output by the next call to tick().
Definition: Delay.h:87
~Delay()
Class destructor.
unsigned long getMaximumDelay(void)
Get the maximum delay-line length.
Definition: Delay.h:40
StkFloat tapOut(unsigned long tapDelay)
Return the value at tapDelay samples from the delay-line input.
void setDelay(unsigned long delay)
Set the delay-line length.
unsigned long getDelay(void) const
Return the current delay-line length.
Definition: Delay.h:59
StkFloat addTo(StkFloat value, unsigned long tapDelay)
Sum the provided value into the delay line at tapDelay samples from the input.
Delay(unsigned long delay=0, unsigned long maxDelay=4095)
The default constructor creates a delay-line with maximum length of 4095 samples and zero delay.
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition: Delay.h:124
StkFloat lastOut(void) const
Return the last computed output value.
Definition: Delay.h:81
void tapIn(StkFloat value, unsigned long tapDelay)
Set the value at tapDelay samples from the delay-line input.
STK abstract filter class.
Definition: Filter.h:23
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
size_t size() const
Returns the total number of audio samples represented by the object.
Definition: Stk.h:373
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