From f5df9147d46216814d91b0b902307329833ae5c2 Mon Sep 17 00:00:00 2001 From: "SND\\notaz_cp" Date: Wed, 9 Jan 2013 01:51:10 +0000 Subject: spu: do bIRQReturn on sample boundaries fixes crackling on one of the channels (Chrono Cross) git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@82137 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- plugins/dfsound/freeze.c | 4 +-- plugins/dfsound/spu.c | 70 +++++++++++++++++++++++------------------------- 2 files changed, 35 insertions(+), 39 deletions(-) (limited to 'plugins') diff --git a/plugins/dfsound/freeze.c b/plugins/dfsound/freeze.c index 82d700af..268e03ef 100755 --- a/plugins/dfsound/freeze.c +++ b/plugins/dfsound/freeze.c @@ -56,7 +56,7 @@ typedef struct void LoadStateV5(SPUFreeze_t * pF); // newest version void LoadStateUnknown(SPUFreeze_t * pF); // unknown format -extern int lastch; +extern int lastns; //////////////////////////////////////////////////////////////////////// // SPUFREEZE: called by main emu on savestate load/save @@ -141,7 +141,7 @@ long CALLBACK SPUfreeze(uint32_t ulFreezeMode,SPUFreeze_t * pF) LoadStateV5(pF); else LoadStateUnknown(pF); - lastch = -1; + lastns = 0; // repair some globals for(i=0;i<=62;i+=2) diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index a0130224..c19be6e9 100755 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -155,8 +155,7 @@ int iFMod[NSSIZE]; int iCycle = 0; short * pS; -int lastch=-1; // last channel processed on spu irq in timer mode -static int lastns=0; // last ns pos +int lastns=0; // last ns pos static int iSecureStart=0; // secure start counter //////////////////////////////////////////////////////////////////////// @@ -603,19 +602,20 @@ static void *MAINThread(void *arg) if(dwNewChannel) iSecureStart=1; // if a new channel kicks in (or, of course, sound buffer runs low), we will leave the loop } + ns=0; + //--------------------------------------------------// continue from irq handling in timer mode? - if(lastch>=0) // will be -1 if no continue is pending + if(lastns>0) // will be 0 if no continue is pending { - ch=lastch; ns=lastns; lastch=-1; // -> setup all kind of vars to continue - goto GOON; // -> directly jump to the continue point + ns=lastns; // -> setup all kind of vars to continue + lastns=0; } //--------------------------------------------------// //- main channel loop -// //--------------------------------------------------// { - ns=0; decoded_voice = decoded_ptr; while(ns