From 7924fed36930cc2fa7ae9882a2e739ae68ba2b25 Mon Sep 17 00:00:00 2001 From: gm-matthew <108370479+gm-matthew@users.noreply.github.com> Date: Wed, 5 Jul 2023 02:45:35 +0100 Subject: [PATCH] Set soundboard CPU to correct clock speed The 68K on the soundboard is rated at 12 MHz but runs at 11.2896 MHz, which is 256 cycles/sample with a 44100 Hz sample rate. Removed SoundClock and Freq as they are not needed --- Src/Sound/SCSP.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Src/Sound/SCSP.cpp b/Src/Sound/SCSP.cpp index 249fd8c..89e2c99 100644 --- a/Src/Sound/SCSP.cpp +++ b/Src/Sound/SCSP.cpp @@ -88,8 +88,6 @@ bool legacySound; // For LegacySound (SCSP DSP) config option. //#define CORRECT_FOR_18BIT_DAC // These globals control the operation of the SCSP, they are no longer extern and are set through SCSP_SetBuffers(). --Bart -static double SoundClock; // Originally titled SysFPS; seems to be for the sound CPU. -static const double Freq = 76; static float* bufferfl; static float* bufferfr; static float* bufferrl; @@ -606,7 +604,6 @@ bool SCSP_Init(const Util::Config::Node &config, int n) s_config = &config; s_multiThreaded = config["MultiThreaded"].ValueAs(); legacySound = config["LegacySoundDSP"].ValueAs(); - SoundClock = Freq; if(n==2) { @@ -1516,7 +1513,7 @@ void SCSP_CpuRunScanline() void SCSP_DoMasterSamples(int nsamples) { - int slice = (int)(12000000. / (SoundClock*nsamples)); // 68K cycles/sample + const int slice = 11289600 / 44100; // 68K runs at 256 cycles/sample static int lastdiff = 0; /* @@ -2130,7 +2127,6 @@ void SCSP_LoadState(CBlockFile *StateFile) void SCSP_SetBuffers(float *leftBufferPtr, float *rightBufferPtr, float* leftRearBufferPtr, float* rightRearBufferPtr, int bufferLength) { - SoundClock = Freq; bufferfl = leftBufferPtr; bufferfr = rightBufferPtr; bufferrl = leftRearBufferPtr;