It is a semi-thread class to manage the audio of Qubet. It can manage an ambientMusic and different effects.
More...
#include <audiomanager.h>
|
void | enableAudio (bool enabled) |
| Sets the variable audioEnabled and pause or continue the ambientMusic. If enabled is false and there are currently playing effects they will be stopped. More...
|
|
void | playAmbientMusic (QString filename) |
| Plays the music file provided as parameter filename as ambientMusic. More...
|
|
void | stopAmbientMusic () |
| Stops the current ambient music.
|
|
void | playEffect (QString effectName) |
| Plays the effect that has got the parameter effectName filename. More...
|
|
|
void | run () |
| It is the reimplementation of QThread's run() method. It is empty because the AudioManager is a semi-thread, all actions are managed by signals.
|
|
It is a semi-thread class to manage the audio of Qubet. It can manage an ambientMusic and different effects.
It provides slots to connect the entity that are able to request an ambientMusic change, an effect to play or to enable and disable the music.
- Version
- 1.0
- Author
- #34
AudioManager::AudioManager |
( |
QObject * |
_parent = 0 | ) |
|
|
explicit |
Creates a new AudioManager loading all the effects in the folder resources/effects.
- Parameters
-
_parent | is a callback variable to the parent of AudioManager. |
void AudioManager::enableAudio |
( |
bool |
enabled | ) |
|
|
privateslot |
Sets the variable audioEnabled and pause or continue the ambientMusic. If enabled is false and there are currently playing effects they will be stopped.
- Parameters
-
enabled | is the variable to states the AudioManager to enable or disable the audio. |
bool AudioManager::isAudioEnabled |
( |
| ) |
|
Returns the state of the audio.
- Returns
- true if audio is enabled, else false.
void AudioManager::playAmbientMusic |
( |
QString |
filename | ) |
|
|
privateslot |
Plays the music file provided as parameter filename as ambientMusic.
It will also stop the current ambientMusic but not the effects.
- Parameters
-
filename | is the filename of the ambientMusic to play. |
void AudioManager::playEffect |
( |
QString |
effectName | ) |
|
|
privateslot |
Plays the effect that has got the parameter effectName filename.
For example if you have the file resources/effects/gameover.wav, in order to play this effect you have to call playEffect("gameover.wav").
If the effect is already playing it will be restarted.
- Parameters
-
effectName | is the effect's filename. |
QMediaPlayer* AudioManager::ambientMusic |
|
private |
It is the QMediaPlayer of the current ambient music.
bool AudioManager::audioEnabled |
|
private |
It is the variable that states if the audio is currently enabled or not.
QMap<QString,QSoundEffect*> AudioManager::effectsList |
|
private |
It is the QMap of effects and their filename.
QMediaPlaylist* AudioManager::playlist |
|
private |
It is the playlist to be played as ambient music.
The documentation for this class was generated from the following files: