StevEngine
StevEngine is a customizable C++ game engine.
|
Main audio system for handling sound playback and management. More...
#include <audio/AudioSystem.hpp>
Public Member Functions | |
void | Init () |
Initialize the audio system. | |
void | Play (Emitter *emitter) |
Play an audio emitter. | |
void | PlayBackground (std::string path, bool loop=true, double volume=1) |
Play background music. | |
void | Stop (int channel) |
Stop audio on a specific channel. | |
void | StopBackground () |
Stop currently playing background music. | |
void SDLCALL | ChannelCompleted (int channel) |
Channel finished callback. | |
void | SetSoundsVolume (double volume) |
Set volume for sound effects. | |
double | GetSoundsVolume () const |
void | SetMusicVolume (double volume) |
Set volume for background music. | |
double | GetMusicVolume () const |
std::vector< const char * > | GetAudioDevices () |
Get list of available audio output devices. | |
void | SetAudioDevice (const char *device) |
Set active audio output device. | |
const char * | GetActiveAudioDevice () const |
Main audio system for handling sound playback and management.
The AudioSystem manages all audio output including sound effects and music. It handles device selection, volume control, and playback of both one-shot and looping sounds through SDL_mixer.
void SDLCALL StevEngine::Audio::AudioSystem::ChannelCompleted | ( | int | channel | ) |
Channel finished callback.
channel | The channel that finished playing |
Called by SDL_mixer when a sound finishes playing
std::vector< const char * > StevEngine::Audio::AudioSystem::GetAudioDevices | ( | ) |
Get list of available audio output devices.
void StevEngine::Audio::AudioSystem::Init | ( | ) |
Initialize the audio system.
Sets up SDL_mixer, loads available audio devices, and initializes default volume levels and audio format settings.
void StevEngine::Audio::AudioSystem::Play | ( | Emitter * | emitter | ) |
Play an audio emitter.
emitter | The audio emitter component to play |
Plays the sound associated with the given emitter. If the emitter is already playing, it will be stopped and restarted.
void StevEngine::Audio::AudioSystem::PlayBackground | ( | std::string | path, |
bool | loop = true, | ||
double | volume = 1 ) |
Play background music.
path | Path to the audio file |
loop | Whether to loop the music |
volume | Volume level from 0.0 to 1.0 |
Loads and plays music from the specified file. Previous music will be stopped automatically.
void StevEngine::Audio::AudioSystem::SetAudioDevice | ( | const char * | device | ) |
Set active audio output device.
device | Name of audio device to use, or NULL for default |
Changes the audio output device. The current device will be closed and audio reinitialized with the new device.
void StevEngine::Audio::AudioSystem::SetMusicVolume | ( | double | volume | ) |
Set volume for background music.
volume | Volume level from 0.0 to 1.0 |
Sets the master volume level for background music. Volume changes are saved to settings.
void StevEngine::Audio::AudioSystem::SetSoundsVolume | ( | double | volume | ) |
Set volume for sound effects.
volume | Volume level from 0.0 to 1.0 |
Sets the master volume level for all sound effects. Volume changes are saved to settings.
void StevEngine::Audio::AudioSystem::Stop | ( | int | channel | ) |
Stop audio on a specific channel.
channel | The channel ID to stop |