4#include <SDL3_mixer/SDL_mixer.h>
7#include <unordered_map>
61 bool playSound(
int id,
bool loop =
false,
float volume = 1.0f,
float pitch = 1.0f);
158 MIX_Track *getOrCreateTrack(
int soundId);
160 bool m_initialized =
false;
161 MIX_Mixer *m_mixer =
nullptr;
162 int m_nextSoundId = 1;
164 std::unordered_map<int, MIX_Audio *> m_audioData;
165 std::unordered_map<int, MIX_Track *> m_tracks;
void stopSound(int id)
Stop playback of a sound immediately.
void cleanup()
Release all audio resources and shut down SDL_mixer.
bool init()
Initialize the audio subsystem and open the default playback device.
void setVolume(int id, float volume)
Set the playback volume for a specific sound.
bool playSound(int id, bool loop=false, float volume=1.0f, float pitch=1.0f)
Begin playback of a previously loaded sound.
void resumeSound(int id)
Resume a paused sound.
void setLooping(int id, bool loop)
Change the looping state of a currently playing sound.
bool isPaused(const int id) const
Query whether a sound is currently paused.
bool isPlaying(int id) const
Query whether a sound is currently playing (not stopped or finished).
void setPitch(int id, float pitch)
Set the playback pitch (frequency ratio) for a specific sound.
void pauseSound(int id)
Pause playback of the given sound.
int loadSound(const void *data, const size_t size)
Load a sound from an in-memory audio file.
void setMasterVolume(float volume) const
Set the master output volume for the entire mixer.
Manages audio playback via SDL3_mixer.
void resumeAll() const
Resume all tracks on the mixer device.
void pauseAll() const
Pause all tracks on the mixer device.
void stopAllSounds()
Stop all currently playing sounds immediately.