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

A scalar feedback matrix processor. More...

#include <feedback_matrix.h>

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

Public Member Functions

 ScalarFeedbackMatrix (const ScalarFeedbackMatrixOptions &config)
 Constructs a scalar feedback matrix.
 
bool SetMatrix (std::span< const float > matrix)
 Sets the matrix coefficients.
 
bool GetMatrix (std::span< float > matrix) const
 Retrieves the matrix coefficients.
 
void Process (const AudioBuffer &input, AudioBuffer &output) noexcept SFFDN_NONBLOCKING override
 Processes the input audio buffer through the feedback matrix.
 
uint32_t GetSize () const
 Returns the size of the square matrix (number of rows/columns).
 
float GetCoefficient (uint32_t row, uint32_t col) const
 Get a specific coefficient from the matrix.
 
uint32_t InputChannelCount () const noexcept SFFDN_NONBLOCKING override
 Returns the number of input channels supported by the processor.
 
uint32_t OutputChannelCount () const noexcept SFFDN_NONBLOCKING override
 Returns the number of output channels produced by the processor.
 
void Clear () override
 Clears the internal state of the processor.
 
std::unique_ptr< AudioProcessorClone () const override
 Creates a copy of the scalar feedback matrix.
 
- 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

A scalar feedback matrix processor.

This processor applies a square feedback matrix to the input audio buffer. The public matrix convention is row-major: flat[row*N+col] = A[row,col], y = A*x.

Constructor & Destructor Documentation

◆ ScalarFeedbackMatrix()

sfFDN::ScalarFeedbackMatrix::ScalarFeedbackMatrix ( const ScalarFeedbackMatrixOptions & config)

Constructs a scalar feedback matrix.

Parameters
configThe configuration for the scalar feedback matrix.

Member Function Documentation

◆ Clear()

void sfFDN::ScalarFeedbackMatrix::Clear ( )
overridevirtual

Clears the internal state of the processor.

This is a no-op for ScalarFeedbackMatrix as it has no internal state.

Implements sfFDN::AudioProcessor.

◆ Clone()

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

Creates a copy of the scalar feedback matrix.

Returns
A unique pointer to the cloned scalar feedback matrix.

Implements sfFDN::AudioProcessor.

◆ GetCoefficient()

float sfFDN::ScalarFeedbackMatrix::GetCoefficient ( uint32_t row,
uint32_t col ) const

Get a specific coefficient from the matrix.

Uses the row-major convention: A[row,col] = flat[row*N+col].

Parameters
rowThe row index (destination)
colThe column index (source)
Returns
the coefficient at the specified row and column

◆ GetMatrix()

bool sfFDN::ScalarFeedbackMatrix::GetMatrix ( std::span< float > matrix) const

Retrieves the matrix coefficients.

Parameters
matrixA span of size order * order to fill with the matrix coefficients in row-major order: filled[row*N+col] = A[row,col].
Returns
false if the span is not exactly order * order in size.

◆ GetSize()

uint32_t sfFDN::ScalarFeedbackMatrix::GetSize ( ) const

Returns the size of the square matrix (number of rows/columns).

Returns
The size of the matrix.

◆ InputChannelCount()

uint32_t sfFDN::ScalarFeedbackMatrix::InputChannelCount ( ) const
overridevirtualnoexcept

Returns the number of input channels supported by the processor.

Implements sfFDN::AudioProcessor.

◆ OutputChannelCount()

uint32_t sfFDN::ScalarFeedbackMatrix::OutputChannelCount ( ) const
overridevirtualnoexcept

Returns the number of output channels produced by the processor.

Implements sfFDN::AudioProcessor.

◆ Process()

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

Processes the input audio buffer through the feedback matrix.

Parameters
inputAudioBuffer containing the input audio data. The number of channels must match the matrix order returned by GetSize().
outputAudioBuffer to fill with the processed audio data. The number of channels must match the matrix order.

Implements sfFDN::AudioProcessor.

◆ SetMatrix()

bool sfFDN::ScalarFeedbackMatrix::SetMatrix ( std::span< const float > matrix)

Sets the matrix coefficients.

Parameters
matrixA span of matrix coefficients in row-major order: flat[row*N+col] = A[row,col]. The span must contain exactly order * order elements (where order is the value returned by GetSize()). The size of the matrix cannot be changed by this method; passing the wrong number of elements is rejected and leaves the current state unchanged.
Returns
true if the matrix was set successfully, false otherwise (e.g. if the size is incorrect).

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