29#include <SDL3/SDL_audio.h>
31#include <unordered_map>
40typedef std::string stream_name_t;
42typedef std::string audio_name_t;
105 static std::unordered_map<types::audio_name_t, types::audio_file_t>
118 static std::unordered_map<types::stream_name_t, SDL_AudioStream *>
streams;
156 static SDL_AudioStream *
get_stream(types::stream_name_t name);
167 static void load_audio(types::audio_name_t name, std::string path);
189 types::stream_name_t =
"default");
199 static void set_volume(types::stream_name_t name,
int volume);
229 static void check_error_audio();
static void destroy()
Destroy the audio system.
static std::unordered_map< types::stream_name_t, SDL_AudioStream * > streams
Map of audio streams.
static void load_audio(types::audio_name_t name, std::string path)
Load an audio file.
static void resume_stream(types::stream_name_t name)
Resume a stream.
static std::unordered_map< types::audio_name_t, types::audio_file_t > audio_files
Map of audio files.
static void play_audio(types::audio_name_t, types::stream_name_t="default")
Play an audio file.
static types::audio_file_t get_audio_file(types::audio_name_t name)
Get an audio file.
static void clear_stream(types::stream_name_t name)
Stop a stream.
static void create_stream(types::stream_name_t)
Create an audio stream.
static void set_volume(types::stream_name_t name, int volume)
Set the volume of a stream.
static void pause_stream(types::stream_name_t name)
Pause a stream.
static void init()
Initialize the audio system.
static SDL_AudioStream * get_stream(types::stream_name_t name)
Get an audio stream.
Struct containing information about an audio file.
SDL_AudioSpec spec
Information about the audio format.
Uint8 * audio_buf
Pointer to audio buffer.
std::string path
The path to the audio file.
Uint32 audio_len
Length of audio buffer.