From c07a38e59c093af21f1eded7039bfcab09c8eb00 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Sat, 26 Oct 2013 10:31:03 -0700 Subject: [PATCH] Eliminated an extra 64 sample skip from seeking when playing at the native sample rate --- Frameworks/GME/gme/Spc_Emu.cpp | 11 ++++++++--- Frameworks/GME/gme/Spc_Sfm.cpp | 13 +++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Frameworks/GME/gme/Spc_Emu.cpp b/Frameworks/GME/gme/Spc_Emu.cpp index 32f5c52f2..7913c3883 100644 --- a/Frameworks/GME/gme/Spc_Emu.cpp +++ b/Frameworks/GME/gme/Spc_Emu.cpp @@ -423,9 +423,14 @@ blargg_err_t Spc_Emu::skip_( int count ) } // eliminate pop due to resampler - const int resampler_latency = 64; - sample_t buf [resampler_latency]; - return play_( resampler_latency, buf ); + if ( sample_rate() != native_sample_rate ) + { + const int resampler_latency = 64; + sample_t buf [resampler_latency]; + return play_( resampler_latency, buf ); + } + + return blargg_ok; } blargg_err_t Spc_Emu::play_( int count, sample_t out [] ) diff --git a/Frameworks/GME/gme/Spc_Sfm.cpp b/Frameworks/GME/gme/Spc_Sfm.cpp index d21c32f99..3e00eebef 100644 --- a/Frameworks/GME/gme/Spc_Sfm.cpp +++ b/Frameworks/GME/gme/Spc_Sfm.cpp @@ -532,10 +532,15 @@ blargg_err_t Sfm_Emu::skip_( int count ) filter.clear(); } - // eliminate pop due to resampler - const int resampler_latency = 64; - sample_t buf [resampler_latency]; - return play_( resampler_latency, buf ); + if ( sample_rate() != native_sample_rate ) + { + // eliminate pop due to resampler + const int resampler_latency = 64; + sample_t buf [resampler_latency]; + return play_( resampler_latency, buf ); + } + + return blargg_ok; } blargg_err_t Sfm_Emu::play_( int count, sample_t out [] )