Skip to content

Fader

class Fader

Helper class to process faders.

A fader is used to move a value to a specific target value during an amount of time and according to a fading algorithm.

Variables

Name Description
m_name The name of this Fader.

Functions

Name Description
Fader Create a new Fader instance.
Fader Default Fader constructor.
~Fader Default destructor.
CreateInstance Creates a new instance of the Fader.
DestroyInstance Destroys an instance of the Fader.
GetName Gets the name of this Fader.
GetControlPoints Gets the control points of the transition curve used by this Fader.
Register Registers a new fader.
Unregister Unregister a fader.
Construct Creates a new instance of the the fader with the given name and returns its pointer.
Destruct Destroys the given fader instance.
LockRegistry Locks the faders registry.
UnlockRegistry Unlocks the faders registry.
GetRegistry Gets the list of registered Faders.

Variable Details

m_name

AmString m_name

The name of this Fader.

Function Details

Construct

static FaderInstance* Construct(const AmString& name)

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

Note

The returned pointer should be deleted using Destruct().

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

CreateInstance

* CreateInstance()

Creates a new instance of the Fader.

Return
A new instance of the Fader.

DestroyInstance

virtual void DestroyInstance(FaderInstance* instance) = 0

Destroys an instance of the Fader.

Note

The instance should have been created with CreateInstance().

Parameter instance
The Fader instance to be destroyed.

Destruct

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

Destroys the given fader instance.

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

Fader

explicit Fader(AmString name)

Create a new Fader instance.

Parameter name
The Fader name. eg. "MiniAudioLinear".

Fader()

Default Fader constructor.

This will not automatically register the Fader. It's meant for internal Faders only.

GetControlPoints

[[nodiscard]] virtual BeizerCurveControlPoints GetControlPoints() const = 0

Gets the control points of the transition curve used by this Fader.

Return
The control points of the transition curve used by this Fader.

GetName

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

Gets the name of this Fader.

Return
The name of this Fader.

GetRegistry

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

Gets the list of registered Faders.

Return
The registry of Faders.

LockRegistry

static void LockRegistry()

Locks the faders registry.

Warning

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

Register

static void Register(Fader* fader)

Registers a new fader.

Parameter fader
The Fader to add in the registry.

UnlockRegistry

static void UnlockRegistry()

Unlocks the faders registry.

Warning

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

Unregister

static void Unregister(const Fader* fader)

Unregister a fader.

Parameter fader
The Fader to remove from the registry.

~Fader

virtual ~Fader()

Default destructor.