aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfsound
diff options
context:
space:
mode:
authornotaz2012-07-09 02:00:18 +0300
committernotaz2012-07-15 20:30:10 +0300
commitefce366c5b6596b9542c4fe8c69695191dab5d5a (patch)
treee3268a32f1e2ca14d670ac4caab0c5143723ead8 /plugins/dfsound
parentb72f17a1320e9038c8416343ce270b0f676c757c (diff)
downloadpcsx_rearmed-efce366c5b6596b9542c4fe8c69695191dab5d5a.tar.gz
pcsx_rearmed-efce366c5b6596b9542c4fe8c69695191dab5d5a.tar.bz2
pcsx_rearmed-efce366c5b6596b9542c4fe8c69695191dab5d5a.zip
spu: handle cd decode buffers too
Diffstat (limited to 'plugins/dfsound')
-rw-r--r--plugins/dfsound/externals.h3
-rw-r--r--plugins/dfsound/xa.c64
2 files changed, 32 insertions, 35 deletions
diff --git a/plugins/dfsound/externals.h b/plugins/dfsound/externals.h
index f844b25..fbf9d18 100644
--- a/plugins/dfsound/externals.h
+++ b/plugins/dfsound/externals.h
@@ -248,9 +248,6 @@ extern uint32_t * XAPlay;
extern uint32_t * XAStart;
extern uint32_t * XAEnd;
-extern uint32_t XARepeat;
-extern uint32_t XALastVal;
-
extern uint32_t * CDDAFeed;
extern uint32_t * CDDAPlay;
extern uint32_t * CDDAStart;
diff --git a/plugins/dfsound/xa.c b/plugins/dfsound/xa.c
index b1efe10..af78acb 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,44 @@ 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<NSSIZE*2 && XAPlay!=XAFeed;)
- {
- XALastVal=*XAPlay++;
- if(XAPlay==XAEnd) XAPlay=XAStart;
-#ifdef XA_HACK
- SSumLR[ns++]+=(((short)(XALastVal&0xffff)) * iLeftXAVol)/32768;
- SSumLR[ns++]+=(((short)((XALastVal>>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<NSSIZE*2;)
- {
-#ifdef XA_HACK
- SSumLR[ns++]+=(((short)(XALastVal&0xffff)) * iLeftXAVol)/32768;
- SSumLR[ns++]+=(((short)((XALastVal>>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<NSSIZE*2;)
+ {
+ if(XAPlay != XAFeed) v=*XAPlay++;
+ if(XAPlay == XAEnd) XAPlay=XAStart;
+
+ l = ((int)(short)v * iLeftXAVol) >> 15;
+ r = ((int)(short)(v >> 16) * iLeftXAVol) >> 15;
+ SSumLR[ns++] += l;
+ SSumLR[ns++] += r;
+ spuMem[cursor] = l;
+ spuMem[cursor + 0x400/2] = r;
+ cursor = (cursor + 1) & 0x1ff;
+ }
+ XALastVal = v;
+ }
for(ns=0;ns<NSSIZE*2 && CDDAPlay!=CDDAFeed && (CDDAPlay!=CDDAEnd-1||CDDAFeed!=CDDAStart);)
{
- l=*CDDAPlay++;
+ v=*CDDAPlay++;
if(CDDAPlay==CDDAEnd) CDDAPlay=CDDAStart;
- SSumLR[ns++]+=(((short)(l&0xffff)) * iLeftXAVol) >> 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] = l;
+ spuMem[cursor + 0x400/2] = r;
+ cursor = (cursor + 1) & 0x1ff;
}
}