SPU2-X: Use zero coefficients when the sample data references a higher entry in the coefficients table than we know about and print a warning to the console if logging is enabled. Fixes audio glitches in "Crash" series games. Also fixed the voice stop log, it was printing when voices looped.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5402 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1@gmail.com 2012-09-03 11:43:16 +00:00
parent 7e528d3f1f
commit 4ab5b03bdc
1 changed files with 11 additions and 6 deletions

View File

@ -19,7 +19,7 @@
void ADMAOutLogWrite(void *lpData, u32 ulSize); void ADMAOutLogWrite(void *lpData, u32 ulSize);
static const s32 tbl_XA_Factor[5][2] = static const s32 tbl_XA_Factor[16][2] =
{ {
{ 0, 0 }, { 0, 0 },
{ 60, 0 }, { 60, 0 },
@ -76,8 +76,11 @@ static void __forceinline XA_decode_block(s16* buffer, const s16* block, s32& pr
{ {
const s32 header = *block; const s32 header = *block;
const s32 shift = (header&0xF)+16; const s32 shift = (header&0xF)+16;
const s32 pred1 = tbl_XA_Factor[(header>> 4)&0xF][0]; const int id = header >> 4 & 0xF;
const s32 pred2 = tbl_XA_Factor[(header>> 4)&0xF][1]; if (id > 4 && MsgToConsole())
ConLog("* SPU2-X: Unknown ADPCM coefficients table id %d\n", id);
const s32 pred1 = tbl_XA_Factor[id][0];
const s32 pred2 = tbl_XA_Factor[id][1];
const s8* blockbytes = (s8*)&block[1]; const s8* blockbytes = (s8*)&block[1];
const s8* blockend = &blockbytes[13]; const s8* blockend = &blockbytes[13];
@ -156,11 +159,13 @@ static __forceinline s32 GetNextDataBuffered( V_Core& thiscore, uint voiceidx )
thiscore.Regs.ENDX |= (1 << voiceidx); thiscore.Regs.ENDX |= (1 << voiceidx);
vc.NextA = vc.LoopStartA | 1; vc.NextA = vc.LoopStartA | 1;
if (!(vc.LoopFlags & XAFLAG_LOOP)) if (!(vc.LoopFlags & XAFLAG_LOOP))
{
vc.Stop(); vc.Stop();
if( IsDevBuild ) if( IsDevBuild )
{ {
if(MsgVoiceOff()) ConLog("* SPU2-X: Voice Off by EndPoint: %d \n", voiceidx); if(MsgVoiceOff()) ConLog("* SPU2-X: Voice Off by EndPoint: %d \n", voiceidx);
}
} }
} }
else else