|
ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
|
A handle to a playing sound, used to change it while it plays. More...
#include <sound.h>
Public Member Functions | |
| SoundHandle ()=default | |
| Create a handle that refers to nothing. | |
| bool | is_playing () const |
| Check if the sound is still playing or paused. | |
| void | stop (float fade_out_s=0.0F) const |
| Stop the sound. | |
| void | pause () const |
| Pause the sound. | |
| void | resume () const |
| Resume a paused sound. | |
| void | set_volume (float volume) const |
| Set the volume. | |
| void | set_pitch (float pitch) const |
| Set the playback speed and pitch. | |
| void | set_pan (float pan) const |
| Set the panning. Makes a positional sound non positional. | |
| void | set_position (const Vec2< float > &position) const |
| Set where the sound is in the world. Makes the sound positional. | |
| void | set_velocity (const Vec2< float > &velocity) const |
| Set how fast the sound is moving, for doppler pitch shift. | |
| void | set_occlusion (float amount) const |
| Muffle the sound, as if heard through a wall. | |
| void | set_attenuation (const Attenuation &attenuation) const |
| Change the distance fall off. | |
Private Member Functions | |
| SoundHandle (int voice, uint32_t generation) | |
Private Attributes | |
| int | voice { -1 } |
| uint32_t | generation { 0 } |
Friends | |
| struct | HandleAccess |
A handle to a playing sound, used to change it while it plays.
Handles are cheap to copy. Once the sound ends or its voice is given to another sound, the handle goes stale and every call on it does nothing.
|
default |
Create a handle that refers to nothing.
|
private |
| bool asw::sound::SoundHandle::is_playing | ( | ) | const |
| void asw::sound::SoundHandle::pause | ( | ) | const |
| void asw::sound::SoundHandle::resume | ( | ) | const |
| void asw::sound::SoundHandle::set_attenuation | ( | const Attenuation & | attenuation | ) | const |
| void asw::sound::SoundHandle::set_occlusion | ( | float | amount | ) | const |
| void asw::sound::SoundHandle::set_pan | ( | float | pan | ) | const |
| void asw::sound::SoundHandle::set_pitch | ( | float | pitch | ) | const |
| void asw::sound::SoundHandle::set_position | ( | const Vec2< float > & | position | ) | const |
| void asw::sound::SoundHandle::set_velocity | ( | const Vec2< float > & | velocity | ) | const |
| void asw::sound::SoundHandle::set_volume | ( | float | volume | ) | const |
| void asw::sound::SoundHandle::stop | ( | float | fade_out_s = 0.0F | ) | const |
|
friend |