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:
@@ -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 {
|
||||
int channel;
|
||||
} audiostreampsp_t;
|
||||
|
||||
/**
|
||||
* Initializes the PSP-specific playback state of an audio stream (e.g.
|
||||
* reserving a hardware output channel via sceAudioChReserve).
|
||||
*
|
||||
* @param stream The audio stream to initialize.
|
||||
* @return Error state if any.
|
||||
*/
|
||||
errorret_t audioStreamPSPInit(audiostream_t *stream);
|
||||
|
||||
/**
|
||||
* Disposes the PSP-specific playback state of an audio stream, releasing
|
||||
* its hardware output channel.
|
||||
*
|
||||
* @param stream The audio stream to dispose.
|
||||
* @return Error state if any.
|
||||
*/
|
||||
errorret_t audioStreamPSPDispose(audiostream_t *stream);
|
||||
|
||||
/**
|
||||
* Sends the stream's currently staged PCM data (stream->data) to its
|
||||
* reserved hardware output channel.
|
||||
*
|
||||
* @param stream The audio stream to output.
|
||||
* @return Error state if any.
|
||||
*/
|
||||
errorret_t audioStreamPSPBuffer(audiostream_t *stream);
|
||||
|
||||
/**
|
||||
* Checks whether the stream's reserved hardware channel has finished
|
||||
* playing its currently buffered data.
|
||||
*
|
||||
* @param stream The audio stream to check.
|
||||
* @return true if playback has finished, false otherwise.
|
||||
*/
|
||||
bool_t audioStreamPSPIsFinished(audiostream_t *stream);
|
||||
Reference in New Issue
Block a user