From 3229b93673a69ca1cf6c96e4e8e0478933bebcb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 22 Aug 2019 23:40:38 +0200 Subject: [PATCH] SasAudio: Cap the cycle estimate at 1200 to prevent crackling in FFT. Fixes #9956. --- Core/HW/SasAudio.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index 2758759f2d..e36bdd1c1b 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -413,7 +413,9 @@ int SasInstance::EstimateMixUs() { } // Each voice costs extra time, and each byte of grain costs extra time. - return 20 + voicesPlayingCount * 68 + (grainSize * 60) / 100; + int cycles = 20 + voicesPlayingCount * 68 + (grainSize * 60) / 100; + // Cap to 1200 to fix FFT, see issue #9956. + return std::min(cycles, 1200); } void SasVoice::ReadSamples(s16 *output, int numSamples) {