Skip to content

Filter

class Filter

Base class to manage filters.

A filter applies transformations to an audio buffer. The Filter class implements factory methods to create instances of FilterInstance objects, which are where the the filtering is done.

The Filter class follows the plugins architecture, and thus, you are able to create your own filters by inheriting from this class, and by implementing the necessary dependencies.

Types

Name Description
ParameterType The type of a filter parameter.

Variables

Name Description
m_name The name of this filter.

Functions

Name Description
Filter Create a new Filter instance.
~Filter Default destructor.
GetParamCount Gets the maximum number of parameters available for this filter.
GetParamName Gets the name of the parameter at the given index.
GetParamType Gets the type of the parameter at the given index.
GetParamMax Gets the maximum allowed value of the parameter at the given index.
GetParamMin Gets the minimum allowed value of the parameter at the given index.
CreateInstance Creates a new instance of the filter.
DestroyInstance Destroys an instance of the filter.
GetName Gets the name of this filter.
Register Registers a new filter.
Unregister Unregisters a filter.
Find Look up a filter by name.
Construct Creates a new instance of the the filter with the given name and returns its pointer.
Destruct Destroys the given filter instance.
LockRegistry Locks the filters registry.
UnlockRegistry Unlocks the filters registry.
GetRegistry Gets the list of registered filters.

Variable Details

m_name

AmString m_name

The name of this filter.

Function Details

Construct

static FilterInstance* Construct(const AmString& name)

Creates a new instance of the the filter with the given name and returns its pointer.

Note

The returned pointer should be deleted using Destruct().

Parameter name
The name of the filter.
Return
The filter with the given name, or nullptr if none.

CreateInstance

* CreateInstance()

Creates a new instance of the filter.

Return
A new instance of the filter.

DestroyInstance

virtual void DestroyInstance(FilterInstance* instance) = 0

Destroys an instance of the filter.

Warning

The instance should have been created with CreateInstance() before being destroyed with this method.

Parameter instance
The filter instance to be destroyed.

Destruct

static void Destruct(const AmString& name, FilterInstance* instance)

Destroys the given filter instance.

Parameter name
The name of the filter.
Parameter instance
The filter instance to destroy.

Filter

explicit Filter(AmString name)

Create a new Filter instance.

Parameter name
The filter name. eg. "Echo".

Find

static Filter* Find(const AmString& name)

Look up a filter by name.

Return
The filter with the given name, or nullptr if none.

GetName

[[nodiscard]] const AmString& GetName() const

Gets the name of this filter.

Return
The name of this filter.

GetParamCount

[[nodiscard]] virtual AmUInt32 GetParamCount() const

Gets the maximum number of parameters available for this filter.

Return
The maximum number of filter parameters.

GetParamMax

[[nodiscard]] virtual AmReal32 GetParamMax(AmUInt32 index) const

Gets the maximum allowed value of the parameter at the given index.

Parameter index
The parameter index.
Return
The maximum allowed value of the parameter at the given index.

GetParamMin

[[nodiscard]] virtual AmReal32 GetParamMin(AmUInt32 index) const

Gets the minimum allowed value of the parameter at the given index.

Parameter index
The parameter index.
Return
The minimum allowed value of the parameter at the given index.

GetParamName

[[nodiscard]] virtual AmString GetParamName(AmUInt32 index) const

Gets the name of the parameter at the given index.

Parameter index
The parameter index.
Return
The name of the parameter at the given index.

GetParamType

[[nodiscard]] virtual AmUInt32 GetParamType(AmUInt32 index) const

Gets the type of the parameter at the given index.

Parameter index
The parameter index.
Return
The type of the parameter at the given index.

GetRegistry

static const std::map<AmString, Filter*>& GetRegistry()

Gets the list of registered filters.

Return
The registry of filters.

LockRegistry

static void LockRegistry()

Locks the filters registry.

Warning

This function is mainly used for internal purposes. It's called before the Engine initialization, to discard the registration of new filters after the engine is fully loaded.

Register

static void Register(Filter* filter)

Registers a new filter.

Parameter filter
The filter to add in the registry.

UnlockRegistry

static void UnlockRegistry()

Unlocks the filters registry.

Warning

This function is mainly used for internal purposes. It's called after the Engine deinitialization, to allow the registration of new filters after the engine is fully unloaded.

Unregister

static void Unregister(const Filter* filter)

Unregisters a filter.

Parameter filter
The filter to remove from the registry.

~Filter

virtual ~Filter()

Default destructor.