|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
Manages audio playback via SDL3_mixer. More...
#include <flint/audio/audio.h>
Collaboration diagram for Flint::Audio:Public Member Functions | |
| bool | init () |
| Initialize the audio subsystem and open the default playback device. | |
| void | cleanup () |
| Release all audio resources and shut down SDL_mixer. | |
| int | loadSound (const void *data, const size_t size) |
| Load a sound from an in-memory audio file. | |
| bool | playSound (int id, bool loop=false, float volume=1.0f, float pitch=1.0f) |
| Begin playback of a previously loaded sound. | |
| void | pauseSound (int id) |
| Pause playback of the given sound. | |
| void | resumeSound (int id) |
| Resume a paused sound. | |
| bool | isPaused (const int id) const |
| Query whether a sound is currently paused. | |
| void | stopSound (int id) |
| Stop playback of a sound immediately. | |
| void | stopAllSounds () |
| Stop all currently playing sounds immediately. | |
| void | setVolume (int id, float volume) |
| Set the playback volume for a specific sound. | |
| void | setPitch (int id, float pitch) |
| Set the playback pitch (frequency ratio) for a specific sound. | |
| void | setLooping (int id, bool loop) |
| Change the looping state of a currently playing sound. | |
| bool | isPlaying (int id) const |
| Query whether a sound is currently playing (not stopped or finished). | |
| void | pauseAll () const |
| Pause all tracks on the mixer device. | |
| void | resumeAll () const |
| Resume all tracks on the mixer device. | |
| void | setMasterVolume (float volume) const |
| Set the master output volume for the entire mixer. | |
Manages audio playback via SDL3_mixer.
Wraps an SDL_mixer device along with per-sound track and audio-data lifetime management. Sounds are identified by integer IDs returned from loadSound(). The subsystem must be initialized with init() before any other method is called.