Skip to content

Switch

Amplitude switch asset.

Inherits the following classes: SparkyStudios::Audio::Amplitude::Asset

Detailed Description

A switch is a collection of states that can change the sounds played from a SwitchContainer.

For example, you can have a switch named SurfaceType which has wood, grass, metal and water as states. A SwitchContainer using this switch can group sounds per switch state, so when a state is active, all the sounds of that state are played. Changing the state of a switch will update ALL the SwitchContainer objects that use this switch.

The Switch is a shared object between sound sources. They are used only by SwitchContainer objects.

See also: SwitchState, SwitchContainer

Public Functions

Type Name
virtual const SwitchState & GetState () const = 0
Gets the current state of the switch.
virtual const std::vector< SwitchState > & GetSwitchStates () const = 0
Gets the list of available states in this switch.
virtual void SetState (const SwitchState & state) = 0
Sets the current state of the switch.
virtual void SetState (AmObjectID id) = 0
Sets the current state of the switch using the state ID.
virtual void SetState (const AmString & name) = 0
Sets the current state of the switch using the state name.

Public Functions inherited from SparkyStudios::Audio::Amplitude::Asset

See SparkyStudios::Audio::Amplitude::Asset

Type Name
virtual Id GetId () const = 0
Returns the unique ID of this asset.
virtual const AmString & GetName () const = 0
Gets the name of this asset.
virtual ~Asset () = default
Destroys the asset and all related resources.

Public Functions Documentation

GetState

Gets the current state of the switch.

virtual const SwitchState & Amplitude::Switch::GetState () const = 0

Returns:

The current state of the switch.

GetSwitchStates

Gets the list of available states in this switch.

virtual const std::vector< SwitchState > & Amplitude::Switch::GetSwitchStates () const = 0

Returns:

The list of available switch states.

SetState[1/3]

Sets the current state of the switch.

virtual void Amplitude::Switch::SetState (
    const SwitchState & state
) = 0

Note:

Changing the state of a switch will update ALL the SwitchContainer objects that use this switch.

Parameters:

  • state The state to apply to the switch.
SetState[2/3]

Sets the current state of the switch using the state ID.

virtual void Amplitude::Switch::SetState (
    AmObjectID id
) = 0

Note:

Changing the state of a switch will update ALL the SwitchContainer objects that use this switch.

Parameters:

  • id The ID of the state to apply. This ID should exist in the list of registered switch states.
SetState[3/3]

Sets the current state of the switch using the state name.

virtual void Amplitude::Switch::SetState (
    const AmString & name
) = 0

Note:

Changing the state of a switch will update ALL the SwitchContainer objects that use this switch.

Parameters:

  • name The name of the state to apply. This name should exist in the list of registered switch states.

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