X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fdfsound%2Fspu.c;h=b866cff64c45885b1c7abae6ed649c5dd52afef6;hp=cb639b26d07d4289cfedb5a7eb2ff040fc5aaee5;hb=77d6fd631e4c4efc26333ae43888855b9961493e;hpb=a3ed191507a8162f676f92b44dd61eb5e14d2194 diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index cb639b26..b866cff6 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -108,9 +108,10 @@ int bSPUIsOpen=0; static pthread_t thread = (pthread_t)-1; // thread id (linux) -unsigned long dwNewChannel=0; // flags for faster testing, if new channel starts -unsigned long dwChannelOn=0; -unsigned long dwPendingChanOff=0; +unsigned int dwNewChannel=0; // flags for faster testing, if new channel starts +unsigned int dwChannelOn=0; // not silent channels +unsigned int dwPendingChanOff=0; +unsigned int dwChannelDead=0; // silent+not useful channels void (CALLBACK *irqCallback)(void)=0; // func of main emu, called on spu irq void (CALLBACK *cddavCallback)(unsigned short,unsigned short)=0; @@ -453,14 +454,12 @@ static int decode_block(int ch) int ret = 0; start=s_chan[ch].pCurr; // set up the current pos - if(start == (unsigned char*)-1 || // special "stop" sign - (dwPendingChanOff&(1< turn everything off dwPendingChanOff&=~(1< and done for this channel } //////////////////////////////////////////// irq check @@ -495,8 +494,11 @@ static int decode_block(int ch) start = s_chan[ch].pLoop; } - if (start - spuMemC >= 0x80000) - start = (unsigned char*)-1; + if (start - spuMemC >= 0x80000) { + // most likely wrong + start = spuMemC; + printf("ch%d oflow\n", ch); + } s_chan[ch].pCurr = start; // store values for next cycle @@ -697,7 +699,7 @@ static void *MAINThread(void *arg) { int volmult = iVolume; int ns,ns_from,ns_to; - int ch,d; + int ch,d,silentch; int bIRQReturn=0; while(!bEndThread) // until we are shutting down @@ -737,6 +739,8 @@ static void *MAINThread(void *arg) ch=lastch; ns_from=lastns; lastch=-1; // -> setup all kind of vars to continue } + silentch=~(dwChannelOn|dwNewChannel); + //--------------------------------------------------// //- main channel loop -// //--------------------------------------------------// @@ -762,6 +766,8 @@ static void *MAINThread(void *arg) bIRQReturn=1; lastch=ch; lastns=ns_to=d; + if(d==0) + break; } MixADSR(ch, ns_from, ns_to); @@ -780,9 +786,8 @@ static void *MAINThread(void *arg) if(!bIRQReturn && (spuCtrl&CTRL_IRQ)) for(ch=0;ch pSpuIrq && s_chan[ch].pLoop > pSpuIrq) continue; @@ -799,7 +804,7 @@ static void *MAINThread(void *arg) if(start == s_chan[ch].pCurr) { // looping on self - s_chan[ch].pCurr=(unsigned char *)-1; + dwChannelDead|=1<