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