Sound engine.
More...
#include <sound.h>
|
| Sound () |
|
| ~Sound () |
|
void | init () |
| Installs the sound engine.
|
|
void | close () |
| Removes all sound functionalities.
|
|
void | playMusic (const std::string &fileName) |
| Starts background music.
|
|
void | stopMusic () |
| Stops currently running background music track.
|
|
void | fadeInMusic (const std::string &fileName, int ms=1000) |
| Fades in background music.
|
|
void | fadeOutMusic (int ms=1000) |
| Fades out currently running background music track.
|
|
void | fadeOutAndPlayMusic (const std::string &fileName, int ms=1000) |
| Fades out a background music and play a new one.
|
|
int | getMaxVolume () const |
|
void | setMusicVolume (int volume) |
|
void | setSfxVolume (int volume) |
|
void | setNotificationsVolume (int volume) |
|
void | playSfx (const std::string &path, int x=0, int y=0) |
| Plays a sound at the specified location.
|
|
void | playNotification (const std::string &path) |
| Plays a sound on the notification channel.
|
|
void | logic () |
| The sound logic.
|
|
|
void | info () |
| Logs various info about sound device.
|
|
void | haltMusic () |
| Halts and frees currently playing music.
|
|
Sound engine.
Definition at line 37 of file sound.h.
◆ Channel
Enumerator |
---|
CHANNEL_NOTIFICATIONS | |
CHANNEL_RESERVED_COUNT | |
CHANNEL_COUNT | |
Definition at line 119 of file sound.h.
◆ Sound()
◆ ~Sound()
◆ close()
Removes all sound functionalities.
Definition at line 296 of file sound.cpp.
◆ fadeInMusic()
void Sound::fadeInMusic |
( |
const std::string & |
fileName, |
|
|
int |
ms = 1000 |
|
) |
| |
Fades in background music.
- Parameters
-
fileName | The name of the music file. |
ms | Duration of fade-in effect (ms) |
Definition at line 181 of file sound.cpp.
◆ fadeOutAndPlayMusic()
void Sound::fadeOutAndPlayMusic |
( |
const std::string & |
fileName, |
|
|
int |
ms = 1000 |
|
) |
| |
Fades out a background music and play a new one.
- Parameters
-
fileName | The name of the music file. |
ms | Duration of fade-out effect (ms) |
Definition at line 218 of file sound.cpp.
◆ fadeOutMusic()
void Sound::fadeOutMusic |
( |
int |
ms = 1000 | ) |
|
Fades out currently running background music track.
- Parameters
-
ms | Duration of fade-out effect (ms) |
Definition at line 197 of file sound.cpp.
◆ getMaxVolume()
int Sound::getMaxVolume |
( |
| ) |
const |
|
inline |
◆ haltMusic()
void Sound::haltMusic |
( |
| ) |
|
|
private |
Halts and frees currently playing music.
Definition at line 308 of file sound.cpp.
◆ info()
Logs various info about sound device.
Definition at line 100 of file sound.cpp.
◆ init()
Installs the sound engine.
Definition at line 61 of file sound.cpp.
◆ logic()
The sound logic.
Checks whether the music and sound effects can be freed after they finished playing, and whether new music has to be played.
Definition at line 224 of file sound.cpp.
◆ playMusic()
void Sound::playMusic |
( |
const std::string & |
fileName | ) |
|
Starts background music.
- Parameters
-
fileName | The name of the music file. |
Definition at line 166 of file sound.cpp.
◆ playNotification()
void Sound::playNotification |
( |
const std::string & |
path | ) |
|
Plays a sound on the notification channel.
- Parameters
-
path | The resource path to the sound file. |
Definition at line 283 of file sound.cpp.
◆ playSfx()
void Sound::playSfx |
( |
const std::string & |
path, |
|
|
int |
x = 0 , |
|
|
int |
y = 0 |
|
) |
| |
Plays a sound at the specified location.
- Parameters
-
path | The resource path to the sound file. |
x | The vertical distance of the sound in pixels. |
y | The horizontal distance of the sound in pixels. |
Definition at line 248 of file sound.cpp.
◆ setMusicVolume()
void Sound::setMusicVolume |
( |
int |
volume | ) |
|
◆ setNotificationsVolume()
void Sound::setNotificationsVolume |
( |
int |
volume | ) |
|
◆ setSfxVolume()
void Sound::setSfxVolume |
( |
int |
volume | ) |
|
◆ stopMusic()
void Sound::stopMusic |
( |
| ) |
|
Stops currently running background music track.
Definition at line 171 of file sound.cpp.
◆ mCurrentMusicFile
std::string Sound::mCurrentMusicFile |
|
private |
◆ mInstalled
bool Sound::mInstalled = false |
|
private |
◆ mMusic
◆ mMusicVolume
int Sound::mMusicVolume = 60 |
|
private |
◆ mNextMusicFile
std::string Sound::mNextMusicFile |
|
private |
◆ mNotificationsVolume
int Sound::mNotificationsVolume = 100 |
|
private |
◆ mSfxVolume
int Sound::mSfxVolume = 100 |
|
private |
◆ mSounds
The documentation for this class was generated from the following files: