dEngine
Simple 2D C++ game engine
|
#include <Sound.h>
Public Member Functions | |
Sound (std::string filepath) | |
Constructor. More... | |
~Sound () | |
Destructor. More... | |
void | LoadSound () |
Loads sound into memory. More... | |
void | PlaySound () |
Plays the sound. More... | |
void | StopSound () |
Stops the sound from playing. More... | |
Private Member Functions | |
void | SetupDevice () |
Private Attributes | |
std::string | filePath |
SDL_AudioDeviceID | m_device |
SDL_AudioSpec | m_audioSpec |
Uint8 * | m_waveStart |
Uint32 | m_waveLength |
A Sound.
A sound is any audible event within the game, whether it be background music or a quick effect. Sounds are managed by the AudioManager and are loaded into and called from it.
Sound::Sound | ( | std::string | filepath | ) |
Constructor.
Create a new sound
filepath | The filepath to a wav file |
Sound::~Sound | ( | ) |
Destructor.
Frees up resources allocated by sound
void Sound::LoadSound | ( | ) |
Loads sound into memory.
void Sound::PlaySound | ( | ) |
Plays the sound.
|
private |
Referenced by LoadSound().
void Sound::StopSound | ( | ) |
Stops the sound from playing.
|
private |
Path to the sound's wave file
Referenced by LoadSound(), and Sound().
|
private |
The details of the sound itself to play
Referenced by LoadSound(), and SetupDevice().
|
private |
Id of the audio device to initiate playback on
Referenced by PlaySound(), SetupDevice(), StopSound(), and ~Sound().
|
private |
The length of the wave data
Referenced by LoadSound(), and PlaySound().
|
private |
The start of the wave data
Referenced by LoadSound(), PlaySound(), and ~Sound().