SDL3_mixer-based audio manager. More...
#include <mxvk/include/mxvk/mxvk_sound.hpp>
Public Member Functions | |
| void | cleanup () |
| Free all loaded audio chunks and music tracks. | |
| void | init () |
| Open the audio device (called automatically by constructor). | |
| bool | isMusicPlaying (int id) const |
| Query whether a loaded music track is currently playing. | |
| bool | isPlaying (int channel) const |
| Query whether a sound track is currently playing. | |
| int | loadMusic (const std::string &filename) |
| Load an audio file as streaming background music. | |
| int | loadWav (const std::string &filename) |
| Load a WAV file as a sound effect chunk. | |
| VK_Mixer & | operator= (const VK_Mixer &)=delete |
| VK_Mixer & | operator= (VK_Mixer &&)=delete |
| int | playMusic (int id, int value=0) |
| Start playing a previously loaded music track. | |
| int | playWav (int id, int value=0, int channel=-1) |
| Play a previously loaded WAV chunk. | |
| void | stopMusic () |
| Stop background music playback immediately. | |
| VK_Mixer () | |
| Initialise SDL3_mixer and open the audio device. | |
| VK_Mixer (const VK_Mixer &)=delete | |
| VK_Mixer (VK_Mixer &&)=delete | |
| ~VK_Mixer () noexcept | |
| Halt all playback and free all loaded audio resources. | |
SDL3_mixer-based audio manager.
Provides facilities for loading WAV sound chunks and streamed music tracks, playing them, and querying playback state. Only available when the library is built with MIXER enabled.
Definition at line 27 of file mxvk_sound.hpp.
| mxvk::VK_Mixer::VK_Mixer | ( | ) |
Initialise SDL3_mixer and open the audio device.
Definition at line 21 of file mxvk_sound.cpp.
|
noexcept |
Halt all playback and free all loaded audio resources.
Definition at line 25 of file mxvk_sound.cpp.
|
delete |
|
delete |
| void mxvk::VK_Mixer::cleanup | ( | ) |
Free all loaded audio chunks and music tracks.
Definition at line 196 of file mxvk_sound.cpp.
| void mxvk::VK_Mixer::init | ( | ) |
Open the audio device (called automatically by constructor).
Definition at line 29 of file mxvk_sound.cpp.
|
nodiscard |
Query whether a loaded music track is currently playing.
| id | Music index returned by loadMusic(). |
true if the music track is active. Definition at line 171 of file mxvk_sound.cpp.
|
nodiscard |
Query whether a sound track is currently playing.
| channel | Track index. |
true if the channel is active. Definition at line 159 of file mxvk_sound.cpp.
| int mxvk::VK_Mixer::loadMusic | ( | const std::string & | filename | ) |
Load an audio file as streaming background music.
| filename | Path to the music file (OGG, MP3, WAV, etc.). |
Definition at line 53 of file mxvk_sound.cpp.
| int mxvk::VK_Mixer::loadWav | ( | const std::string & | filename | ) |
Load a WAV file as a sound effect chunk.
| filename | Path to the WAV file. |
Definition at line 82 of file mxvk_sound.cpp.
| int mxvk::VK_Mixer::playMusic | ( | int | id, |
| int | value = 0 ) |
Start playing a previously loaded music track.
| id | Music index returned by loadMusic(). |
| value | Number of additional loops (0 = play once, -1 = infinite). |
Definition at line 111 of file mxvk_sound.cpp.
| int mxvk::VK_Mixer::playWav | ( | int | id, |
| int | value = 0, | ||
| int | channel = -1 ) |
Play a previously loaded WAV chunk.
| id | Chunk index returned by loadWav(). |
| value | Number of additional loops (0 = play once). |
| channel | Track index to use (-1 = use track for id). |
Definition at line 129 of file mxvk_sound.cpp.
| void mxvk::VK_Mixer::stopMusic | ( | ) |
Stop background music playback immediately.
Definition at line 183 of file mxvk_sound.cpp.