Terminus
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
terminus::SoundManager Class Reference

The SoundManager class provides basic music and sound playing functionality. All needed sound effects are stored in the member variable m_sounds. Implemented as a singelton, accessibility for all classes is ensured. More...

#include <soundmanager.h>

Inheritance diagram for terminus::SoundManager:

Public Member Functions

virtual ~SoundManager ()
 
void playSound (QString name)
 Plays a sound effect of a certain name. More...
 
void toggleBackgroundMusic ()
 
QSoundEffect * sound (QString name)
 
std::map< QString, QSoundEffect * > sounds ()
 

Static Public Member Functions

static SoundManagergetInstance ()
 Returns the singelton instance of the SoundManager class. More...
 

Protected Member Functions

 SoundManager ()
 
void initialize ()
 

Protected Attributes

std::map< QString, QSoundEffect * > m_sounds
 

Static Protected Attributes

static SoundManagerm_instance = nullptr
 

Detailed Description

The SoundManager class provides basic music and sound playing functionality. All needed sound effects are stored in the member variable m_sounds. Implemented as a singelton, accessibility for all classes is ensured.

Constructor & Destructor Documentation

terminus::SoundManager::SoundManager ( )
protected
terminus::SoundManager::~SoundManager ( )
virtual

Member Function Documentation

SoundManager * terminus::SoundManager::getInstance ( )
static

Returns the singelton instance of the SoundManager class.

void terminus::SoundManager::initialize ( )
protected
void terminus::SoundManager::playSound ( QString  name)

Plays a sound effect of a certain name.

Provided that the desired sound effect is stored on initializiation, the sound effect will be played in full length. Calling the function for the same sound effect a second time, while the sound is still playing from the first invocation, will result in restarting the current sound effect.

Parameters
nameName of the sound effect meant to be played
QSoundEffect * terminus::SoundManager::sound ( QString  name)
std::map< QString, QSoundEffect * > terminus::SoundManager::sounds ( )
void terminus::SoundManager::toggleBackgroundMusic ( )

Member Data Documentation

SoundManager * terminus::SoundManager::m_instance = nullptr
staticprotected
std::map<QString, QSoundEffect *> terminus::SoundManager::m_sounds
protected

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