From e74ebc3027f837cea593b32aaf7eee170aad4a4b Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Tue, 10 Jul 2012 22:22:32 +0200 Subject: [PATCH] Set audio buffer size to snd.buffer_size * 2 * 2 --- libretro/libretro.c | 6 +++++- libretro/osd.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libretro/libretro.c b/libretro/libretro.c index 38cc607..0915a84 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -267,6 +267,7 @@ static const double ntsc_fps = 53693175.0 / (3420.0 * 262.0); static void init_audio(void) { audio_init(32000, vdp_pal ? pal_fps : ntsc_fps); + soundbuffer = malloc(snd.buffer_size * 2 * 2); } static void configure_controls(void) @@ -804,6 +805,9 @@ void retro_unload_game(void) { if (system_hw == SYSTEM_MCD) slot_autosave(0); + + if (soundbuffer) + free(soundbuffer); } unsigned retro_get_region(void) { return vdp_pal ? RETRO_REGION_PAL : RETRO_REGION_NTSC; } @@ -907,7 +911,7 @@ void retro_deinit(void) void retro_reset(void) { gen_reset(0); } -int16 soundbuffer[1920]; +int16 *soundbuffer; void osd_input_update(void) { diff --git a/libretro/osd.h b/libretro/osd.h index e056150..42a68bd 100644 --- a/libretro/osd.h +++ b/libretro/osd.h @@ -104,7 +104,7 @@ extern char MS_BIOS_US[256]; extern char MS_BIOS_EU[256]; extern char MS_BIOS_JP[256]; -extern int16 soundbuffer[1920]; +extern int16 *soundbuffer; #define VERSION "Genesis Plus GX 1.7.0 (libretro)"