sfFDN
Loading...
Searching...
No Matches
sfFDN::DelayInterp Class Reference

Delay line with interpolation. More...

#include <delay_interp.h>

Inheritance diagram for sfFDN::DelayInterp:
[legend]
Collaboration diagram for sfFDN::DelayInterp:
[legend]

Public Member Functions

 DelayInterp (const DelayOptions &config={})
 Constructs a delay line with interpolation.
 
void Clear () override
 Clears all internal states of the delay line.
 
uint32_t GetMaximumDelay () const
 Gets the maximum delay-line length.
 
void SetMaximumDelay (uint32_t delay)
 Sets the maximum delay for the delay line.
 
void SetDelay (float delay) noexcept SFFDN_NONBLOCKING
 Sets the delay for the delay line.
 
float GetDelay () const
 Returns the current delay in samples.
 
float Tick (float input) noexcept SFFDN_NONBLOCKING
 Processes a single sample through the delay line.
 
float NextOut () noexcept SFFDN_NONBLOCKING
 Returns the next output sample without writing a new input sample.
 
void Advance (float input) noexcept SFFDN_NONBLOCKING
 Writes the next input sample into the delay line and advances it.
 
float TapOut (uint32_t tap) const noexcept SFFDN_NONBLOCKING
 Taps the delay line at a fixed integer delay, without interpolation.
 
void Process (const AudioBuffer &input, AudioBuffer &output) noexcept SFFDN_NONBLOCKING override
 Processes a block of input samples.
 
bool AddNextInputs (std::span< const float > input) noexcept SFFDN_NONBLOCKING
 Adds the next input samples to the delay line.
 
void GetNextOutputs (std::span< float > output) noexcept SFFDN_NONBLOCKING
 Gets the next output samples from the delay line.
 
uint32_t InputChannelCount () const noexcept SFFDN_NONBLOCKING override
 Returns the number of input channels this processor expects.
 
uint32_t OutputChannelCount () const noexcept SFFDN_NONBLOCKING override
 Returns the number of output channels this processor produces.
 
std::unique_ptr< AudioProcessorClone () const override
 Creates a copy of the audio processor.
 
- Public Member Functions inherited from sfFDN::AudioProcessor

Additional Inherited Members

- Protected Member Functions inherited from sfFDN::AudioProcessor
 AudioProcessor (const AudioProcessor &)=default
 
AudioProcessoroperator= (const AudioProcessor &)=default
 
 AudioProcessor (AudioProcessor &&) noexcept=default
 
AudioProcessoroperator= (AudioProcessor &&) noexcept=default
 

Detailed Description

Delay line with interpolation.

Constructor & Destructor Documentation

◆ DelayInterp()

sfFDN::DelayInterp::DelayInterp ( const DelayOptions & config = {})

Constructs a delay line with interpolation.

Parameters
configThe configuration for the delay line.

Member Function Documentation

◆ AddNextInputs()

bool sfFDN::DelayInterp::AddNextInputs ( std::span< const float > input)
noexcept

Adds the next input samples to the delay line.

Parameters
inputThe input samples to add.
Returns
True if the samples were added successfully, false otherwise.
Note
A return value of false indicates that there was not enough space in the internal buffer to write the input samples. In this case, the internal state remains unchanged. When processing audio in blocks, the delay line maximum delay should be set to a value that is larger than the block size.

◆ Advance()

void sfFDN::DelayInterp::Advance ( float input)
noexcept

Writes the next input sample into the delay line and advances it.

Parameters
inputThe input sample to write.
Note
This is the read-before-write counterpart of Tick(). See NextOut().

◆ Clear()

void sfFDN::DelayInterp::Clear ( )
overridevirtual

Clears all internal states of the delay line.

Implements sfFDN::AudioProcessor.

◆ Clone()

std::unique_ptr< AudioProcessor > sfFDN::DelayInterp::Clone ( ) const
overridevirtual

Creates a copy of the audio processor.

Returns
A unique pointer to the cloned audio processor.

Implements sfFDN::AudioProcessor.

◆ GetNextOutputs()

void sfFDN::DelayInterp::GetNextOutputs ( std::span< float > output)
noexcept

Gets the next output samples from the delay line.

Parameters
outputThe output samples to fill.
Note
This is the read-before-write counterpart of Process(): the block is read out first and written in afterwards with AddNextInputs(). The current delay must therefore be at least as large as the block size, and at least one sample larger than that for the Lagrange interpolation type, whose kernel straddles the fractional delay.

◆ InputChannelCount()

uint32_t sfFDN::DelayInterp::InputChannelCount ( ) const
inlineoverridevirtualnoexcept

Returns the number of input channels this processor expects.

Implements sfFDN::AudioProcessor.

◆ NextOut()

float sfFDN::DelayInterp::NextOut ( )
noexcept

Returns the next output sample without writing a new input sample.

Returns
The interpolated output sample for the current delay.
Note
This is the read-before-write counterpart of Tick(). Calling NextOut() followed by Advance(input) returns the same output sample as Tick(input), but allows the output sample to be used to compute the input sample, which is required to close a feedback loop around the delay line.
The current delay must be at least one sample. For the Lagrange interpolation type, the current delay must be at least two samples.
The returned value is cached until the next call to Advance(), Tick(), SetDelay() or Clear(), so calling NextOut() several times in a row is safe and returns the same value.

◆ OutputChannelCount()

uint32_t sfFDN::DelayInterp::OutputChannelCount ( ) const
inlineoverridevirtualnoexcept

Returns the number of output channels this processor produces.

Implements sfFDN::AudioProcessor.

◆ Process()

void sfFDN::DelayInterp::Process ( const AudioBuffer & input,
AudioBuffer & output )
overridevirtualnoexcept

Processes a block of input samples.

Parameters
inputThe input audio buffer.
outputThe output audio buffer.

Implements sfFDN::AudioProcessor.

◆ SetDelay()

void sfFDN::DelayInterp::SetDelay ( float delay)
noexcept

Sets the delay for the delay line.

Parameters
delayThe delay in samples.
Note
The smallest delay that can be realised depends on the interpolation type: 0.5 samples for Allpass and 1 sample for Lagrange. Smaller values are clamped.

◆ SetMaximumDelay()

void sfFDN::DelayInterp::SetMaximumDelay ( uint32_t delay)

Sets the maximum delay for the delay line.

Parameters
delayThe maximum delay in samples.

◆ TapOut()

float sfFDN::DelayInterp::TapOut ( uint32_t tap) const
noexcept

Taps the delay line at a fixed integer delay, without interpolation.

Parameters
tapThe tap point in samples.
Returns
The sample stored at the tap point.
Note
The tap is counted from the write pointer, so TapOut(0) returns the most recently written sample. After Advance(x[n]), TapOut(tap) returns x[n - tap]; before the write, it returns x[n - 1 - tap].
The tap is independent of the current delay and of the interpolation type.

◆ Tick()

float sfFDN::DelayInterp::Tick ( float input)
noexcept

Processes a single sample through the delay line.

Parameters
inputThe input sample to process.
Returns
The processed output sample.

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