Sound conversion and playback. More...
#include <GuiSound.h>
Public Member Functions | |
| GuiSound (const uint8_t *s, int32_t l, SOUND t) | |
| Constructor. | |
| GuiSound () | |
| Constructor. | |
| ~GuiSound () | |
| Destructor. | |
| void | play () |
| Start sound playback. | |
| void | stop () |
| Stop sound playback. | |
| void | pause () |
| Pause sound playback. | |
| void | resume () |
| Resume sound playback. | |
| bool | isPlaying () |
| Checks if the sound is currently playing. | |
| void | setVolume (int v) |
| Set sound volume. | |
| void | setLoop (bool l) |
| Set the sound to loop playback (only applies to OGG) | |
Static Public Member Functions | |
| static void | setDefaultVolume (VOLUME_TYPE t, int v) |
| Set global default volume for a volume category (music or sound effects) | |
Protected Attributes | |
| const uint8_t * | sound = nullptr |
| Pointer to the sound data. | |
| SOUND | type = SOUND::NONE |
| Sound format type (PCM or OGG) | |
| int32_t | length = 0 |
| Length of sound data. | |
| int32_t | voice = -1 |
| Backend-assigned voice handle (PCM only) | |
| int32_t | volume = 100 |
| Sound volume (0-100) | |
| bool | loop = false |
| Loop sound playback. | |
Static Protected Attributes | |
| static int | defaultMusicVolume = 100 |
| Global music volume (0-100) – applies to any looping sound. | |
| static int | defaultSfxVolume = 100 |
| Global sound effects volume (0-100) – applies to any non-looping sound. | |
| static GuiSound * | playingOGG = nullptr |
| Pointer to the GuiSound instance currently occupying the single shared hardware OGG stream. | |
| static GuiSound * | activeMusic = nullptr |
| Pointer to the last GuiSound with loop==true that was told to play, ie: the "background music" track. | |
Sound conversion and playback.
Generic – delegates to audioSystem for everything platform-specific.
Definition at line 26 of file GuiSound.h.
| GuiSound::GuiSound | ( | const uint8_t * | s, |
| int32_t | l, | ||
| SOUND | t ) |
Constructor.
| s | Pointer to the sound data |
| l | Length of sound data |
| t | Sound format type (PCM or OGG) |
Definition at line 18 of file GuiSound.cpp.
| GuiSound::GuiSound | ( | ) |
Constructor.
Definition at line 16 of file GuiSound.cpp.
| GuiSound::~GuiSound | ( | ) |
Destructor.
Definition at line 28 of file GuiSound.cpp.
| bool GuiSound::isPlaying | ( | ) |
Checks if the sound is currently playing.
Definition at line 125 of file GuiSound.cpp.
| void GuiSound::pause | ( | ) |
Pause sound playback.
Definition at line 89 of file GuiSound.cpp.
| void GuiSound::play | ( | ) |
Start sound playback.
Definition at line 42 of file GuiSound.cpp.
| void GuiSound::resume | ( | ) |
Resume sound playback.
Definition at line 107 of file GuiSound.cpp.
|
static |
Set global default volume for a volume category (music or sound effects)
| t | Volume category (MUSIC or SFX) |
| v | Volume (0-100) |
Definition at line 171 of file GuiSound.cpp.
| void GuiSound::setLoop | ( | bool | l | ) |
Set the sound to loop playback (only applies to OGG)
| l | Loop (true to loop) |
Definition at line 166 of file GuiSound.cpp.
| void GuiSound::setVolume | ( | int | v | ) |
| void GuiSound::stop | ( | ) |
Stop sound playback.
Definition at line 65 of file GuiSound.cpp.
|
staticprotected |
Pointer to the last GuiSound with loop==true that was told to play, ie: the "background music" track.
Definition at line 76 of file GuiSound.h.
|
staticprotected |
Global music volume (0-100) – applies to any looping sound.
Definition at line 69 of file GuiSound.h.
|
staticprotected |
Global sound effects volume (0-100) – applies to any non-looping sound.
Definition at line 70 of file GuiSound.h.
|
protected |
Length of sound data.
Definition at line 64 of file GuiSound.h.
|
protected |
Loop sound playback.
Definition at line 67 of file GuiSound.h.
|
staticprotected |
Pointer to the GuiSound instance currently occupying the single shared hardware OGG stream.
Definition at line 73 of file GuiSound.h.
|
protected |
Pointer to the sound data.
Definition at line 62 of file GuiSound.h.
|
protected |
Sound format type (PCM or OGG)
Definition at line 63 of file GuiSound.h.
|
protected |
Backend-assigned voice handle (PCM only)
Definition at line 65 of file GuiSound.h.
|
protected |
Sound volume (0-100)
Definition at line 66 of file GuiSound.h.