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++.
Loading...
Searching...
No Matches
sound.h
Go to the documentation of this file.
1
8
9#ifndef ASW_SOUND_H
10#define ASW_SOUND_H
11
12#include "./types.h"
13
14namespace asw::sound {
15
20bool _init();
21
24void _shutdown();
25
30MIX_Mixer* get_mixer();
31
41void play(const asw::Sample& sample, float volume = 1.0F, float pan = 0.5F, bool loop = false);
42
49void play_music(const asw::Music& sample, float volume = 1.0F, float fade_in_s = 0.0F);
50
53void stop_music(float fade_out_s = 0.0F);
54
57void pause_music();
58
61void resume_music();
62
67bool is_music_playing();
68
73bool is_music_paused();
74
79void set_master_volume(float volume);
80
85void set_sfx_volume(float volume);
86
91void set_music_volume(float volume);
92
97float get_master_volume();
98
103float get_sfx_volume();
104
109float get_music_volume();
110
111} // namespace asw::sound
112
113#endif // ASW_SOUND_H
bool is_music_paused()
Check if music is paused.
Definition sound.cpp:159
void pause_music()
Pause the currently playing music.
Definition sound.cpp:144
float get_master_volume()
Get the current master volume multiplier.
Definition sound.cpp:180
void play_music(const asw::Music &sample, float volume=1.0F, float fade_in_s=0.0F)
Play a music sample.
Definition sound.cpp:124
bool is_music_playing()
Check if music is currently playing.
Definition sound.cpp:154
void set_sfx_volume(float volume)
Set the SFX volume multiplier.
Definition sound.cpp:170
float get_music_volume()
Get the current music volume multiplier.
Definition sound.cpp:190
void resume_music()
Resume paused music.
Definition sound.cpp:149
void _shutdown()
Shut down the sound module. Called automatically by asw::core::shutdown().
Definition sound.cpp:48
MIX_Mixer * get_mixer()
Get the SDL mixer device.
Definition sound.cpp:43
float get_sfx_volume()
Get the current SFX volume multiplier.
Definition sound.cpp:185
void set_music_volume(float volume)
Set the music volume multiplier.
Definition sound.cpp:175
void set_master_volume(float volume)
Set the master volume multiplier (affects all audio).
Definition sound.cpp:164
void play(const asw::Sample &sample, float volume=1.0F, float pan=0.5F, bool loop=false)
Play a sample.
Definition sound.cpp:99
void stop_music(float fade_out_s=0.0F)
Stop the currently playing music.
Definition sound.cpp:136
bool _init()
Initialize the sound module. Called automatically by asw::core::init().
Definition sound.cpp:58
std::shared_ptr< MIX_Audio > Sample
Alias for a shared pointer to an MIX_Audio.
Definition types.h:44
std::shared_ptr< MIX_Audio > Music
Alias for a shared pointer to an MIX_Audio.
Definition types.h:47
Types used throughout the ASW library.