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

FDN (Feedback Delay Network) class. More...

#include <fdn.h>

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

Public Member Functions

 FDN (uint32_t order, uint32_t block_size=0, bool transpose=false)
 Constructs an FDN with a specified order (number of channels).
 
 FDN (const FDN &)=delete
 
FDNoperator= (const FDN &)=delete
 
 FDN (FDN &&) noexcept
 Move constructor for the FDN.
 
FDNoperator= (FDN &&) noexcept
 Move assignment operator for the FDN.
 
void SetOrder (uint32_t order)
 Set the number of channels of the FDN.
 
uint32_t GetOrder () const
 Get the FDN's order (number of channels).
 
void SetTranspose (bool transpose)
 Set whether to use transposed configuration.
 
bool GetTranspose () const
 Get whether the FDN is using transposed configuration.
 
bool SetInputGains (std::unique_ptr< AudioProcessor > gains)
 Set the Input Gains AudioProcessor.
 
bool SetOutputGains (std::unique_ptr< AudioProcessor > gains)
 Set the Output Gains AudioProcessor.
 
bool SetInputGains (std::span< const float > gains)
 Set the Input Gains from a span of floats.
 
bool SetOutputGains (std::span< const float > gains)
 Set the Output Gains from a span of floats.
 
AudioProcessorGetInputGains () const
 Get the Input Gains AudioProcessor.
 
AudioProcessorGetOutputGains () const
 Get the Output Gains AudioProcessor.
 
void SetDirectGain (float gain)
 Set the direct gain applied to the input signal when mixed to the output.
 
bool SetLoopFilter (std::unique_ptr< AudioProcessor > filter_bank)
 Set the Filter Bank AudioProcessor.
 
AudioProcessorGetLoopFilter () const
 Get the Filter Bank AudioProcessor.
 
bool SetDelayBank (const DelayBankOptions &config)
 Set the delay bank.
 
bool SetDelays (const std::span< const float > delays, DelayInterpolationType interpolation_type=DelayInterpolationType::None)
 Set the delays.
 
const DelayBankGetDelayBank () const
 Get the Delay Bank.
 
bool SetFeedbackMatrix (std::unique_ptr< AudioProcessor > mixing_matrix)
 Set the Feedback Matrix AudioProcessor.
 
AudioProcessorGetFeedbackMatrix () const
 Get the Feedback Matrix AudioProcessor.
 
bool SetTCFilter (std::unique_ptr< AudioProcessor > filter)
 Set the Tone Correction Filter AudioProcessor.
 
AudioProcessorGetTCFilter () const
 Get the Tone Correction Filter AudioProcessor.
 
void Process (const AudioBuffer &input, AudioBuffer &output) noexcept override
 Process audio buffers.
 
uint32_t InputChannelCount () const override
 Returns the number of input channels this processor expects.
 
uint32_t OutputChannelCount () const override
 Returns the number of output channels this processor produces.
 
void Clear () override
 Clears the internal state of the FDN.
 
std::unique_ptr< AudioProcessorClone () const override
 Creates a copy of the FDN.
 
std::unique_ptr< FDNCloneFDN () const
 Creates a copy of the FDN.
 
- Public Member Functions inherited from sfFDN::AudioProcessor

Detailed Description

FDN (Feedback Delay Network) class.

Constructor & Destructor Documentation

◆ FDN()

sfFDN::FDN::FDN ( uint32_t order,
uint32_t block_size = 0,
bool transpose = false )

Constructs an FDN with a specified order (number of channels).

Parameters
orderThe number of channels. Must be at least 4.
block_sizeThe size of the audio blocks to be processed in the main loop.
transposeWhether to use transposed configuration.

block_size is used to allocate internal buffers for processing.

Member Function Documentation

◆ Clear()

void sfFDN::FDN::Clear ( )
overridevirtual

Clears the internal state of the FDN.

This function clears the internal state of all delay banks, filter banks, and feedback matrices.

Implements sfFDN::AudioProcessor.

◆ Clone()

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

Creates a copy of the FDN.

Returns
A unique pointer to the cloned FDN.

Implements sfFDN::AudioProcessor.

◆ CloneFDN()

std::unique_ptr< FDN > sfFDN::FDN::CloneFDN ( ) const

Creates a copy of the FDN.

Returns
A unique pointer to the cloned FDN.

◆ GetDelayBank()

const DelayBank & sfFDN::FDN::GetDelayBank ( ) const

Get the Delay Bank.

Returns
A const reference to the Delay Bank.

◆ GetFeedbackMatrix()

AudioProcessor * sfFDN::FDN::GetFeedbackMatrix ( ) const

Get the Feedback Matrix AudioProcessor.

Returns
A pointer to the Feedback Matrix AudioProcessor, or nullptr if not set.

◆ GetInputGains()

AudioProcessor * sfFDN::FDN::GetInputGains ( ) const

Get the Input Gains AudioProcessor.

Returns
A pointer to the Input Gains AudioProcessor, or nullptr if not set.

◆ GetLoopFilter()

AudioProcessor * sfFDN::FDN::GetLoopFilter ( ) const

Get the Filter Bank AudioProcessor.

Returns
A pointer to the Filter Bank AudioProcessor, or nullptr if not set.

◆ GetOrder()

uint32_t sfFDN::FDN::GetOrder ( ) const

Get the FDN's order (number of channels).

Returns
The number of channels.

◆ GetOutputGains()

AudioProcessor * sfFDN::FDN::GetOutputGains ( ) const

Get the Output Gains AudioProcessor.

Returns
A pointer to the Output Gains AudioProcessor, or nullptr if not set.

◆ GetTCFilter()

AudioProcessor * sfFDN::FDN::GetTCFilter ( ) const

Get the Tone Correction Filter AudioProcessor.

Returns
A pointer to the Tone Correction Filter AudioProcessor, or nullptr if not set.

◆ GetTranspose()

bool sfFDN::FDN::GetTranspose ( ) const

Get whether the FDN is using transposed configuration.

Returns
true if using transposed configuration, false otherwise.
  • In transposed configuration, the input signal is fed to the feedback matrix first and the output of the feedback matrix is fed to the output of the FDN.

◆ InputChannelCount()

uint32_t sfFDN::FDN::InputChannelCount ( ) const
inlineoverridevirtual

Returns the number of input channels this processor expects.

Returns
1

Implements sfFDN::AudioProcessor.

◆ operator=()

FDN & sfFDN::FDN::operator= ( FDN && )
noexcept

Move assignment operator for the FDN.

Returns
A reference to the assigned FDN.

◆ OutputChannelCount()

uint32_t sfFDN::FDN::OutputChannelCount ( ) const
inlineoverridevirtual

Returns the number of output channels this processor produces.

Returns
1

Implements sfFDN::AudioProcessor.

◆ Process()

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

Process audio buffers.

Parameters
inputThe input audio buffer. Must be mono (1 channel).
outputThe output audio buffer. Must be mono (1 channel).

The input and output buffers must have the same sample count. input.SampleCount() does not have to be equal to block_size but it is recommended for optimal performance.

Implements sfFDN::AudioProcessor.

◆ SetDelayBank()

bool sfFDN::FDN::SetDelayBank ( const DelayBankOptions & config)

Set the delay bank.

Parameters
configThe configuration for the delay bank.
Returns
true if the delay bank was set successfully
false if the delay bank could not be set.

◆ SetDelays()

bool sfFDN::FDN::SetDelays ( const std::span< const float > delays,
DelayInterpolationType interpolation_type = DelayInterpolationType::None )

Set the delays.

Parameters
delaysA span of delay lengths in samples. The size of the span must be equal to GetOrder().
interpolation_typeThe type of interpolation to use for the delays.
Returns
true if the delays were set successfully
false if the delays could not be set. Happens if the size of the span does not match GetOrder() or if any of the delay lengths are smaller than the block_size set in the constructor.

◆ SetFeedbackMatrix()

bool sfFDN::FDN::SetFeedbackMatrix ( std::unique_ptr< AudioProcessor > mixing_matrix)

Set the Feedback Matrix AudioProcessor.

Parameters
mixing_matrixThe AudioProcessor to use as the feedback matrix. The FDN takes ownership of the pointer. Can be nullptr to disable mixing.
Returns
true if the mixing matrix was set successfully
false if the mixing matrix could not be set. Only happens if mixing_matrix->InputChannelCount() or mixing_matrix->OutputChannelCount() do not match GetOrder().

◆ SetInputGains() [1/2]

bool sfFDN::FDN::SetInputGains ( std::span< const float > gains)

Set the Input Gains from a span of floats.

Parameters
gainsA span of floats representing the gains for each channel. The size of the span must be equal to GetOrder().
Returns
true if the gains were set successfully
false if the gains could not be set

Returns false if the size of the span does not match GetOrder(). This is a convenience method that creates a ParallelGains processor in Split mode with the specified gains.

◆ SetInputGains() [2/2]

bool sfFDN::FDN::SetInputGains ( std::unique_ptr< AudioProcessor > gains)

Set the Input Gains AudioProcessor.

Parameters
gainsThe AudioProcessor to use for input gains. Must have 1 input channel and number of output channels equal to GetOrder(). The FDN takes ownership of the pointer.
Returns
true if the gains were set successfully
false if the gains could not be set

False is returned if the input and output channel counts do not match the requirements.

◆ SetLoopFilter()

bool sfFDN::FDN::SetLoopFilter ( std::unique_ptr< AudioProcessor > filter_bank)

Set the Filter Bank AudioProcessor.

The filter bank is applied inside the feedback loop, after the delay lines. Also known as attenuation or absorption filters.

Parameters
filter_bankThe AudioProcessor to use as the filter bank. The FDN takes ownership of the pointer. Can be nullptr to disable filtering.
Returns
true if the filter bank was set successfully
false if the filter bank could not be set. Only happens if filter_bank->InputChannelCount() or filter_bank->OutputChannelCount() do not match GetOrder().

◆ SetOrder()

void sfFDN::FDN::SetOrder ( uint32_t order)

Set the number of channels of the FDN.

Parameters
orderThe number of channels. Must be at least 4. Calling this method will reset the internal components of the FDN to the default state.

◆ SetOutputGains() [1/2]

bool sfFDN::FDN::SetOutputGains ( std::span< const float > gains)

Set the Output Gains from a span of floats.

Parameters
gainsA span of floats representing the gains for each channel. The size of the span must be equal to GetOrder().
Returns
true if the gains were set successfully
false if the gains could not be set

Returns false if the size of the span does not match GetOrder().

This is a convenience method that creates a ParallelGains processor in Merge mode with the specified gains.

◆ SetOutputGains() [2/2]

bool sfFDN::FDN::SetOutputGains ( std::unique_ptr< AudioProcessor > gains)

Set the Output Gains AudioProcessor.

Parameters
gainsThe AudioProcessor to use for output gains. Must have number of input channels equal to GetOrder() and 1 output channel. The FDN takes ownership of the pointer.
Returns
true if the gains were set successfully
false if the gains could not be set

False is returned if the input and output channel counts do not match the requirements.

◆ SetTCFilter()

bool sfFDN::FDN::SetTCFilter ( std::unique_ptr< AudioProcessor > filter)

Set the Tone Correction Filter AudioProcessor.

The Tone correction filter is applied to the output of the FDN, after the output gains.

Parameters
filterThe AudioProcessor to use as the tone correction filter. The FDN takes ownership of the pointer. Can be nullptr to disable filtering.
Returns
true if the filter was set successfully
false if the filter could not be set. Only happens if filter->InputChannelCount() or filter->OutputChannelCount() do not equal 1.

◆ SetTranspose()

void sfFDN::FDN::SetTranspose ( bool transpose)

Set whether to use transposed configuration.

Parameters
transposetrue to use transposed configuration, false otherwise.

In transposed configuration, the input signal is fed to the feedback matrix first and the output of the feedback matrix is fed to the output of the FDN.


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