bn::sound namespace
#include <bn_sound.h>

Sound effects related functions.

Functions

auto play(sound_item item) -> sound_handle
Plays the sound effect specified by the given sound_item with default settings.
auto play(sound_item item, fixed volume) -> sound_handle
Plays the sound effect specified by the given sound_item.
auto play(sound_item item, fixed volume, fixed speed, fixed panning) -> sound_handle
Plays the sound effect specified by the given sound_item.
auto play_with_priority(int priority, sound_item item) -> sound_handle
Plays the sound effect specified by the given sound_item with default settings and the given priority.
auto play_with_priority(int priority, sound_item item, fixed volume) -> sound_handle
Plays the sound effect specified by the given sound_item with the given priority.
auto play_with_priority(int priority, sound_item item, fixed volume, fixed speed, fixed panning) -> sound_handle
Plays the sound effect specified by the given sound_item with the given priority.
void stop_all()
Stops all sound effects that are being played currently.
auto master_volume() -> fixed
Returns the master volume of all sound effects.
void set_master_volume(fixed volume)
Sets the master volume of all sound effects.

Function documentation

sound_handle bn::sound::play(sound_item item)

Plays the sound effect specified by the given sound_item with default settings.

Parameters
item Specifies the sound effect to play.
Returns Sound effect handle.

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

sound_handle bn::sound::play(sound_item item, fixed volume)

Plays the sound effect specified by the given sound_item.

Parameters
item Specifies the sound effect to play.
volume Volume level, in the range [0..1].
Returns Sound effect handle.

sound_handle bn::sound::play(sound_item item, fixed volume, fixed speed, fixed panning)

Plays the sound effect specified by the given sound_item.

Parameters
item Specifies the sound effect to play.
volume Volume level, in the range [0..1].
speed Playback rate, in the range [0..64].
panning Panning level, in the range [-1..1].
Returns Sound effect handle.

sound_handle bn::sound::play_with_priority(int priority, sound_item item)

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

Parameters
priority Priority relative to backgrounds in the range [-32767..32767].
item Specifies the sound effect to play.
Returns Sound effect handle.

If too many sound effects are being played at the same time, sound effects with higher priority are discarded later.

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

sound_handle bn::sound::play_with_priority(int priority, sound_item item, fixed volume)

Plays the sound effect specified by the given sound_item with the given priority.

Parameters
priority Priority relative to backgrounds in the range [-32767..32767].
item Specifies the sound effect to play.
volume Volume level, in the range [0..1].
Returns Sound effect handle.

If too many sound effects are being played at the same time, sound effects with higher priority are discarded later.

sound_handle bn::sound::play_with_priority(int priority, sound_item item, fixed volume, fixed speed, fixed panning)

Plays the sound effect specified by the given sound_item with the given priority.

Parameters
priority Priority relative to backgrounds in the range [-32767..32767].
item Specifies the sound effect to play.
volume Volume level, in the range [0..1].
speed Playback rate, in the range [0..64].
panning Panning level, in the range [-1..1].
Returns Sound effect handle.

If too many sound effects are being played at the same time, sound effects with higher priority are discarded later.

void bn::sound::set_master_volume(fixed volume)

Sets the master volume of all sound effects.

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