Runaway voices should be faster with this. My previous ideas for optimising this were based on the principles that there's no way a game could rely on this feature other than requiring interrupts to fire when the muted voice hits the interrupt address. Well... Fatal Frame 2 proved me wrong. SPU2 interrupts aren't even enabled. I have no idea what it's doing.

Rougher granularity than this probably doesn't break anything, this is the finest that should have observable effects.

Not running voices when they're in a special sentinel block may also help games... but not Fatal Frame 2.  It resets the loop register constantly.  I really have no idea what it's playing at and it's driving me crazy.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2637 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1 2010-02-25 07:04:28 +00:00
parent 155c96c0aa
commit a564d4bbae
1 changed files with 11 additions and 12 deletions

View File

@ -261,7 +261,8 @@ static __forceinline void __fastcall GetNextDataDummy(V_Core& thiscore, uint voi
{
V_Voice& vc( thiscore.Voices[voiceidx] );
if( vc.SCurrent == 28 )
// can also be 29 because it's left at 1 after the voice is stopped
if( vc.SCurrent >= 28 )
{
if(vc.LoopFlags & XAFLAG_LOOP_END)
{
@ -269,25 +270,22 @@ static __forceinline void __fastcall GetNextDataDummy(V_Core& thiscore, uint voi
if( vc.LoopFlags & XAFLAG_LOOP )
vc.NextA = vc.LoopStartA;
else
vc.Stop();
// no else, already stopped
}
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;
IncrementNextA(thiscore, vc);
vc.SCurrent = 0;
}
if( (vc.SCurrent&3) == 3 )
{
_Increment:
IncrementNextA( thiscore, vc );
}
vc.SCurrent++;
IncrementNextA(thiscore, vc);
vc.SCurrent += 4;
}
/////////////////////////////////////////////////////////////////////////////////////////
@ -557,9 +555,10 @@ static __forceinline StereoOut32 MixVoice( uint coreidx, uint voiceidx )
{
// Continue processing voice, even if it's "off". Or else we miss interrupts! (Fatal Frame engine died because of this.)
UpdatePitch(coreidx, voiceidx);
while (vc.SP > 0) {
GetNextDataDummy(thiscore, voiceidx); // Dummy is enough
vc.SP -= 4096;
vc.SP -= 16384;
}
// Write-back of raw voice data (some zeros since the voice is "dead")