29#include <SDL3/SDL_audio.h>
31#include <unordered_map>
40typedef std::string StreamName;
42typedef std::string AudioName;
105 static std::unordered_map<Types::AudioName, Types::AudioFile>
audiofiles;
117 static std::unordered_map<Types::StreamName, SDL_AudioStream *>
streams;
155 static SDL_AudioStream *
GetStream(Types::StreamName name);
166 static void LoadAudio(Types::AudioName name, std::string path);
187 static void PlayAudio(Types::AudioName, Types::StreamName =
"default");
197 static void SetVolume(Types::StreamName name,
int volume);
227 static void CheckError();
static void Init()
Initialize the audio system.
static std::unordered_map< Types::AudioName, Types::AudioFile > audiofiles
Map of audio files.
static void Destroy()
Destroy the audio system.
static void ClearStream(Types::StreamName name)
Stop a stream.
static void SetVolume(Types::StreamName name, int volume)
Set the volume of a stream.
static void CreateStream(Types::StreamName)
Create an audio stream.
static void PlayAudio(Types::AudioName, Types::StreamName="default")
Play an audio file.
static SDL_AudioStream * GetStream(Types::StreamName name)
Get an audio stream.
static void LoadAudio(Types::AudioName name, std::string path)
Load an audio file.
static Types::AudioFile GetAudioFile(Types::AudioName name)
Get an audio file.
static void PauseStream(Types::StreamName name)
Pause a stream.
static void ResumeStream(Types::StreamName name)
Resume a stream.
static std::unordered_map< Types::StreamName, SDL_AudioStream * > streams
Map of audio streams.
Struct containing information about an audio file.
std::string path
The path to the audio file.
Uint32 audio_len
Length of audio buffer.
SDL_AudioSpec spec
Information about the audio format.
Uint8 * audio_buf
Pointer to audio buffer.