SPU2-X: Fixed old misunderstanding about the function of the loop bits and documented our findings and unverified suspicions.

Fixes Zero: Akai Chou, Tomb Raider: Legend, Tomb Raider: Anniversary, maybe others.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4735 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1@gmail.com 2011-06-13 00:00:58 +00:00
parent 6a364aa444
commit 4d92ef1f90
1 changed files with 11 additions and 11 deletions

View File

@ -132,6 +132,11 @@ int g_counter_cache_hits = 0;
int g_counter_cache_misses = 0;
int g_counter_cache_ignores = 0;
// LOOP/END sets the ENDX bit and sets NAX to LSA, and the voice is muted if LOOP is not set
// LOOP probably prevents SPU2 from muting the voice when the ENDX bit is set
// (which would explain the requirement that every block in a loop has the LOOP bit set, not just the last)
// LOOP/START sets LSA to NAX unless LSA was written manually since sound generation started
// (see LoopMode, the method by which this is achieved on the real SPU2 is unknown)
#define XAFLAG_LOOP_END (1ul<<0)
#define XAFLAG_LOOP (1ul<<1)
#define XAFLAG_LOOP_START (1ul<<2)
@ -145,20 +150,15 @@ static __forceinline s32 GetNextDataBuffered( V_Core& thiscore, uint voiceidx )
if(vc.LoopFlags & XAFLAG_LOOP_END)
{
thiscore.Regs.ENDX |= (1 << voiceidx);
if( vc.LoopFlags & XAFLAG_LOOP )
{
vc.NextA = vc.LoopStartA;
}
else
{
if (!(vc.LoopFlags & XAFLAG_LOOP))
vc.Stop();
vc.NextA = vc.LoopStartA;
if( IsDevBuild )
{
if(MsgVoiceOff()) ConLog("* SPU2-X: Voice Off by EndPoint: %d \n", voiceidx);
}
}
}
// We'll need the loop flags and buffer pointers regardless of cache status:
// Note to Self : NextA addresses WORDS (not bytes).