From d4753076e89d42cdad4a4f1ca4688fad3c56d873 Mon Sep 17 00:00:00 2001 From: gameblabla Date: Sat, 5 Oct 2019 03:04:57 +0200 Subject: Port the libretro core and make it standalone. TODO : - Input should use our config file instead. - Missing audio in some games. (Star Ocean, doesn't happen with stock retroarch code. Odd...) --- shell/audio/portaudio/sound_output.c | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 shell/audio/portaudio/sound_output.c (limited to 'shell/audio/portaudio/sound_output.c') diff --git a/shell/audio/portaudio/sound_output.c b/shell/audio/portaudio/sound_output.c new file mode 100644 index 0000000..226db5c --- /dev/null +++ b/shell/audio/portaudio/sound_output.c @@ -0,0 +1,41 @@ +#include +#include +#include + +#include "shared.h" + +static PaStream *apu_stream; + +uint32_t Audio_Init() +{ + Pa_Initialize(); + + PaStreamParameters outputParameters; + + outputParameters.device = Pa_GetDefaultOutputDevice(); + + if (outputParameters.device == paNoDevice) + { + printf("No sound output\n"); + return 1; + } + + outputParameters.channelCount = 2; + outputParameters.sampleFormat = paInt16; + outputParameters.hostApiSpecificStreamInfo = NULL; + + Pa_OpenStream( &apu_stream, NULL, &outputParameters, SOUND_OUTPUT_FREQUENCY, SOUND_SAMPLES_SIZE, paNoFlag, NULL, NULL); + Pa_StartStream( apu_stream ); + + return 0; +} + +void Audio_Write(int16_t* restrict buffer, uint32_t buffer_size) +{ + Pa_WriteStream( apu_stream, buffer, buffer_size); +} + +void Audio_Close() +{ + //Pa_Close(); +} -- cgit v1.2.3