From 155c96c0aaeb0ea4432fa1702b07c9d1ecb02d4b Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Thu, 25 Feb 2010 05:32:51 +0000 Subject: [PATCH] SPU2-X: - Pseudonym made the voice free-run system a bit faster. Also fixes some odd sound skips introduced with the first version of this fix. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2636 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/spu2-x/src/Mixer.cpp | 40 ++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/plugins/spu2-x/src/Mixer.cpp b/plugins/spu2-x/src/Mixer.cpp index 4d80697225..caf826eb29 100644 --- a/plugins/spu2-x/src/Mixer.cpp +++ b/plugins/spu2-x/src/Mixer.cpp @@ -257,6 +257,39 @@ _Increment: return vc.SBuffer[vc.SCurrent++]; } +static __forceinline void __fastcall GetNextDataDummy(V_Core& thiscore, uint voiceidx) +{ + V_Voice& vc( thiscore.Voices[voiceidx] ); + + if( vc.SCurrent == 28 ) + { + if(vc.LoopFlags & XAFLAG_LOOP_END) + { + thiscore.Regs.ENDX |= (1 << voiceidx); + + if( vc.LoopFlags & XAFLAG_LOOP ) + vc.NextA = vc.LoopStartA; + else + vc.Stop(); + } + + vc.LoopFlags = *GetMemPtr(vc.NextA&0xFFFFF) >> 8; // grab loop flags from the upper byte. + + vc.SCurrent = 0; + if( (vc.LoopFlags & XAFLAG_LOOP_START) && !vc.LoopMode ) + vc.LoopStartA = vc.NextA; + + goto _Increment; + } + + if( (vc.SCurrent&3) == 3 ) + { +_Increment: + IncrementNextA( thiscore, vc ); + } + vc.SCurrent++; +} + ///////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// // // @@ -523,11 +556,10 @@ static __forceinline StereoOut32 MixVoice( uint coreidx, uint voiceidx ) else { // Continue processing voice, even if it's "off". Or else we miss interrupts! (Fatal Frame engine died because of this.) - // Slow, complete version UpdatePitch(coreidx, voiceidx); - while (vc.SP > 0) { - GetNextDataBuffered(thiscore, voiceidx); - vc.SP -= 4096; + while (vc.SP > 0) { + GetNextDataDummy(thiscore, voiceidx); // Dummy is enough + vc.SP -= 4096; } // Write-back of raw voice data (some zeros since the voice is "dead")