+ spu.spuMem[cursor] = HTOLE16(v);
+ spu.spuMem[cursor + 0x400/2] = HTOLE16(v >> 16);
+ cursor = (cursor + 1) & 0x1ff;
+ }
+ spu.XALastVal = v;
+ }
+ // occasionally CDDAFeed underflows by a few samples due to poor timing,
+ // hence this 'ns_to < 8'
+ else if(spu.CDDAPlay != spu.CDDAFeed || ns_to < 8)
+ {
+ 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;
+ if (spu.spuCtrl & CTRL_CD)