libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
GuiSound Class Reference

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.
 

Detailed Description

Sound conversion and playback.

Generic – delegates to audioSystem for everything platform-specific.

Definition at line 26 of file GuiSound.h.

Constructor & Destructor Documentation

◆ GuiSound() [1/2]

GuiSound::GuiSound ( const uint8_t * s,
int32_t l,
SOUND t )

Constructor.

Parameters
sPointer to the sound data
lLength of sound data
tSound format type (PCM or OGG)

Definition at line 18 of file GuiSound.cpp.

◆ GuiSound() [2/2]

GuiSound::GuiSound ( )

Constructor.

Definition at line 16 of file GuiSound.cpp.

◆ ~GuiSound()

GuiSound::~GuiSound ( )

Destructor.

Definition at line 28 of file GuiSound.cpp.

Member Function Documentation

◆ isPlaying()

bool GuiSound::isPlaying ( )

Checks if the sound is currently playing.

Returns
true if sound is playing, false otherwise

Definition at line 125 of file GuiSound.cpp.

◆ pause()

void GuiSound::pause ( )

Pause sound playback.

Definition at line 89 of file GuiSound.cpp.

◆ play()

void GuiSound::play ( )

Start sound playback.

Definition at line 42 of file GuiSound.cpp.

◆ resume()

void GuiSound::resume ( )

Resume sound playback.

Definition at line 107 of file GuiSound.cpp.

◆ setDefaultVolume()

void GuiSound::setDefaultVolume ( VOLUME_TYPE t,
int v )
static

Set global default volume for a volume category (music or sound effects)

Parameters
tVolume category (MUSIC or SFX)
vVolume (0-100)

Definition at line 171 of file GuiSound.cpp.

◆ setLoop()

void GuiSound::setLoop ( bool l)

Set the sound to loop playback (only applies to OGG)

Parameters
lLoop (true to loop)

Definition at line 166 of file GuiSound.cpp.

◆ setVolume()

void GuiSound::setVolume ( int v)

Set sound volume.

Parameters
vSound volume (0-100)

Definition at line 143 of file GuiSound.cpp.

◆ stop()

void GuiSound::stop ( )

Stop sound playback.

Definition at line 65 of file GuiSound.cpp.

Member Data Documentation

◆ activeMusic

GuiSound * GuiSound::activeMusic = nullptr
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.

◆ defaultMusicVolume

int GuiSound::defaultMusicVolume = 100
staticprotected

Global music volume (0-100) – applies to any looping sound.

Definition at line 69 of file GuiSound.h.

◆ defaultSfxVolume

int GuiSound::defaultSfxVolume = 100
staticprotected

Global sound effects volume (0-100) – applies to any non-looping sound.

Definition at line 70 of file GuiSound.h.

◆ length

int32_t GuiSound::length = 0
protected

Length of sound data.

Definition at line 64 of file GuiSound.h.

◆ loop

bool GuiSound::loop = false
protected

Loop sound playback.

Definition at line 67 of file GuiSound.h.

◆ playingOGG

GuiSound * GuiSound::playingOGG = nullptr
staticprotected

Pointer to the GuiSound instance currently occupying the single shared hardware OGG stream.

Definition at line 73 of file GuiSound.h.

◆ sound

const uint8_t* GuiSound::sound = nullptr
protected

Pointer to the sound data.

Definition at line 62 of file GuiSound.h.

◆ type

SOUND GuiSound::type = SOUND::NONE
protected

Sound format type (PCM or OGG)

Definition at line 63 of file GuiSound.h.

◆ voice

int32_t GuiSound::voice = -1
protected

Backend-assigned voice handle (PCM only)

Definition at line 65 of file GuiSound.h.

◆ volume

int32_t GuiSound::volume = 100
protected

Sound volume (0-100)

Definition at line 66 of file GuiSound.h.


The documentation for this class was generated from the following files: