Files
goldeneye-pc-port/port/include/audio.h
T
James Dansereauanditaloarruda b735190fd9 Input and audio features D469-D472
Gamepad presets and per-seat rebinding (D469, building on
italoarruda's #109), master volume and output
device (D470), controller-family button names and player LEDs (D471), F10
owner-pad input and widescreen pillarbox polish (D472).

Refs: D469 D470 D471 D472

Co-authored-by: italoarruda <3868006+italoarruda@users.noreply.github.com>
2026-10-06 18:35:41 -04:00

49 lines
1.6 KiB
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);
/* D204/F1: emulate the N64 AI_LEN_REG -- bytes remaining in the buffer the
* DAC is *currently* playing, NOT the whole queue depth. src/audi.c does
* arithmetic on this value that only holds inside the N64's range. */
u32 audioGetAiLengthBytes(void);
/* Queue the next block of mixed samples (len is in bytes). */
void audioSetNextBuffer(const s16 *buf, u32 len);
/* D470: output-device selection. audioDeviceRefresh() re-enumerates and
* returns the count; audioDeviceName(i) is valid until the next refresh.
* audioDeviceRequest("") = system default. The switch itself is applied on
* the audio thread. audioNotifyDeviceRemoved() is for SDL_AUDIODEVICEREMOVED. */
int audioDeviceRefresh(void);
const char *audioDeviceName(int i);
const char *audioDeviceCurrentName(void);
void audioDeviceRequest(const char *name);
void audioNotifyDeviceRemoved(u32 which);
#ifdef __cplusplus
}
#endif
#endif /* PORT_AUDIO_H */