class
#include <bn_sound_item.h>
sound_item 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.
-
auto play() const -> sound_
handle - Plays the sound effect specified by this item with default settings.
-
auto play(fixed volume) const -> sound_
handle - Plays the sound effect specified by this item.
-
auto play(fixed volume,
fixed speed,
fixed panning) const -> sound_
handle - Plays the sound effect specified by this item.
-
auto play_with_priority(int priority) const -> sound_
handle - Plays the sound effect specified by this item with default settings and the given priority.
-
auto play_with_priority(int priority,
fixed volume) const -> sound_
handle - Plays the sound effect specified by this item with the given priority.
-
auto play_with_priority(int priority,
fixed volume,
fixed speed,
fixed panning) const -> sound_
handle - Plays the sound effect specified by this item with the given priority.
Friends
-
auto operator==(sound_
item a, sound_ item b) -> bool defaulted constexpr - Default equal operator.
Function documentation
sound_ handle bn:: sound_item:: play() const
Plays the sound effect specified by this item with default settings.
Returns | Sound effect handle. |
---|
Default settings are volume = 1, speed = 1 and panning = 0.
sound_ handle bn:: sound_item:: play(fixed volume) const
Plays the sound effect specified by this item.
Parameters | |
---|---|
volume | Volume level, in the range [0..1]. |
Returns | Sound effect handle. |
sound_ handle 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]. |
Returns | Sound effect handle. |
sound_ handle 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]. |
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_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]. |
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_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]. |
Returns | Sound effect handle. |
If there's playing too many sound effects at the same time, sound effects with higher priority are discarded later.