SPU2-X: Delay starting voices for 4 SPU2 cycles after key on. No idea if this is right, but there must be a reason some register writes aren't effective for a few cycles after key on, and this seems likely. Fixes DQ5 adventure log music and Le Mans 24 Hours everything.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5418 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1@gmail.com 2012-09-21 15:17:16 +00:00
parent 636ce9fc1d
commit f1cffa6f7f
3 changed files with 28 additions and 8 deletions

View File

@ -189,7 +189,9 @@ struct V_Voice
// sample position within the current decoded packet.
s32 SCurrent;
void Start();
// it takes a few ticks for voices to start on the real SPU2?
void QueueStart();
bool Start();
void Stop();
};
@ -436,6 +438,8 @@ struct V_Core
u32 MADR;
u32 TADR;
u32 KeyOn; // not the KON register (though maybe it is)
StereoOut32 downbuf[8];
StereoOut32 upbuf[8];
int dbpos, ubpos;

View File

@ -25,7 +25,7 @@ namespace Savestate
// versioning for saves.
// Increment this when changes to the savestate system are made.
static const u32 SAVE_VERSION = 0x000b;
static const u32 SAVE_VERSION = 0x000c;
static void wipe_the_cache()
{

View File

@ -303,7 +303,16 @@ void V_Core::UpdateEffectsBufferSize()
RevBuffers.MIX_DEST_B1 = EffectsBufferIndexer( Revb.MIX_DEST_B1 );
}
void V_Voice::Start()
void V_Voice::QueueStart()
{
if (Cycles - PlayCycle < 4)
{
printf(" *** KeyOn after less than 4 T disregarded.\n");
}
PlayCycle = Cycles;
}
bool V_Voice::Start()
{
if((Cycles-PlayCycle)>=4)
{
@ -316,7 +325,6 @@ void V_Voice::Start()
ADSR.Releasing = false;
ADSR.Value = 1;
ADSR.Phase = 1;
PlayCycle = Cycles;
SCurrent = 28;
LoopMode = 0;
LoopFlags = 0;
@ -327,11 +335,10 @@ void V_Voice::Start()
PV1 = PV2 = 0;
PV3 = PV4 = 0;
NextCrest = -0x8000;
return true;
}
else
{
printf(" *** KeyOn after less than 4 T disregarded.\n");
}
return false;
}
void V_Voice::Stop()
@ -421,6 +428,13 @@ __forceinline void TimeUpdate(u32 cClocks)
lClocks += TickInterval;
Cycles++;
for (int i = 0; i < 2; i++)
if (Cores[i].KeyOn)
for (int j = 0; j < 24; j++)
if (Cores[i].KeyOn >> j & 1)
if (Cores[i].Voices[j].Start())
Cores[i].KeyOn &= ~(1 << j);
// Note: IOP does not use MMX regs, so no need to save them.
//SaveMMXRegs();
Mix();
@ -1528,11 +1542,13 @@ void StartVoices(int core, u32 value)
Cores[core].Regs.ENDX &= ~value;
Cores[core].KeyOn |= value;
for( u8 vc=0; vc<V_Core::NumVoices; vc++ )
{
if( !((value>>vc) & 1) ) continue;
Cores[core].Voices[vc].Start();
Cores[core].Voices[vc].QueueStart();
if( IsDevBuild )
{