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

Platform-agnostic Tremor (integer OGG) decoder. More...

#include <GuiSoundOggPlayer.h>

Public Member Functions

bool play (const uint8_t *data, int32_t length, int time_pos, bool loop)
 Starts decoding data on a new thread.
 
void stop ()
 Stops playback and joins the decode thread.
 
void pause (bool pause)
 Pauses or resumes the decode thread without stopping it.
 
bool isPlaying () const
 
bool isPaused () const
 
int getSampleRate () const
 
int getChannels () const
 
const uint8_t * getReadyBuffer (int32_t *outSize)
 
void consumeBuffer ()
 Releases the buffer last returned by getReadyBuffer(), letting the decode thread reuse that ring slot.
 

Detailed Description

Platform-agnostic Tremor (integer OGG) decoder.

Decodes into a small double-buffered PCM ring on its own decode thread; the platform AudioDriver that owns an instance is responsible for pulling ready buffers and feeding them to hardware - this class does no audio output itself.

Definition at line 17 of file GuiSoundOggPlayer.h.

Constructor & Destructor Documentation

◆ GuiSoundOggPlayer()

GuiSoundOggPlayer::GuiSoundOggPlayer ( )

Definition at line 17 of file GuiSoundOggPlayer.cpp.

◆ ~GuiSoundOggPlayer()

GuiSoundOggPlayer::~GuiSoundOggPlayer ( )

Definition at line 26 of file GuiSoundOggPlayer.cpp.

Member Function Documentation

◆ consumeBuffer()

void GuiSoundOggPlayer::consumeBuffer ( )

Releases the buffer last returned by getReadyBuffer(), letting the decode thread reuse that ring slot.

Definition at line 125 of file GuiSoundOggPlayer.cpp.

◆ getChannels()

int GuiSoundOggPlayer::getChannels ( ) const
inline
Returns
channel count (1 or 2) of the stream currently loaded, valid once play() has started decoding

Definition at line 51 of file GuiSoundOggPlayer.h.

◆ getReadyBuffer()

const uint8_t * GuiSoundOggPlayer::getReadyBuffer ( int32_t * outSize)
Parameters
outSizeFilled with the ready buffer's size in bytes
Returns
pointer to the next decoded PCM buffer, or nullptr if neither of the two ring slots is ready yet

Definition at line 117 of file GuiSoundOggPlayer.cpp.

◆ getSampleRate()

int GuiSoundOggPlayer::getSampleRate ( ) const
inline
Returns
sample rate of the stream currently loaded, valid once play() has started decoding

Definition at line 47 of file GuiSoundOggPlayer.h.

◆ isPaused()

bool GuiSoundOggPlayer::isPaused ( ) const
inline
Returns
true if the decode thread is currently paused

Definition at line 43 of file GuiSoundOggPlayer.h.

◆ isPlaying()

bool GuiSoundOggPlayer::isPlaying ( ) const
inline
Returns
true if the decode thread is currently running (whether paused or not)

Definition at line 39 of file GuiSoundOggPlayer.h.

◆ pause()

void GuiSoundOggPlayer::pause ( bool pause)

Pauses or resumes the decode thread without stopping it.

Definition at line 113 of file GuiSoundOggPlayer.cpp.

◆ play()

bool GuiSoundOggPlayer::play ( const uint8_t * data,
int32_t length,
int time_pos,
bool loop )

Starts decoding data on a new thread.

Any previous playback is stopped first.

Parameters
dataOGG file data. Must remain valid until stop() returns or playback finishes (the decode thread reads it directly).
lengthLength of data in bytes
time_posInitial seek position, in milliseconds
loopWhether to seek back to the start and keep decoding after reaching the end of the stream
Returns
true if the decode thread was started successfully

Definition at line 59 of file GuiSoundOggPlayer.cpp.

◆ stop()

void GuiSoundOggPlayer::stop ( )

Stops playback and joins the decode thread.

Definition at line 98 of file GuiSoundOggPlayer.cpp.


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