diff options
author | gameblabla | 2019-10-05 03:04:57 +0200 |
---|---|---|
committer | gameblabla | 2019-10-05 03:04:57 +0200 |
commit | d4753076e89d42cdad4a4f1ca4688fad3c56d873 (patch) | |
tree | c8641cf282f427d9329db00325e16609acca8663 /shell/audio/portaudio | |
parent | 943821f94b9b2e22315fce876c2e369da7a79bcf (diff) | |
download | snesemu-d4753076e89d42cdad4a4f1ca4688fad3c56d873.tar.gz snesemu-d4753076e89d42cdad4a4f1ca4688fad3c56d873.tar.bz2 snesemu-d4753076e89d42cdad4a4f1ca4688fad3c56d873.zip |
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...)
Diffstat (limited to 'shell/audio/portaudio')
-rw-r--r-- | shell/audio/portaudio/sound_output.c | 41 |
1 files changed, 41 insertions, 0 deletions
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 <portaudio.h> +#include <stdint.h> +#include <stdio.h> + +#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(); +} |