From b00afb7734d75d4e625db0263548fa15b9aa0af7 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 9 Feb 2011 14:34:15 +0200 Subject: dfsound: backport fixes from pcsxr shalma: - Align start addresses to 16-bytes - (Hopkat) registers.c - External loop address align to 16 bytes - SoundOff prevents new channel from starting - fixes Jungle Book (buzzing loop hangs) --- plugins/dfsound/registers.c | 17 +++++++++++++++-- plugins/dfsound/spu.c | 7 ++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c index b684914..5ab519b 100644 --- a/plugins/dfsound/registers.c +++ b/plugins/dfsound/registers.c @@ -70,7 +70,8 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val) break; //------------------------------------------------// start case 6: - s_chan[ch].pStart=spuMemC+((unsigned long) val<<3); + // Brain Dead 13 - align to 16 boundary + s_chan[ch].pStart= spuMemC+(unsigned long)((val<<3)&~0xf); break; //------------------------------------------------// level with pre-calcs case 8: @@ -162,7 +163,7 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val) //------------------------------------------------// case 14: // loop? //WaitForSingleObject(s_chan[ch].hMutex,2000); // -> no multithread fuckups - s_chan[ch].pLoop=spuMemC+((unsigned long) val<<3); + s_chan[ch].pLoop=spuMemC+((unsigned long)((val<<3)&~0xf)); s_chan[ch].bIgnoreLoop=1; //ReleaseMutex(s_chan[ch].hMutex); // -> oki, on with the thread break; @@ -424,6 +425,13 @@ void SoundOn(int start,int end,unsigned short val) // SOUND ON PSX COMAND { s_chan[ch].bIgnoreLoop=0; s_chan[ch].bNew=1; + + // do this here, not in StartSound + // - fixes fussy timing issues + s_chan[ch].bStop=0; + s_chan[ch].bOn=1; + s_chan[ch].pCurr=s_chan[ch].pStart; + dwNewChannel|=(1<