From c6b0535999e20c7cb9f84e728cdb00dace9d1fcc Mon Sep 17 00:00:00 2001 From: bladeoner Date: Fri, 12 Apr 2019 21:24:23 +0200 Subject: [PATCH] Snes9x - Revert to higher APU clock. (#841) --- source/snes9x/apu/apu.cpp | 10 +++++----- source/snes9x/msu1.cpp | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/snes9x/apu/apu.cpp b/source/snes9x/apu/apu.cpp index 383b37a..64cefbb 100644 --- a/source/snes9x/apu/apu.cpp +++ b/source/snes9x/apu/apu.cpp @@ -15,10 +15,10 @@ #define APU_DEFAULT_INPUT_RATE 32040 #define APU_MINIMUM_SAMPLE_COUNT 512 #define APU_MINIMUM_SAMPLE_BLOCK 128 -#define APU_NUMERATOR_NTSC 5632 -#define APU_DENOMINATOR_NTSC 118125 -#define APU_NUMERATOR_PAL 35527 -#define APU_DENOMINATOR_PAL 738343 +#define APU_NUMERATOR_NTSC 15664 +#define APU_DENOMINATOR_NTSC 328125 +#define APU_NUMERATOR_PAL 34176 +#define APU_DENOMINATOR_PAL 709379 SNES_SPC *spc_core = NULL; @@ -314,7 +314,7 @@ void UpdatePlaybackRate (void) if (Settings.MSU1) { - time_ratio = (44100.0 / Settings.SoundPlaybackRate) * (Settings.SoundInputRate / 32000.0); + time_ratio = (44100.0 / Settings.SoundPlaybackRate) * (Settings.SoundInputRate / 32040.0); msu::resampler->time_ratio(time_ratio); } } diff --git a/source/snes9x/msu1.cpp b/source/snes9x/msu1.cpp index 752e3ec..9829a63 100644 --- a/source/snes9x/msu1.cpp +++ b/source/snes9x/msu1.cpp @@ -237,7 +237,7 @@ void S9xMSU1Generate(size_t sample_count) { partial_frames += 4410 * (sample_count / 2); - while ((bufPos < (bufEnd - 2)) && partial_frames >= 3200) + while ((bufPos < (bufEnd - 2)) && partial_frames >= 3204) { if (MSU1.MSU1_STATUS & AudioPlaying && audioStream) { @@ -255,7 +255,7 @@ void S9xMSU1Generate(size_t sample_count) *(bufPos++) = *left; *(bufPos++) = *right; MSU1.MSU1_AUDIO_POS += 4; - partial_frames -= 3200; + partial_frames -= 3204; } else if (bytes_read >= 0) @@ -279,7 +279,7 @@ void S9xMSU1Generate(size_t sample_count) else { MSU1.MSU1_STATUS &= ~(AudioPlaying | AudioRepeating); - partial_frames -= 3200; + partial_frames -= 3204; *(bufPos++) = 0; *(bufPos++) = 0; }