![]() |
Dauphine
0.1
A platforming/stealth game in a medieval fantasy setting, developed with SDL2.
|
The audio handler. More...
#include <AudioHandler.h>
Public Member Functions | |
| AudioHandler () | |
| The constructor. More... | |
| virtual | ~AudioHandler () |
| The destructor. More... | |
| void | playMusic (const int times_) |
| Plays the current music. More... | |
| void | playEffect (const int times_) |
| Plays the current effect. More... | |
| void | stopMusic () |
| Stops playing the current music. | |
| void | setMusicVolume (const unsigned int percent_) |
| Sets the volume for the music. More... | |
| void | setEffectVolume (const unsigned int percent_) |
| Sets the volume for the effects. More... | |
| void | changeMusic (const std::string &path_) |
| Changes current music. More... | |
| void | setCurrentMusic (const std::string &path_) |
| Sets the current music. More... | |
| void | setCurrentEffect (const std::string &path_) |
| Sets the current effect. More... | |
Private Attributes | |
| Mix_Music * | currentMusic |
| The current music that is playing. More... | |
| Mix_Chunk * | currentEffect |
| The current effect that is playing. More... | |
The audio handler.
Class that handles all the audio in the game. Is a singleton, so should be called in each state.
| AudioHandler::AudioHandler | ( | ) |
The constructor.
Initializes all the attributes.
|
virtual |
The destructor.
Frees the allocated attributes.
| void AudioHandler::changeMusic | ( | const std::string & | path_) |
Changes current music.
Stops the music, sets it, and plays it with infinite looping.
| path_ | : The path to the desired music. |
| void AudioHandler::playEffect | ( | const int | times_) |
Plays the current effect.
| times_ | : Times to loop the song. MIX_LOOP (or -1) for infinite looping. |
| void AudioHandler::playMusic | ( | const int | times_) |
Plays the current music.
| times_ | : Times to loop the song. MIX_LOOP (or -1) for infinite looping. |
| void AudioHandler::setCurrentEffect | ( | const std::string & | path_) |
Sets the current effect.
If one already exists, frees it first.
| path_ | : The path to the desired effect. |
| void AudioHandler::setCurrentMusic | ( | const std::string & | path_) |
Sets the current music.
If one already exists, frees it first.
| path_ | : The path to the desired music. |
| void AudioHandler::setEffectVolume | ( | const unsigned int | percent_) |
Sets the volume for the effects.
If the percent_ is over 100, will be set to 100.
| percent_ | : The volume percentage (0-100). |
| void AudioHandler::setMusicVolume | ( | const unsigned int | percent_) |
Sets the volume for the music.
If the percent_ is over 100, will be set to 100.
| percent_ | : The volume percentage (0-100). |
|
private |
The current effect that is playing.
|
private |
The current music that is playing.
1.8.4