X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fdfsound%2Fxa.c;h=23924d3b1c8f846efcbb89f194c858194a302ab0;hb=73d2a9037e5ea290cac10a9f26860a6405b55a0c;hp=c7a84fd01bca8b21e12cba9cf67a64a8e1c53a88;hpb=acc415b3040edfcc91226955f39b405f09cca430;p=pcsx_rearmed.git diff --git a/plugins/dfsound/xa.c b/plugins/dfsound/xa.c index c7a84fd0..23924d3b 100644 --- a/plugins/dfsound/xa.c +++ b/plugins/dfsound/xa.c @@ -16,6 +16,7 @@ ***************************************************************************/ #include "stdafx.h" +#include "spu.h" #define _IN_XA #include @@ -38,7 +39,7 @@ static int gauss_window[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // MIX XA & CDDA //////////////////////////////////////////////////////////////////////// -INLINE void MixXA(int *SSumLR, int ns_to, int decode_pos) +INLINE void MixXA(int *SSumLR, int *RVB, int ns_to, int decode_pos) { int cursor = decode_pos; int ns; @@ -50,18 +51,26 @@ INLINE void MixXA(int *SSumLR, int ns_to, int decode_pos) if(spu.XAPlay == spu.XAFeed) spu.XARepeat--; - for(ns = 0; ns < ns_to*2; ) + for(ns = 0; ns < ns_to*2; ns += 2) { if(spu.XAPlay != spu.XAFeed) v=*spu.XAPlay++; if(spu.XAPlay == spu.XAEnd) spu.XAPlay=spu.XAStart; l = ((int)(short)v * spu.iLeftXAVol) >> 15; r = ((int)(short)(v >> 16) * spu.iLeftXAVol) >> 15; - SSumLR[ns++] += l; - SSumLR[ns++] += r; + if (spu.spuCtrl & CTRL_CD) + { + SSumLR[ns+0] += l; + SSumLR[ns+1] += r; + } + if (unlikely(spu.spuCtrl & CTRL_CDREVERB)) + { + RVB[ns+0] += l; + RVB[ns+1] += r; + } - spu.spuMem[cursor] = v; - spu.spuMem[cursor + 0x400/2] = v >> 16; + spu.spuMem[cursor] = HTOLE16(v); + spu.spuMem[cursor + 0x400/2] = HTOLE16(v >> 16); cursor = (cursor + 1) & 0x1ff; } spu.XALastVal = v; @@ -70,18 +79,26 @@ INLINE void MixXA(int *SSumLR, int ns_to, int decode_pos) // hence this 'ns_to < 8' else if(spu.CDDAPlay != spu.CDDAFeed || ns_to < 8) { - for(ns = 0; ns < ns_to*2; ) + for(ns = 0; ns < ns_to*2; ns += 2) { if(spu.CDDAPlay != spu.CDDAFeed) v=*spu.CDDAPlay++; if(spu.CDDAPlay == spu.CDDAEnd) spu.CDDAPlay=spu.CDDAStart; l = ((int)(short)v * spu.iLeftXAVol) >> 15; r = ((int)(short)(v >> 16) * spu.iLeftXAVol) >> 15; - SSumLR[ns++] += l; - SSumLR[ns++] += r; + if (spu.spuCtrl & CTRL_CD) + { + SSumLR[ns+0] += l; + SSumLR[ns+1] += r; + } + if (unlikely(spu.spuCtrl & CTRL_CDREVERB)) + { + RVB[ns+0] += l; + RVB[ns+1] += r; + } - spu.spuMem[cursor] = v; - spu.spuMem[cursor + 0x400/2] = v >> 16; + spu.spuMem[cursor] = HTOLE16(v); + spu.spuMem[cursor + 0x400/2] = HTOLE16(v >> 16); cursor = (cursor + 1) & 0x1ff; } spu.XALastVal = v; @@ -419,3 +436,4 @@ INLINE int FeedCDDA(unsigned char *pcm, int nBytes) } #endif +// vim:shiftwidth=1:expandtab