bn::sound_item class

Contains the required information to play sound effects.

The assets conversion tools generate an object of this type in the build folder for each *.wav file.

Constructors, destructors, conversion operators

sound_item(int id) explicit constexpr
Constructor.

Public functions

auto id() const -> int constexpr
Returns the internal ID.
void play() const
Plays the sound effect specified by this item with default settings.
void play(fixed volume) const
Plays the sound effect specified by this item.
void play(fixed volume, fixed speed, fixed panning) const
Plays the sound effect specified by this item.
void play_with_priority(int priority) const
Plays the sound effect specified by this item with default settings and the given priority.
void play_with_priority(int priority, fixed volume) const
Plays the sound effect specified by this item with the given priority.
void play_with_priority(int priority, fixed volume, fixed speed, fixed panning) const
Plays the sound effect specified by this item with the given priority.

Friends

auto operator==(sound_item a, sound_item b) -> friend bool defaulted constexpr
Default equal operator.

Function documentation

bn::sound_item::sound_item(int id) explicit constexpr

Constructor.

Parameters
id Internal ID.

void bn::sound_item::play() const

Plays the sound effect specified by this item with default settings.

Default settings are volume = 1, speed = 1 and panning = 0.

void bn::sound_item::play(fixed volume) const

Plays the sound effect specified by this item.

Parameters
volume Volume level, in the range [0..1].

void bn::sound_item::play(fixed volume, fixed speed, fixed panning) const

Plays the sound effect specified by this item.

Parameters
volume Volume level, in the range [0..1].
speed Playback rate, in the range [0..64].
panning Panning level, in the range [-1..1].

void bn::sound_item::play_with_priority(int priority) const

Plays the sound effect specified by this item with default settings and the given priority.

Parameters
priority Priority relative to backgrounds in the range [-32767..32767].

If there's playing too much sound effects at the same time, sound effects with higher priorities are discarded later.

Default settings are volume = 1, speed = 1 and panning = 0.

void bn::sound_item::play_with_priority(int priority, fixed volume) const

Plays the sound effect specified by this item with the given priority.

Parameters
priority Priority relative to backgrounds in the range [-32767..32767].
volume Volume level, in the range [0..1].

If there's playing too much sound effects at the same time, sound effects with higher priorities are discarded later.

void bn::sound_item::play_with_priority(int priority, fixed volume, fixed speed, fixed panning) const

Plays the sound effect specified by this item with the given priority.

Parameters
priority Priority relative to backgrounds in the range [-32767..32767].
volume Volume level, in the range [0..1].
speed Playback rate, in the range [0..64].
panning Panning level, in the range [-1..1].

If there's playing too much sound effects at the same time, sound effects with higher priorities are discarded later.