forked from Ports/goldeneye-pc-port
Software RSP-audio-ucode mixer (macro-swap aXxx -> Impl functions, PD-port pattern) makes libaudio output audible on PC. Alongside it, two pointer-width bugs surfaced by exercising the audio path for the first time: - D198: alAdpcmPull/_decodeChunk used K0_TO_PHYS (N64 kseg0 mask) on 64-bit heap pointers; switched to osVirtualToPhysical like every sibling call site. - D201: bnkf.c bank/inst/sound/wavetable relocation offsets were s32, truncating the real 64-bit base pointer for ~50% of allocations; widened to uintptr_t. - D200 (already committed-pending from a prior session): reverb's ALDelay u32 negative indices zero-extended into +4GB offsets on 64-bit; (s32)/(s64) casts match PD ground truth. - D199: documents the mixer's aSetBuffer persistent-DMEM-context design, reconstructed from call-site pairs (no RSP disassembly to check against) since there's no N64 audio ucode source to reference. - D195/D197 (playtest reports referenced by an earlier HANDOFF note but never written into findings.md): backfilled as OPEN with next steps. Verified: ./build-pc.sh ntsc-final links clean; -level_09 runs 600+ frames crash-free with music + SFX audible.
34 lines
818 B
C
34 lines
818 B
C
#ifndef PORT_AUDIO_H
|
|
#define PORT_AUDIO_H
|
|
|
|
/*
|
|
* Audio: SDL audio device + buffer queueing.
|
|
* Modelled on the PD port's port/include/audio.h.
|
|
*
|
|
* libaudio (AL) runs on the CPU and produces mixed s16 stereo output. The AI
|
|
* (osAiSetNextBuffer / osAiGetLength / osAiSetFrequency) is mapped onto this
|
|
* layer, which queues the mixed samples to the SDL audio device.
|
|
*/
|
|
|
|
#include <PR/ultratypes.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Initialize the SDL audio device. Returns 0 on success. */
|
|
int audioInit(void);
|
|
void audioDestroy(void);
|
|
|
|
/* Number of samples (stereo s16 frames) currently queued. */
|
|
s32 audioGetSamplesBuffered(void);
|
|
|
|
/* Queue the next block of mixed samples (len is in bytes). */
|
|
void audioSetNextBuffer(const s16 *buf, u32 len);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PORT_AUDIO_H */
|