Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
STK non-interpolating tapped delay line class. More...
#include <TapDelay.h>
Public Member Functions | |
TapDelay (std::vector< unsigned long > taps=std::vector< unsigned long >(1, 0), unsigned long maxDelay=4095) | |
The default constructor creates a delay-line with maximum length of 4095 samples and a single tap at delay = 0. | |
~TapDelay () | |
Class destructor. | |
void | setMaximumDelay (unsigned long delay) |
Set the maximum delay-line length. | |
void | setTapDelays (std::vector< unsigned long > taps) |
Set the delay-line tap lengths. | |
std::vector< unsigned long > | getTapDelays (void) const |
Return the current delay-line length. | |
StkFloat | lastOut (unsigned int tap=0) const |
Return the specified tap value of the last computed frame. | |
StkFrames & | tick (StkFloat input, StkFrames &outputs) |
Input one sample to the delayline and return outputs at all tap positions. | |
StkFrames & | tick (StkFrames &frames, unsigned int channel=0) |
Take a channel of the StkFrames object as inputs to the filter and write outputs back to the same object. | |
StkFrames & | tick (StkFrames &iFrames, StkFrames &oFrames, unsigned int iChannel=0) |
Take a channel of the iFrames object as inputs to the filter and write outputs to the oFrames object. | |
![]() | |
Filter (void) | |
Class constructor. | |
unsigned int | channelsIn (void) const |
Return the number of input channels for the class. | |
unsigned int | channelsOut (void) const |
Return the number of output channels for the class. | |
virtual void | clear (void) |
Clears all internal states of the filter. | |
void | setGain (StkFloat gain) |
Set the filter gain. | |
StkFloat | getGain (void) const |
Return the current filter gain. | |
StkFloat | phaseDelay (StkFloat frequency) |
Return the filter phase delay at the specified frequency. | |
const StkFrames & | lastFrame (void) const |
Return an StkFrames reference to the last output sample frame. | |
virtual StkFrames & | tick (StkFrames &frames, unsigned int channel=0)=0 |
Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs. | |
![]() | |
void | ignoreSampleRateChange (bool ignore=true) |
A function to enable/disable the automatic updating of class data when the STK sample rate changes. | |
Additional Inherited Members | |
![]() | |
static StkFloat | sampleRate (void) |
Static method that returns the current STK sample rate. | |
static void | setSampleRate (StkFloat rate) |
Static method that sets the STK sample rate. | |
static void | clear_alertList () |
Static method that frees memory from alertList_. | |
static std::string | rawwavePath (void) |
Static method that returns the current rawwave path. | |
static void | setRawwavePath (std::string path) |
Static method that sets the STK rawwave path. | |
static void | swap16 (unsigned char *ptr) |
Static method that byte-swaps a 16-bit data type. | |
static void | swap32 (unsigned char *ptr) |
Static method that byte-swaps a 32-bit data type. | |
static void | swap64 (unsigned char *ptr) |
Static method that byte-swaps a 64-bit data type. | |
static void | sleep (unsigned long milliseconds) |
Static cross-platform method to sleep for a number of milliseconds. | |
static bool | inRange (StkFloat value, StkFloat min, StkFloat max) |
Static method to check whether a value is within a specified range. | |
static void | handleError (const char *message, StkError::Type type) |
Static function for error reporting and handling using c-strings. | |
static void | handleError (std::string message, StkError::Type type) |
Static function for error reporting and handling using c++ strings. | |
static void | showWarnings (bool status) |
Toggle display of WARNING and STATUS messages. | |
static void | printErrors (bool status) |
Toggle display of error messages before throwing exceptions. | |
![]() | |
static const StkFormat | STK_SINT8 |
static const StkFormat | STK_SINT16 |
static const StkFormat | STK_SINT24 |
static const StkFormat | STK_SINT32 |
static const StkFormat | STK_FLOAT32 |
static const StkFormat | STK_FLOAT64 |
![]() | |
Stk (void) | |
Default constructor. | |
virtual | ~Stk (void) |
Class destructor. | |
virtual void | sampleRateChanged (StkFloat newRate, StkFloat oldRate) |
This function should be implemented in subclasses that depend on the sample rate. | |
void | addSampleRateAlert (Stk *ptr) |
Add class pointer to list for sample rate change notification. | |
void | removeSampleRateAlert (Stk *ptr) |
Remove class pointer from list for sample rate change notification. | |
void | handleError (StkError::Type type) const |
Internal function for error reporting that assumes message in oStream_ variable. | |
STK non-interpolating tapped delay line class.
This class implements a non-interpolating digital delay-line with an arbitrary number of output "taps". If the maximum length and tap delays are not specified during instantiation, a fixed maximum length of 4095 and a single tap delay of zero is set.
A non-interpolating delay line is typically used in fixed delay-length applications, such as for reverberation.
by Perry R. Cook and Gary P. Scavone, 1995–2023.
stk::TapDelay::TapDelay | ( | std::vector< unsigned long > | taps = std::vector< unsigned long >(1, 0) , |
unsigned long | maxDelay = 4095 |
||
) |
The default constructor creates a delay-line with maximum length of 4095 samples and a single tap at delay = 0.
An StkError will be thrown if any tap delay parameter is less than zero, the maximum delay parameter is less than one, or any tap delay parameter is greater than the maxDelay value.
void stk::TapDelay::setMaximumDelay | ( | unsigned long | delay | ) |
Set the maximum delay-line length.
This method should generally only be used during initial setup of the delay line. If it is used between calls to the tick() function, without a call to clear(), a signal discontinuity will likely occur. If the current maximum length is greater than the new length, no change will be made.
void stk::TapDelay::setTapDelays | ( | std::vector< unsigned long > | taps | ) |
Set the delay-line tap lengths.
The valid range for each tap length is from 0 to the maximum delay-line length.
|
inline |
Return the specified tap value of the last computed frame.
Use the lastFrame() function to get all tap values from the last computed frame. The tap
argument must be less than the number of delayline taps (the first tap is specified by 0). However, range checking is only performed if STK_DEBUG is defined during compilation, in which case an out-of-range value will trigger an StkError exception.
Input one sample to the delayline and return outputs at all tap positions.
The StkFrames argument reference is returned. The output values are ordered according to the tap positions set using the setTapDelays() function (no sorting is performed). The StkFrames argument must contain at least as many channels as the number of taps. However, range checking is only performed if STK_DEBUG is defined during compilation, in which case an out-of-range value will trigger an StkError exception.
Take a channel of the StkFrames object as inputs to the filter and write outputs back to the same object.
The StkFrames argument reference is returned. The output values are ordered according to the tap positions set using the setTapDelays() function (no sorting is performed). The StkFrames argument must contain at least as many channels as the number of taps. However, range checking is only performed if STK_DEBUG is defined during compilation, in which case an out-of-range value will trigger an StkError exception.
Implements stk::Filter.
|
inline |
Take a channel of the iFrames
object as inputs to the filter and write outputs to the oFrames
object.
The iFrames
object reference is returned. The output values are ordered according to the tap positions set using the setTapDelays() function (no sorting is performed). The iChannel
argument must be less than the number of channels in the iFrames
argument (the first channel is specified by 0). The oFrames
argument must contain at least as many channels as the number of taps. However, range checking is only performed if STK_DEBUG is defined during compilation, in which case an out-of-range value will trigger an StkError exception.
The Synthesis ToolKit in C++ (STK) |
©1995--2023 Perry R. Cook and Gary P. Scavone. All Rights Reserved. |