From 8b5aa23605230efaea7d5c28fedf7123123875f6 Mon Sep 17 00:00:00 2001 From: gocha Date: Tue, 18 Aug 2009 05:37:20 +0000 Subject: [PATCH] make 'samples' (in SPU.cpp) to be zero at reset (to prevent desyncs) --- desmume/src/SPU.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desmume/src/SPU.cpp b/desmume/src/SPU.cpp index bbc0b92b4..a4e68983a 100644 --- a/desmume/src/SPU.cpp +++ b/desmume/src/SPU.cpp @@ -89,6 +89,8 @@ static u8 precalcindextbl[89][8]; static const double ARM7_CLOCK = 33513982; +static double samples = 0; + ////////////////////////////////////////////////////////////////////////////// template @@ -384,6 +386,8 @@ void SPU_Reset(void) // Reset Registers for (i = 0x400; i < 0x51D; i++) T1WriteByte(MMU.ARM7_REG, i, 0); + + samples = 0; } void SPU_struct::reset() @@ -1009,7 +1013,6 @@ static void SPU_MixAudio(SPU_struct *SPU, int length) //emulates one frame of the cpu core. //this will produce a variable number of samples, calculated to keep a 44100hz output //in sync with the emulator framerate -static double samples = 0; static const double time_per_frame = (double)1.0/((double)ARM7_CLOCK/6/355); //(double)1.0/(double)59.8261; // ((double)ARM7_CLOCK/6/355/263) static const double samples_per_frame = time_per_frame * 44100; int spu_core_samples = 0;