libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
AudioDriver.h
1/****************************************************************************
2 * Platform Abstraction Layer
3 * Daryl Borth 2026
4 * AudioDriver.h
5 *
6 * Platform audio backend GuiSound delegates to. Exactly one driver
7 * implements this and assigns the single global instance below
8 ***************************************************************************/
9#pragma once
10
11#include <stdint.h>
12
18{
19 public:
20 virtual ~AudioDriver() = default;
21
23 virtual void init() = 0;
25 virtual void shutdown() = 0;
27 virtual void start() = 0;
29 virtual void stop() = 0;
30
34 virtual int32_t playVoice(const uint8_t * data, int32_t length, int volume) = 0;
36 virtual void stopVoice(int32_t voice) = 0;
38 virtual void pauseVoice(int32_t voice) = 0;
40 virtual void resumeVoice(int32_t voice) = 0;
42 virtual bool isVoicePlaying(int32_t voice) = 0;
46 virtual void setVoiceVolume(int32_t voice, int volume) = 0;
47
50 virtual void playStream(const uint8_t * data, int32_t length, bool loop, int volume) = 0;
52 virtual void stopStream() = 0;
54 virtual void pauseStream() = 0;
56 virtual void resumeStream() = 0;
58 virtual bool isStreamPlaying() = 0;
61 virtual void setStreamVolume(int volume) = 0;
62};
Platform audio backend GuiSound delegates to: fixed one-shot PCM voices plus one background OGG strea...
Definition AudioDriver.h:18
virtual void playStream(const uint8_t *data, int32_t length, bool loop, int volume)=0
Streamed (OGG) playback.
virtual void stop()=0
Stops the audio backend.
virtual void setVoiceVolume(int32_t voice, int volume)=0
Changes the volume of a playing voice.
virtual int32_t playVoice(const uint8_t *data, int32_t length, int volume)=0
Start a one-shot/short PCM voice.
virtual void pauseStream()=0
Pauses the stream, keeping its position.
virtual bool isStreamPlaying()=0
virtual void resumeStream()=0
Resumes a stream paused with pauseStream().
virtual void resumeVoice(int32_t voice)=0
Resumes a voice paused with pauseVoice().
virtual void shutdown()=0
Releases everything init() allocated. Call stop() first.
virtual void pauseVoice(int32_t voice)=0
Pauses a playing voice, keeping its position and slot.
virtual void setStreamVolume(int volume)=0
Changes the stream volume.
virtual void stopVoice(int32_t voice)=0
Stops a voice returned by playVoice() and frees its slot.
virtual void start()=0
Starts the audio backend running (eg. registers the DSP/AX callback).
virtual void stopStream()=0
Stops the stream started by playStream().
virtual bool isVoicePlaying(int32_t voice)=0
virtual void init()=0
Allocates the backend's audio resources. Does not start playback; see start().