Public Member Functions | List of all members
dsp::DelayLine< SampleType, InterpolationType > Class Template Reference

A delay line processor featuring several algorithms for the fractional delay calculation, block processing, and sample-by-sample processing useful when modulating the delay in real time or creating a standard delay effect with feedback. More...

Public Member Functions

 DelayLine ()
 Default constructor. More...
 
 DelayLine (int maximumDelayInSamples)
 Constructor. More...
 
void setDelay (SampleType newDelayInSamples)
 Sets the delay in samples. More...
 
SampleType getDelay () const
 Returns the current delay in samples. More...
 
void prepare (const ProcessSpec &spec)
 Initialises the processor. More...
 
void reset ()
 Resets the internal state variables of the processor. More...
 
void pushSample (int channel, SampleType sample)
 Pushes a single sample into one channel of the delay line. More...
 
SampleType popSample (int channel, SampleType delayInSamples=-1, bool updateReadPointer=true)
 Pops a single sample from one channel of the delay line. More...
 
template<typename ProcessContext >
void process (const ProcessContext &context) noexcept
 Processes the input and output samples supplied in the processing context. More...
 

Detailed Description

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
class dsp::DelayLine< SampleType, InterpolationType >

A delay line processor featuring several algorithms for the fractional delay calculation, block processing, and sample-by-sample processing useful when modulating the delay in real time or creating a standard delay effect with feedback.

Note: If you intend to change the delay in real time, you may want to smooth changes to the delay systematically using either a ramp or a low-pass filter.

See also
SmoothedValue, FirstOrderTPTFilter

Constructor & Destructor Documentation

◆ DelayLine() [1/2]

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
dsp::DelayLine< SampleType, InterpolationType >::DelayLine ( )

Default constructor.

◆ DelayLine() [2/2]

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
dsp::DelayLine< SampleType, InterpolationType >::DelayLine ( int  maximumDelayInSamples)
explicit

Constructor.

Member Function Documentation

◆ setDelay()

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
void dsp::DelayLine< SampleType, InterpolationType >::setDelay ( SampleType  newDelayInSamples)

Sets the delay in samples.

◆ getDelay()

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
SampleType dsp::DelayLine< SampleType, InterpolationType >::getDelay ( ) const

Returns the current delay in samples.

◆ prepare()

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
void dsp::DelayLine< SampleType, InterpolationType >::prepare ( const ProcessSpec spec)

Initialises the processor.

◆ reset()

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
void dsp::DelayLine< SampleType, InterpolationType >::reset ( )

Resets the internal state variables of the processor.

◆ pushSample()

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
void dsp::DelayLine< SampleType, InterpolationType >::pushSample ( int  channel,
SampleType  sample 
)

Pushes a single sample into one channel of the delay line.

Use this function and popSample instead of process if you need to modulate the delay in real time instead of using a fixed delay value, or if you want to code a delay effect with a feedback loop.

See also
setDelay, popSample, process

Referenced by dsp::DelayLine< SampleType, dsp::DelayLineInterpolationTypes::Linear >::process().

◆ popSample()

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
SampleType dsp::DelayLine< SampleType, InterpolationType >::popSample ( int  channel,
SampleType  delayInSamples = -1,
bool  updateReadPointer = true 
)

Pops a single sample from one channel of the delay line.

Use this function to modulate the delay in real time or implement standard delay effects with feedback.

Parameters
channelthe target channel for the delay line.
delayInSamplessets the wanted fractional delay in samples, or -1 to use the value being used before or set with setDelay function.
updateReadPointershould be set to true if you use the function once for each sample, or false if you need multi-tap delay capabilities.
See also
setDelay, pushSample, process

Referenced by dsp::DelayLine< SampleType, dsp::DelayLineInterpolationTypes::Linear >::process().

◆ process()

template<typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
template<typename ProcessContext >
void dsp::DelayLine< SampleType, InterpolationType >::process ( const ProcessContext &  context)
noexcept

Processes the input and output samples supplied in the processing context.

Can be used for block processing when the delay is not going to change during processing. The delay must first be set by calling setDelay.

See also
setDelay

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