From cff27827f7f8dab4d0e5acfc942c2e3107d66f06 Mon Sep 17 00:00:00 2001 From: Daryl Borth Date: Thu, 23 Aug 2018 08:57:30 -0600 Subject: [PATCH] fix audio pop when returning to a game --- source/gcaudio.cpp | 5 ++++- source/gcvideo.cpp | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/gcaudio.cpp b/source/gcaudio.cpp index ad72dc6..ea69870 100644 --- a/source/gcaudio.cpp +++ b/source/gcaudio.cpp @@ -178,7 +178,10 @@ void PlaySound( int32 *Buffer, int count ) void UpdateSampleRate(int rate) { - samplerate = rate; + if(samplerate != rate) { + samplerate = rate; + FCEUI_Sound(samplerate); + } } void SetSampleRate() diff --git a/source/gcvideo.cpp b/source/gcvideo.cpp index 8dea400..447b56e 100644 --- a/source/gcvideo.cpp +++ b/source/gcvideo.cpp @@ -636,7 +636,6 @@ ResetVideo_Emu () { rmode = tvmodes[FCEUI_GetCurrentVidSystem(NULL, NULL)]; UpdateSampleRate(48220); - SetSampleRate(); } else { @@ -648,7 +647,6 @@ ResetVideo_Emu () ResetFbWidth(512, rmode); UpdateSampleRate(48130); - SetSampleRate(); } SetupVideoMode(rmode); // reconfigure VI