My Project
Loading...
Searching...
No Matches
EI::SoundManager Class Reference

High-level sound manager that wraps around an IAudioSystem. Provides functionality for loading, playing, and stopping sounds. More...

#include <Sound_manager.hpp>

Public Member Functions

 SoundManager ()
 Default constructor.
 ~SoundManager ()
 Destructor, shuts down audio system if necessary.
bool Init ()
 Initializes the underlying audio system.
void Shutdown ()
 Shuts down the audio system and releases resources.
void Update (float dt)
 Updates the audio system (call once per frame).
SoundHandle LoadSound (const std::string &path, const SoundDesc &desc={})
 Loads a sound file into memory and returns a handle.
void UnloadSound (SoundHandle sound)
 Unloads a previously loaded sound.
VoiceHandle Play (SoundHandle sound, const VoiceParams &params={})
 Plays a sound with the given parameters.
void Stop (VoiceHandle voice)
 Stops a currently playing voice.
void SetMasterVolume (float volume)
 Sets the global/master volume of the audio system.

Detailed Description

High-level sound manager that wraps around an IAudioSystem. Provides functionality for loading, playing, and stopping sounds.

Constructor & Destructor Documentation

◆ SoundManager()

EI::SoundManager::SoundManager ( )

Default constructor.

◆ ~SoundManager()

EI::SoundManager::~SoundManager ( )

Destructor, shuts down audio system if necessary.

Member Function Documentation

◆ Init()

bool EI::SoundManager::Init ( )

Initializes the underlying audio system.

Returns
True if initialization succeeded

◆ LoadSound()

SoundHandle EI::SoundManager::LoadSound ( const std::string & path,
const SoundDesc & desc = {} )

Loads a sound file into memory and returns a handle.

Parameters
pathPath to the sound file
descOptional sound description
Returns
SoundHandle to the loaded sound

◆ Play()

VoiceHandle EI::SoundManager::Play ( SoundHandle sound,
const VoiceParams & params = {} )

Plays a sound with the given parameters.

Parameters
soundHandle of the sound to play
paramsOptional playback parameters
Returns
VoiceHandle representing the playing instance

◆ SetMasterVolume()

void EI::SoundManager::SetMasterVolume ( float volume)

Sets the global/master volume of the audio system.

Parameters
volumeVolume value (0.0f = silent, 1.0f = full)

◆ Shutdown()

void EI::SoundManager::Shutdown ( )

Shuts down the audio system and releases resources.

◆ Stop()

void EI::SoundManager::Stop ( VoiceHandle voice)

Stops a currently playing voice.

Parameters
voiceHandle of the voice to stop

◆ UnloadSound()

void EI::SoundManager::UnloadSound ( SoundHandle sound)

Unloads a previously loaded sound.

Parameters
soundHandle of the sound to unload

◆ Update()

void EI::SoundManager::Update ( float dt)

Updates the audio system (call once per frame).

Parameters
dtDelta time in seconds

The documentation for this class was generated from the following file: