Skip to content

FilterInstance

class FilterInstance

A Filter instance.

An object of this class will be created each time a Filter is requested.

Variables

Name Description
m_parent The parent filter object that created this instance.
m_numParams The number of parameters available for this filter.
m_numParamsChanged The number of parameters that have changed since the last frame.
m_parameters The parameters buffer.

Functions

Name Description
FilterInstance Constructs a new FilterInstance object.
~FilterInstance Destroys the FilterInstance object.
Initialize Initializes the filter instance with the provided number of parameters.
AdvanceFrame Updates the filter instance state for the provided delta time.
Process Executes the filter instance.
GetParameter Gets the current value of the parameter at the given index.
SetParameter Sets the value of the parameter at the given index.
ProcessChannel Executes the filter instance on a single channel of the given buffer.
ProcessSample Executes the filter instance on a single sample of the given buffer.

Variable Details

m_numParams

AmUInt32 m_numParams

The number of parameters available for this filter.

m_numParamsChanged

AmUInt32 m_numParamsChanged

The number of parameters that have changed since the last frame.

m_parameters

AmReal32* m_parameters

The parameters buffer.

m_parent

Filter* m_parent

The parent filter object that created this instance.

Function Details

AdvanceFrame

virtual void AdvanceFrame(AmTime deltaTime)

Updates the filter instance state for the provided delta time.

Parameter deltaTime
The time in milliseconds since the last frame.

FilterInstance

explicit FilterInstance(Filter* parent)

Constructs a new FilterInstance object.

Parameter parent
The parent Filter object that created this instance.

GetParameter

virtual AmReal32 GetParameter(AmUInt32 parameterIndex)

Gets the current value of the parameter at the given index.

Parameter parameterIndex
The index of the parameter to retrieve.
Return
The current value of the parameter.

Initialize

AmResult Initialize(AmUInt32 paramCount)

Initializes the filter instance with the provided number of parameters.

Parameter paramCount
The number of parameters the filter will need.

Process

virtual void Process(const AudioBuffer& in, AudioBuffer& out, AmUInt64 frames, AmUInt32 sampleRate)

Executes the filter instance.

Parameter in
The input buffer on which the filter should be applied.
Parameter out
The output buffer where the filtered output will be stored.
Parameter frames
The number of frames to process.
Parameter sampleRate
The current sample rate of the buffer.

ProcessChannel

virtual void ProcessChannel(const AudioBuffer& in, AudioBuffer& out, AmUInt16 channel, AmUInt64 frames, AmUInt32 sampleRate)

Executes the filter instance on a single channel of the given buffer.

Parameter in
The input buffer on which the filter should be applied.
Parameter out
The output buffer where the filtered output will be stored.
Parameter channel
The index of the channel to process.
Parameter frames
The number of frames to process.
Parameter sampleRate
The current sample rate of the buffer.

ProcessSample

virtual AmAudioSample ProcessSample(AmAudioSample sample, AmUInt16 channel, AmUInt32 sampleRate)

Executes the filter instance on a single sample of the given buffer.

Parameter sample
The audio sample to process.
Parameter channel
The index of the channel to process.
Parameter sampleRate
The current sample rate of the buffer.

SetParameter

virtual void SetParameter(AmUInt32 parameterIndex, AmReal32 value)

Sets the value of the parameter at the given index.

Parameter parameterIndex
The index of the parameter to retrieve.
Parameter value
The value to set to the parameter.

~FilterInstance

virtual ~FilterInstance()

Destroys the FilterInstance object.