![]() |
VISR
0.11.8
Versatile Interactive Scene Renderer
|
#include <multichannel_delay_line.hpp>
Public Types | |
enum | MethodDelayPolicy : char { MethodDelayPolicy::Add, MethodDelayPolicy::Limit, MethodDelayPolicy::Reject } |
Public Member Functions | |
MultichannelDelayLine (std::size_t numberOfChannels, SamplingFrequencyType samplingFrequency, std::size_t blockLength, SampleType maxDelaySeconds, char const *interpolationMethod, MethodDelayPolicy methodDelayPolicy=MethodDelayPolicy::Add, std::size_t alignment=0) | |
~MultichannelDelayLine () | |
std::size_t | numberOfChannels () const |
std::size_t | blockLength () const |
SampleType | methodDelaySeconds () const |
SampleType | methodDelaySamples () const |
void | write (SampleType const *input, std::size_t channelStride, std::size_t numberOfChannels, std::size_t alignment) |
void | interpolate (SampleType *output, std::size_t channelIdx, std::size_t numberOfSamples, SampleType startDelay, SampleType endDelay, SampleType startGain, SampleType endGain) |
Generic multichannel delay line class that may use a variety of fractional delay interpolation techniques. New input is written as one multichannel chunk with a fixed number of samples, but data is read individually based on the current write pointer position. Thus this class can be used as a multitap delay line.
SampleType | The floating-point type of the signal samples |
|
strong |
Enumeration for how to incorporate the implementation delay of the method into the interpolation. The implementation (or method) delay is the delay introduced by the fractional delay algorithm itself.
|
explicit |
Constructor.
numberOfChannels | The number of input signals processed. |
samplingFrequency | The sampling frequency [in Hz]. This is needed to convert the delay input values to samples. |
blockLength | The numbers of samples written in each call to write(). |
maxDelaySeconds | The maximum admissible delay (in seconds) both reuse the same filter representation multiple times, or store multiple filter representations to enable switching of the filter characteristics at runtime. |
interpolationMethod | The fractional delay method used to retrieve the delayed samples. It must match the name of an algorithm registered in the FractionalDelayFactory factory class. |
methodDelayPolicy | Enumeration value determining how the inherent method (or implementation) delay is incorporated into the desired delay value. |
alignment | The alignment (given as a multiple of the sample type size) of the data buffers passed to the write() and interpolate() calls. The alignment setting is also used to allocate all data structures. the . |
|
default |
Destructor.
std::size_t visr::rbbl::MultichannelDelayLine< SampleType >::blockLength | ( | ) | const |
The number of elements to be written in one call to write().
void visr::rbbl::MultichannelDelayLine< SampleType >::interpolate | ( | SampleType * | output, |
std::size_t | channelIdx, | ||
std::size_t | numberOfSamples, | ||
SampleType | startDelay, | ||
SampleType | endDelay, | ||
SampleType | startGain, | ||
SampleType | endGain | ||
) |
Interpolate and scale a given number of samples of one of the input channels. The delay and gain (scaling) values are given for the first (actually one before the first) and the last sample, and delay and gain are interpolated linearly for the samples in between. However, the selected interpolation algorithm might behave somewhat differently.
[out] | output | Buffer to return the interpolated signal. Must provide space for numberOfSamples values and be aligned with the alignment set in the constructor. |
channelIdx | The delay line channel to be interpolated. Must be in the range $0 <= channelIndex < numberOfChannels()$. | |
numberOfSamples | The number of samples to be generated. | |
startDelay | The start value for the interpolated delay values (in seconds). In terms of the linearly interpolated delay, this value refers to the delay prior to the first output sample output [0]. | |
endDelay | The start value for the interpolated delay values (in seconds). This delay value is reached at the last output sample output [numberOfSamples-1] | |
startGain | The start value for the interpolated gain values (linear scale). In terms of the linearly interpolated gains, this value refers to the gain prior to the first output sample output [0]. | |
endGain | The start value for the interpolated gain values (linear scale). This gain value is reached at the last output sample output [numberOfSamples-1] |
std::invalid_argument | If channelIndex exceeds the number of channels in the delay line. |
std::out_of_range | If either startDelay or endDelay exceeds the configured maximum delay. |
std::out_of_range | If either startDelay or endDelay undershoots the minimum admissible delay (determined by the selected fractional delay algorithm and the chosen policy for the method delay. |
SampleType visr::rbbl::MultichannelDelayLine< SampleType >::methodDelaySamples | ( | ) | const |
Return the inherent method delay (or implementation delay).
SampleType visr::rbbl::MultichannelDelayLine< SampleType >::methodDelaySeconds | ( | ) | const |
Return the inherent method delay (or implementation delay).
std::size_t visr::rbbl::MultichannelDelayLine< SampleType >::numberOfChannels | ( | ) | const |
Return the number of channels in the delay line.
void visr::rbbl::MultichannelDelayLine< SampleType >::write | ( | SampleType const * | input, |
std::size_t | channelStride, | ||
std::size_t | numberOfChannels, | ||
std::size_t | alignment | ||
) |
Write a chunk of multichannel sample data into the delay line.
input | The data to be written. Samples within a channel must be contiguous (stride==1) |
channelStride | The distance (in number of elements) between the sample data of subsequent channels. |
numberOfChannels | The number of channels contained in the input buffer. |
alignment | The minimum alignment (in samples) of each channel of the input buffer. |
std::invalid_argument | If numberOfChannels does not match the channel number of the delay line. |