+
+ if(spu.XAPlay != spu.XAFeed)
+ {
+ for(ns = 0; ns < ns_to*2; ns += 2)
+ {
+ if(spu.XAPlay != spu.XAFeed) spu.XAPlay++;
+ if(spu.XAPlay == spu.XAEnd) spu.XAPlay=spu.XAStart;
+
+ spu.spuMem[cursor] = 0;
+ spu.spuMem[cursor + 0x400/2] = 0;
+ cursor = (cursor + 1) & 0x1ff;
+ }
+ }
+ else if(spu.CDDAPlay != spu.CDDAFeed)
+ {
+ for(ns = 0; ns < ns_to*2; ns += 2)
+ {
+ if(spu.CDDAPlay != spu.CDDAFeed) spu.CDDAPlay++;
+ if(spu.CDDAPlay == spu.CDDAEnd) spu.CDDAPlay=spu.CDDAStart;
+
+ spu.spuMem[cursor] = 0;
+ spu.spuMem[cursor + 0x400/2] = 0;
+ cursor = (cursor + 1) & 0x1ff;
+ }
+ }
+ spu.XALastVal = 0;
+}
+
+INLINE void MixCD(int *SSumLR, int *RVB, int ns_to, int decode_pos)
+{
+ int vll = spu.iLeftXAVol * spu.cdv.ll >> 7;
+ int vrl = spu.iLeftXAVol * spu.cdv.rl >> 7;
+ int vlr = spu.iRightXAVol * spu.cdv.lr >> 7;
+ int vrr = spu.iRightXAVol * spu.cdv.rr >> 7;
+ int cursor = decode_pos;
+ int l1, r1, l, r;
+ int ns;
+ uint32_t v = spu.XALastVal;
+
+ // note: spu volume doesn't affect cd capture
+ if ((spu.cdv.ll | spu.cdv.lr | spu.cdv.rl | spu.cdv.rr) == 0)
+ {
+ SkipCD(ns_to, decode_pos);
+ return;
+ }