30 if(
type == SOUND::OGG) {
33 platform->getAudio()->stopStream();
45 int vol = 255 * (
volume / 100.0) * (typeVol / 100.0);
73 platform->getAudio()->stopVoice(
voice);
76 platform->getAudio()->stopStream();
97 platform->getAudio()->pauseVoice(
voice);
100 platform->getAudio()->pauseStream();
115 platform->getAudio()->resumeVoice(
voice);
118 platform->getAudio()->resumeStream();
133 return platform->getAudio()->isVoicePlaying(
voice);
135 return platform->getAudio()->isStreamPlaying();
151 int newvol = 255 * (
volume / 100.0) * (typeVol / 100.0);
156 platform->getAudio()->setVoiceVolume(
voice, newvol);
159 platform->getAudio()->setStreamVolume(newvol);
173 if (t == VOLUME_TYPE::SFX) {
175 }
else if (t == VOLUME_TYPE::MUSIC) {
Umbrella header for the platform-agnostic libgui core.
Sound conversion and playback.
int32_t volume
Sound volume (0-100)
void setVolume(int v)
Set sound volume.
bool loop
Loop sound playback.
static GuiSound * activeMusic
Pointer to the last GuiSound with loop==true that was told to play, ie: the "background music" track.
void setLoop(bool l)
Set the sound to loop playback (only applies to OGG)
static int defaultMusicVolume
Global music volume (0-100) – applies to any looping sound.
void resume()
Resume sound playback.
const uint8_t * sound
Pointer to the sound data.
void play()
Start sound playback.
SOUND type
Sound format type (PCM or OGG)
void stop()
Stop sound playback.
void pause()
Pause sound playback.
int32_t voice
Backend-assigned voice handle (PCM only)
int32_t length
Length of sound data.
bool isPlaying()
Checks if the sound is currently playing.
static GuiSound * playingOGG
Pointer to the GuiSound instance currently occupying the single shared hardware OGG stream.
static int defaultSfxVolume
Global sound effects volume (0-100) – applies to any non-looping sound.
static void setDefaultVolume(VOLUME_TYPE t, int v)
Set global default volume for a volume category (music or sound effects)
SOUND
Encoding of a GuiSound: a short PCM one-shot or a streamed OGG.
VOLUME_TYPE
Global volume category: music (looping stream) or sound effects.