namespace
#include <bn_sound.h>
sound 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_
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_
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_
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_
Parameters | |
---|---|
priority | Priority relative to backgrounds in the range [-32767..32767]. |
item | Specifies the sound effect to play. |
Returns | Sound effect handle. |
If there's playing too many sound effects 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_
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 there's playing too many sound effects 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_
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 there's playing too many sound effects 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]. |