From 6628042fe386197648334063f70e6a94350b9bf7 Mon Sep 17 00:00:00 2001 From: BearOso Date: Mon, 11 Apr 2022 16:04:29 -0500 Subject: [PATCH] libretro: Get audio samples during frame callback. --- libretro/libretro.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 691b3331..8273399d 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -1833,16 +1833,6 @@ void retro_run() poll_cb(); report_buttons(); S9xMainLoop(); - - static std::vector audio_buffer; - - size_t avail = S9xGetSampleCount(); - - if (audio_buffer.size() < avail) - audio_buffer.resize(avail); - - S9xMixSamples((uint8*)&audio_buffer[0], avail); - audio_batch_cb(&audio_buffer[0], avail >> 1); } void retro_deinit() @@ -2067,6 +2057,16 @@ bool8 S9xDeinitUpdate(int width, int height) video_cb(GFX.Screen + ((int)(GFX.Pitch >> 1) * overscan_offset), width, height, GFX.Pitch); } + static std::vector audio_buffer; + + size_t avail = S9xGetSampleCount(); + + if (audio_buffer.size() < avail) + audio_buffer.resize(avail); + + S9xMixSamples((uint8*)&audio_buffer[0], avail); + audio_batch_cb(&audio_buffer[0], avail >> 1); + return TRUE; }