Skip to content

Bus

class Bus

An object representing one node in the tree of buses. Buses are used to adjust a set of channel gains in tandem.

The Bus class is a lightweight reference to a BusInternalState object which is managed by the Engine. There is always at least one bus, the master bus, and any number of additional buses may be defined as well. Each bus can be thought as a node in the tree. The gain on a Bus is applied to all child buses as well.

Functions

Name Description
Bus Creates an uninitialized Bus.
Bus Creates a wrapper instance over the provided state.
Clear Uninitializes this Bus.
Valid Checks whether this Bus has been initialized.
GetId Gets the unique ID of this Bus.
GetName Gets the name of this Bus.
SetGain Sets the gain of this Bus.
GetGain Returns the user specified gain on this Bus.
FadeTo Fades to gain over duration milliseconds.
GetFinalGain Returns the final calculated gain on this Bus.
SetMute Sets the muted state of this Bus.
IsMuted Returns whether this Bus is muted.
GetState Returns the internal state of this Bus.

Function Details

Bus

Bus()

Creates an uninitialized Bus.

An uninitialized Bus cannot set or get any of it's fields.

explicit Bus(BusInternalState* state)

Creates a wrapper instance over the provided state.

Parameter state
The internal state to wrap.

Warning

This constructor is for internal usage only.

Clear

void Clear()

Uninitializes this Bus.

Note that this does not destroy the internal state it references, it just removes this reference to it.

FadeTo

void FadeTo(AmReal32 gain, AmTime duration) const

Fades to gain over duration milliseconds.

Parameter gain
The gain value to fade to.
Parameter duration
The amount of time in milliseconds to take to reach the desired gain.

GetFinalGain

[[nodiscard]] AmReal32 GetFinalGain() const

Returns the final calculated gain on this Bus.

Note

The final gain of a bus is the product of the gain specified in the bus definition file, with the gain specified by the user, and with the final gain of the parent bus.

Return
The final calculated gain.

GetGain

[[nodiscard]] AmReal32 GetGain() const

Returns the user specified gain on this Bus.

Return
The user specified gain.

GetId

[[nodiscard]] AmBusID GetId() const

Gets the unique ID of this Bus.

Return
The bus unique ID.

GetName

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

Gets the name of this Bus.

Return
The bus name.

GetState

[[nodiscard]] BusInternalState* GetState() const

Returns the internal state of this Bus.

Warning

This method is only for internal usage.

Return
The bus internal state.

IsMuted

[[nodiscard]] bool IsMuted() const

Returns whether this Bus is muted.

Return
true if this Bus is muted, false otherwise.

SetGain

void SetGain(AmReal32 gain) const

Sets the gain of this Bus.

Parameter gain
The new gain value.

SetMute

void SetMute(bool mute) const

Sets the muted state of this Bus.

Parameter mute
The muted state.

Valid

[[nodiscard]] bool Valid() const

Checks whether this Bus has been initialized.

Return
true if this Bus has been initialized.