VISR  0.12.0
Versatile Interactive Scene Renderer
visr::rbbl::MultichannelDelayLine< SampleType > Class Template Reference

#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)
 

Detailed Description

template<typename SampleType>
class visr::rbbl::MultichannelDelayLine< SampleType >

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.

Template Parameters
SampleTypeThe floating-point type of the signal samples

Member Enumeration Documentation

template<typename SampleType >
enum visr::rbbl::MultichannelDelayLine::MethodDelayPolicy : char
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.

Enumerator
Add 

Always add the implementation delay to the nominal amount of delay.

Limit 

Compensate the implementation delay, but limit to the minimum admissible delay if the nominal delay is smaller than the implementation delay

Reject 

Throw an exception if the nominal delay value is lower than the method delay.

Constructor & Destructor Documentation

template<typename SampleType >
visr::rbbl::MultichannelDelayLine< SampleType >::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 
)
explicit

Constructor.

Parameters
numberOfChannelsThe number of input signals processed.
samplingFrequencyThe sampling frequency [in Hz]. This is needed to convert the delay input values to samples.
blockLengthThe numbers of samples written in each call to write().
maxDelaySecondsThe 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.
interpolationMethodThe fractional delay method used to retrieve the delayed samples. It must match the name of an algorithm registered in the FractionalDelayFactory factory class.
methodDelayPolicyEnumeration value determining how the inherent method (or implementation) delay is incorporated into the desired delay value.
alignmentThe 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 .
template<typename SampleType >
visr::rbbl::MultichannelDelayLine< SampleType >::~MultichannelDelayLine ( )
default

Destructor.

Member Function Documentation

template<typename SampleType >
std::size_t visr::rbbl::MultichannelDelayLine< SampleType >::blockLength ( ) const

The number of elements to be written in one call to write().

template<typename SampleType >
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.

Parameters
[out]outputBuffer to return the interpolated signal. Must provide space for numberOfSamples values and be aligned with the alignment set in the constructor.
channelIdxThe delay line channel to be interpolated. Must be in the range $0 <= channelIndex < numberOfChannels()$.
numberOfSamplesThe number of samples to be generated.
startDelayThe 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].
endDelayThe start value for the interpolated delay values (in seconds). This delay value is reached at the last output sample output[numberOfSamples-1]
startGainThe 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].
endGainThe start value for the interpolated gain values (linear scale). This gain value is reached at the last output sample output[numberOfSamples-1]
Exceptions
std::invalid_argumentIf channelIndex exceeds the number of channels in the delay line.
std::out_of_rangeIf either startDelay or endDelay exceeds the configured maximum delay.
std::out_of_rangeIf either startDelay or endDelay undershoots the minimum admissible delay (determined by the selected fractional delay algorithm and the chosen policy for the method delay.
template<typename SampleType >
SampleType visr::rbbl::MultichannelDelayLine< SampleType >::methodDelaySamples ( ) const

Return the inherent method delay (or implementation delay).

Returns
Implementation delay in samples.
template<typename SampleType >
SampleType visr::rbbl::MultichannelDelayLine< SampleType >::methodDelaySeconds ( ) const

Return the inherent method delay (or implementation delay).

Returns
Implementation delay in seconds.
template<typename SampleType >
std::size_t visr::rbbl::MultichannelDelayLine< SampleType >::numberOfChannels ( ) const

Return the number of channels in the delay line.

template<typename SampleType >
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.

Parameters
inputThe data to be written. Samples within a channel must be contiguous (stride==1)
channelStrideThe distance (in number of elements) between the sample data of subsequent channels.
numberOfChannelsThe number of channels contained in the input buffer.
alignmentThe minimum alignment (in samples) of each channel of the input buffer.
Exceptions
std::invalid_argumentIf numberOfChannels does not match the channel number of the delay line.

The documentation for this class was generated from the following files: