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

A chain of audio processors that processes audio sequentially. More...

#include <audio_processor.h>

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

Public Member Functions

 AudioProcessorChain (uint32_t block_size)
 Constructs an AudioProcessorChain with a specified block size.
 
bool AddProcessor (std::unique_ptr< AudioProcessor > &&processor)
 Adds an audio processor to the chain.
 
uint32_t GetProcessorCount () const
 Returns the number of processors in the chain.
 
AudioProcessorGetProcessor (uint32_t index) const
 Returns a pointer to the processor at the specified index.
 
void Process (const AudioBuffer &input, AudioBuffer &output) noexcept override
 Processes the audio buffers through the chain.
 
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 all processors in the chain.
 
std::unique_ptr< AudioProcessorClone () const override
 Creates a copy of the audio processor chain.
 
- Public Member Functions inherited from sfFDN::AudioProcessor

Detailed Description

A chain of audio processors that processes audio sequentially.

This class allows adding multiple audio processors and processes the audio through each processor in the chain.

Constructor & Destructor Documentation

◆ AudioProcessorChain()

sfFDN::AudioProcessorChain::AudioProcessorChain ( uint32_t block_size)

Constructs an AudioProcessorChain with a specified block size.

Parameters
block_sizeThe size of the audio blocks to process.
Note
The block size is used to allocate internal buffers for processing.

Member Function Documentation

◆ AddProcessor()

bool sfFDN::AudioProcessorChain::AddProcessor ( std::unique_ptr< AudioProcessor > && processor)

Adds an audio processor to the chain.

Parameters
processorA unique pointer to the audio processor to add.
Returns
True if the processor was added successfully, false if the output channel count of the last processor does not match the input channel count of the new processor.

◆ Clear()

void sfFDN::AudioProcessorChain::Clear ( )
overridevirtual

Clears the internal state of all processors in the chain.

Implements sfFDN::AudioProcessor.

◆ Clone()

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

Creates a copy of the audio processor chain.

Returns
A unique pointer to the cloned audio processor chain.

Implements sfFDN::AudioProcessor.

◆ GetProcessor()

AudioProcessor * sfFDN::AudioProcessorChain::GetProcessor ( uint32_t index) const

Returns a pointer to the processor at the specified index.

Parameters
indexThe index of the processor to retrieve.
Returns
A pointer to the processor at the specified index, or nullptr if the index is out of range.

◆ GetProcessorCount()

uint32_t sfFDN::AudioProcessorChain::GetProcessorCount ( ) const

Returns the number of processors in the chain.

Returns
The number of processors in the chain.

◆ InputChannelCount()

uint32_t sfFDN::AudioProcessorChain::InputChannelCount ( ) const
overridevirtual

Returns the number of input channels this processor expects.

Implements sfFDN::AudioProcessor.

◆ OutputChannelCount()

uint32_t sfFDN::AudioProcessorChain::OutputChannelCount ( ) const
overridevirtual

Returns the number of output channels this processor produces.

Implements sfFDN::AudioProcessor.

◆ Process()

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

Processes the audio buffers through the chain.

Parameters
inputThe input audio buffer.
outputThe output audio buffer.
Note
The input and output buffers must have the same sample count.
The input buffer's channel count must match the first processor's input channel count, and the output buffer's channel count must match the last processor's output channel count.
The sample count of the input and output buffers must match the block size specified during construction.

Implements sfFDN::AudioProcessor.


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