aboutsummaryrefslogtreecommitdiff
path: root/sound/mixer.cpp
diff options
context:
space:
mode:
authorPaweł Kołodziejski2002-05-19 20:38:53 +0000
committerPaweł Kołodziejski2002-05-19 20:38:53 +0000
commit4aabb0378c88d77d544aad41376552f9ce4fa198 (patch)
tree815c7a7dc8209854697477a2e29de443830c720a /sound/mixer.cpp
parentc9a53bcf7616ded009df401cc84dbc90e1b4092f (diff)
downloadscummvm-rg350-4aabb0378c88d77d544aad41376552f9ce4fa198.tar.gz
scummvm-rg350-4aabb0378c88d77d544aad41376552f9ce4fa198.tar.bz2
scummvm-rg350-4aabb0378c88d77d544aad41376552f9ce4fa198.zip
The Dig: stereo samples and mixer
svn-id: r4359
Diffstat (limited to 'sound/mixer.cpp')
-rw-r--r--sound/mixer.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 587e524185..d790122a3b 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -249,7 +249,18 @@ static void mix_signed_stereo_8(int16 *data, uint len, byte **s_ptr, uint32 *fp_
warning("Mixing stereo signed 8 bit is not supported yet ");
}
static void mix_unsigned_stereo_8(int16 *data, uint len, byte **s_ptr, uint32 *fp_pos_ptr, int fp_speed, const int16 *vol_tab) {
- warning("Mixing stereo unsigned 8 bit is not supported yet ");
+ uint32 fp_pos = *fp_pos_ptr;
+ byte *s = *s_ptr;
+ do {
+ fp_pos += fp_speed;
+ *data++ += vol_tab[*s ^ 0x80];
+ *data++ += vol_tab[*(s + 1) ^ 0x80];
+ s += (fp_pos >> 16) << 1;
+ fp_pos &= 0x0000FFFF;
+ } while (--len);
+
+ *fp_pos_ptr = fp_pos;
+ *s_ptr = s;
}
static void mix_signed_mono_16(int16 *data, uint len, byte **s_ptr, uint32 *fp_pos_ptr, int fp_speed, const int16 *vol_tab) {
uint32 fp_pos = *fp_pos_ptr;
@@ -257,8 +268,8 @@ static void mix_signed_mono_16(int16 *data, uint len, byte **s_ptr, uint32 *fp_p
do {
fp_pos += fp_speed;
// FIXME: missing volume table
- *data++ += (*s << 8) + *(s + 1);
- *data++ += (*s << 8) + *(s + 1);
+ *data++ += ((*s << 8) | *(s + 1));
+ *data++ += ((*s << 8) | *(s + 1));
s += (fp_pos >> 16) << 1;
fp_pos &= 0x0000FFFF;
} while (--len);
@@ -270,7 +281,19 @@ static void mix_unsigned_mono_16(int16 *data, uint len, byte **s_ptr, uint32 *fp
warning("Mixing mono unsigned 16 bit is not supported yet ");
}
static void mix_signed_stereo_16(int16 *data, uint len, byte **s_ptr, uint32 *fp_pos_ptr, int fp_speed, const int16 *vol_tab) {
- warning("Mixing stereo signed 16 bit is not supported yet ");
+ uint32 fp_pos = *fp_pos_ptr;
+ byte *s = *s_ptr;
+ do {
+ fp_pos += fp_speed;
+ // FIXME: missing volume table
+ *data++ += ((*s << 8) | *(s + 1));
+ *data++ += ((*(s + 2) << 8) | *(s + 3));
+ s += (fp_pos >> 16) << 2;
+ fp_pos &= 0x0000FFFF;
+ } while (--len);
+
+ *fp_pos_ptr = fp_pos;
+ *s_ptr = s;
}
static void mix_unsigned_stereo_16(int16 *data, uint len, byte **s_ptr, uint32 *fp_pos_ptr, int fp_speed, const int16 *vol_tab) {
warning("Mixing stereo unsigned 16 bit is not supported yet ");