#include "resampler.h"\r
#include "mix.h"\r
\r
+#define YM2612_CH6PAN 0x1b6 // panning register for channel 6 (used for DAC)\r
+\r
void (*PsndMix_32_to_16)(s16 *dest, s32 *src, int count) = mix_32_to_16_stereo;\r
\r
// master int buffer to mix to\r
// 1 sample delay for correct IIR filtering over audio frame boundaries\r
if (PicoIn.opt & POPT_EN_STEREO) {\r
s16 *d = PicoIn.sndOut + pos*2;\r
- // left channel only, mixed ro right channel in mixing phase\r
- *d++ += Pico.snd.dac_val2, *d++ += Pico.snd.dac_val2;\r
- while (--len) *d++ += Pico.snd.dac_val, *d++ += Pico.snd.dac_val;\r
+ int pan = ym2612.REGS[YM2612_CH6PAN];\r
+ int l = pan & 0x80 ? Pico.snd.dac_val : 0;\r
+ int r = pan & 0x40 ? Pico.snd.dac_val : 0;\r
+ *d++ += pan & 0x80 ? Pico.snd.dac_val2 : 0;\r
+ *d++ += pan & 0x40 ? Pico.snd.dac_val2 : 0;\r
+ while (--len) *d++ += l, *d++ += r;\r
} else {\r
s16 *d = PicoIn.sndOut + pos;\r
*d++ += Pico.snd.dac_val2;\r
\r
// Fill up DAC output in case of missing samples (Q rounding errors)\r
if (length-daclen > 0 && PicoIn.sndOut) {\r
- s16 *dacbuf = PicoIn.sndOut + (daclen << stereo);\r
Pico.snd.dac_pos += (length-daclen) << 20;\r
- *dacbuf++ += Pico.snd.dac_val2;\r
- if (stereo) *dacbuf++ += Pico.snd.dac_val2;\r
- for (daclen++; length-daclen > 0; daclen++) {\r
- *dacbuf++ += Pico.snd.dac_val;\r
- if (stereo) *dacbuf++ += Pico.snd.dac_val;\r
+ if (PicoIn.opt & POPT_EN_STEREO) {\r
+ s16 *d = PicoIn.sndOut + daclen*2;\r
+ int pan = ym2612.REGS[YM2612_CH6PAN];\r
+ int l = pan & 0x80 ? Pico.snd.dac_val : 0;\r
+ int r = pan & 0x40 ? Pico.snd.dac_val : 0;\r
+ *d++ += pan & 0x80 ? Pico.snd.dac_val2 : 0;\r
+ *d++ += pan & 0x40 ? Pico.snd.dac_val2 : 0;\r
+ if (l|r) for (daclen++; length-daclen > 0; daclen++)\r
+ *d++ += l, *d++ += r;\r
+ } else {\r
+ s16 *d = PicoIn.sndOut + daclen;\r
+ *d++ += Pico.snd.dac_val2;\r
+ if (Pico.snd.dac_val) for (daclen++; length-daclen > 0; daclen++)\r
+ *d++ += Pico.snd.dac_val;\r
}\r
Pico.snd.dac_val2 = Pico.snd.dac_val;\r
}\r