X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fdfsound%2Fxa.c;h=e58bca2e923dd1f91e4803b4caa6cf00920d90e5;hp=b1efe10dd516fdb9b10c8172b4694a3be802f5f2;hb=1d753163fcfe8f75fad07c413ebbdb8cfe448f8b;hpb=983a7cfdccceaa612267a1b045110b4f831d1495 diff --git a/plugins/dfsound/xa.c b/plugins/dfsound/xa.c index b1efe10d..e58bca2e 100644 --- a/plugins/dfsound/xa.c +++ b/plugins/dfsound/xa.c @@ -22,8 +22,6 @@ // will be included from spu.c #ifdef _IN_SPU -#define XA_HACK - //////////////////////////////////////////////////////////////////////// // XA GLOBALS //////////////////////////////////////////////////////////////////////// @@ -61,42 +59,46 @@ static int gauss_window[8] = {0, 0, 0, 0, 0, 0, 0, 0}; INLINE void MixXA(void) { int ns; - uint32_t l; + short l, r; + uint32_t v; + int cursor = decode_pos; - for(ns=0;ns>16)&0xffff)) * iRightXAVol)/32768; -#else - SSumLR[ns++]+=(((short)(XALastVal&0xffff)) * iLeftXAVol)/32767; - SSumLR[ns++]+=(((short)((XALastVal>>16)&0xffff)) * iRightXAVol)/32767; -#endif - } - - if(XAPlay==XAFeed && XARepeat) - { + if(XAPlay != XAFeed || XARepeat > 0) + { + if(XAPlay == XAFeed) XARepeat--; - for(;ns>16)&0xffff)) * iRightXAVol)/32768; -#else - SSumLR[ns++]+=(((short)(XALastVal&0xffff)) * iLeftXAVol)/32767; - SSumLR[ns++]+=(((short)((XALastVal>>16)&0xffff)) * iRightXAVol)/32767; -#endif - } - } + + v = XALastVal; + for(ns=0;ns> 15; + r = ((int)(short)(v >> 16) * iLeftXAVol) >> 15; + SSumLR[ns++] += l; + SSumLR[ns++] += r; + + spuMem[cursor] = v; + spuMem[cursor + 0x400/2] = v >> 16; + cursor = (cursor + 1) & 0x1ff; + } + XALastVal = v; + } for(ns=0;ns> 15; - SSumLR[ns++]+=(((short)((l>>16)&0xffff)) * iRightXAVol) >> 15; + + l = ((int)(short)v * iLeftXAVol) >> 15; + r = ((int)(short)(v >> 16) * iLeftXAVol) >> 15; + SSumLR[ns++] += l; + SSumLR[ns++] += r; + + spuMem[cursor] = v; + spuMem[cursor + 0x400/2] = v >> 16; + cursor = (cursor + 1) & 0x1ff; } } @@ -104,7 +106,7 @@ INLINE void MixXA(void) // small linux time helper... only used for watchdog //////////////////////////////////////////////////////////////////////// -unsigned long timeGetTime_spu() +static unsigned long timeGetTime_spu() { struct timeval tv; gettimeofday(&tv, 0); // well, maybe there are better ways