Add audio subsystem skeleton with a working Linux PCM playback path

Cross-platform audiostream/audio API with per-platform hooks for
PSP/Dolphin/Linux. Linux is fully wired end-to-end through SDL2
(device open, volume-mixed queueing, finish detection via
SDL_GetQueuedAudioSize) and verified playing a generated test tone
in engine.c. PSP and Dolphin hooks are stubbed for now.
This commit is contained in:
2026-08-31 10:24:02 -05:00
parent fcf0de72af
commit 8ea370a1d1
31 changed files with 1022 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "audiodolphin.h"
errorret_t audioDolphinInit() {
errorOk();
}
errorret_t audioDolphinUpdate() {
errorOk();
}
errorret_t audioDolphinDispose() {
errorOk();
}
+31
View File
@@ -0,0 +1,31 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "error/error.h"
/**
* Initializes the GameCube/Wii-specific audio subsystem state.
*
* @return Error state if any.
*/
errorret_t audioDolphinInit();
/**
* Updates the GameCube/Wii-specific audio subsystem state. Called once per
* frame.
*
* @return Error state if any.
*/
errorret_t audioDolphinUpdate();
/**
* Disposes the GameCube/Wii-specific audio subsystem state.
*
* @return Error state if any.
*/
errorret_t audioDolphinDispose();
+13
View File
@@ -0,0 +1,13 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "audiodolphin.h"
#define audioPlatformInit audioDolphinInit
#define audioPlatformUpdate audioDolphinUpdate
#define audioPlatformDispose audioDolphinDispose
@@ -0,0 +1,8 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "audiostreamdolphin.h"
@@ -0,0 +1,51 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "error/error.h"
typedef struct audiostream_s audiostream_t;
typedef struct {
int32_t voiceId;
} audiostreamdolphin_t;
/**
* Initializes the GameCube/Wii-specific playback state of an audio stream
* (e.g. allocating a voice via AESND_AllocateVoice/ansnd equivalent).
*
* @param stream The audio stream to initialize.
* @return Error state if any.
*/
errorret_t audioStreamDolphinInit(audiostream_t *stream);
/**
* Disposes the GameCube/Wii-specific playback state of an audio stream,
* releasing its voice.
*
* @param stream The audio stream to dispose.
* @return Error state if any.
*/
errorret_t audioStreamDolphinDispose(audiostream_t *stream);
/**
* Sends the stream's currently staged PCM data (stream->data) to its
* allocated voice.
*
* @param stream The audio stream to output.
* @return Error state if any.
*/
errorret_t audioStreamDolphinBuffer(audiostream_t *stream);
/**
* Checks whether the stream's voice has finished playing its currently
* buffered data.
*
* @param stream The audio stream to check.
* @return true if playback has finished, false otherwise.
*/
bool_t audioStreamDolphinIsFinished(audiostream_t *stream);
@@ -0,0 +1,16 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "audiostreamdolphin.h"
typedef audiostreamdolphin_t audiostreamplatform_t;
#define audioStreamPlatformInit audioStreamDolphinInit
#define audioStreamPlatformDispose audioStreamDolphinDispose
#define audioStreamPlatformBuffer audioStreamDolphinBuffer
#define audioStreamPlatformIsFinished audioStreamDolphinIsFinished