Rewrite Dolphin audio to use libogc's standard ASND API
Replaces the ansnd-based backend (a third-party library with a custom DSP ucode Dolphin's HLE audio emulation doesn't recognize, requiring -a LLE as a workaround) with libogc's own asndlib - the standard, HLE-supported audio API most GC/Wii homebrew already uses. Also fixes three real bugs found while getting a large (41MB) WAV asset actually playing on Dolphin: - audiostreamdolphin.c previously buffered a stream's entire loop segment into one allocation up front (inherited from the ansnd design) - fine for a short test tone, but an out-of-memory crash for a real multi-minute track on GameCube's 24MB (or even Wii's 88MB) total RAM. Rewritten to stream bounded windows via ASND's real double-buffer primitives (ASND_SetVoice + ASND_AddVoice, polled from the main thread - never from an interrupt callback), matching how Linux/PSP already work. - ASND_TestVoiceBufferReady() returns SND_OK (0) when ready and SND_BUSY (1) when not, in the actual toolchain fork (extremscorner/libogc2) this project builds against - opposite of a plain boolean. Treating the raw result as one meant a genuinely ready voice's SND_OK read as false, silently skipping every ASND_AddVoice() call forever after a stream's first buffered window. - audioStreamPcmRead()'s 16-bit fast path read WAV's little-endian sample bytes straight into the output buffer with no byte-swap - correct by coincidence on every little-endian platform this engine targets (Linux, PSP), but reversed every sample's bytes on Dolphin/GameCube/Wii's big-endian PowerPC. libmad is GPL-licensed (see audiostreammp3decodersw.h's own note from the prior MP3 change); libogc's asndlib is under a permissive BSD-style license, so this doesn't add another such dependency. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -61,7 +61,7 @@ target_link_libraries(${DUSK_LIBRARY_TARGET_NAME} PRIVATE
|
||||
zstd
|
||||
z
|
||||
lzma
|
||||
ansnd
|
||||
asnd
|
||||
mad
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user