Skip to content

Fader

Base class used to create faders.

Detailed Description

A fader is used to move a value to a target value during a specific amount of time and according to a fading algorithm. The Fader class implements factory methods to create instances of FaderInstance objects, which are where the value is being transitioned to its target.

The Fader class follows the plugin architecture, and thus, you are able to create your own faders and register them to the Engine by inheriting from this class and by implementing the necessary dependencies.

Public Functions

Type Name
virtual std::shared_ptr< FaderInstance > CreateInstance () = 0
Creates a new instance of the fader.
Fader (AmString name)
a new fader instance.
Fader ()
Default fader constructor.
virtual BezierCurveControlPoints GetControlPoints () const = 0
Gets the control points of the transition curve used by this fader.
const AmString & GetName () const
Gets the name of this fader.
virtual ~Fader ()
Default destructor.

Public Static Functions

Type Name
std::shared_ptr< FaderInstance > Construct (const AmString & name)
Creates a new instance of the fader with the given name and returns its pointer.
std::shared_ptr< Fader > Find (const AmString & name)
Look up a fader by name.
const std::map< AmString, std::shared_ptr< Fader > > & GetRegistry ()
Gets the list of registered faders.
void LockRegistry ()
Locks the faders' registry.
void Register (std::shared_ptr< Fader > fader)
Registers a new fader.
void UnlockRegistry ()
Unlocks the faders' registry.
void Unregister (std::shared_ptr< const Fader > fader)
Unregisters a fader.

Protected Attributes

Type Name
AmString m_name
The name of this fader.

Public Functions Documentation

CreateInstance

Creates a new instance of the fader.

virtual std::shared_ptr< FaderInstance > Amplitude::Fader::CreateInstance () = 0

Returns:

A new instance of the fader.

Fader[1/2]

a new fader instance.

explicit Amplitude::Fader::Fader (
    AmString name
) 

Parameters:

  • name The fader name, e.g., "MiniAudioLinear".
Fader[2/2]

Default fader constructor.

Amplitude::Fader::Fader () 

Warning:

This constructor is meant for internal faders only.

GetControlPoints

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

virtual BezierCurveControlPoints Amplitude::Fader::GetControlPoints () const = 0

Returns:

The control points of the transition curve used by this fader.

GetName

Gets the name of this fader.

const AmString & Amplitude::Fader::GetName () const

Returns:

The name of this fader.

~Fader

Default destructor.

virtual Amplitude::Fader::~Fader () 

Public Static Functions Documentation

Construct

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

static std::shared_ptr< FaderInstance > Amplitude::Fader::Construct (
    const AmString & name
) 

Parameters:

  • name The name of the fader.

Returns:

The fader with the given name, or nullptr if not found.

Find

Look up a fader by name.

static std::shared_ptr< Fader > Amplitude::Fader::Find (
    const AmString & name
) 

Parameters:

  • name The name of the fader to find.

Returns:

The fader with the given name, or nullptr if not found.

GetRegistry

Gets the list of registered faders.

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

Returns:

The registry of faders.

LockRegistry

Locks the faders' registry.

static void Amplitude::Fader::LockRegistry () 

Warning:

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

Register

Registers a new fader.

static void Amplitude::Fader::Register (
    std::shared_ptr< Fader > fader
) 

Note:

This method does nothing if the registry is locked.

Parameters:

  • fader The fader to add in the registry.

See also: LockRegistry, UnlockRegistry

UnlockRegistry

Unlocks the faders' registry.

static void Amplitude::Fader::UnlockRegistry () 

Warning:

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

Unregister

Unregisters a fader.

static void Amplitude::Fader::Unregister (
    std::shared_ptr< const Fader > fader
) 

Note:

This method does nothing if the registry is locked.

Parameters:

  • fader The Fader to remove from the registry.

See also: LockRegistry, UnlockRegistry

Protected Attributes Documentation

m_name

The name of this fader.

AmString SparkyStudios::Audio::Amplitude::Fader::m_name;

The documentation for this class was generated from the following file: include/SparkyStudios/Audio/Amplitude/Sound/Fader.h