aboutsummaryrefslogtreecommitdiff
path: root/sound/mixer.cpp
diff options
context:
space:
mode:
authorPaweł Kołodziejski2002-05-19 15:20:18 +0000
committerPaweł Kołodziejski2002-05-19 15:20:18 +0000
commitc9a53bcf7616ded009df401cc84dbc90e1b4092f (patch)
treedbe061e4f67d5a8e36f1d225487a23d895a6cd62 /sound/mixer.cpp
parentdb9cdefa408bfb4c5d97ef6e8aa0a0b39e40515f (diff)
downloadscummvm-rg350-c9a53bcf7616ded009df401cc84dbc90e1b4092f.tar.gz
scummvm-rg350-c9a53bcf7616ded009df401cc84dbc90e1b4092f.tar.bz2
scummvm-rg350-c9a53bcf7616ded009df401cc84dbc90e1b4092f.zip
The Dig: 16 bit samples and mixer
svn-id: r4358
Diffstat (limited to 'sound/mixer.cpp')
-rw-r--r--sound/mixer.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index a47965ca65..587e524185 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -184,6 +184,8 @@ SoundMixer::Channel_RAW::Channel_RAW(SoundMixer *mixer, void *sound, uint32 size
_realsize = size;
_rate = rate;
_size = size * mixer->_output_rate / rate;
+ if (_flags & FLAG_16BITS) _size = _size >> 1;
+ if (_flags & FLAG_STEREO) _size = _size >> 1;
}
void SoundMixer::Channel_RAW::append(void *data, uint32 len) {
@@ -207,6 +209,8 @@ void SoundMixer::Channel_RAW::append(void *data, uint32 len) {
/* Reset sizes */
_realsize = _cur_size + len;
_size = _realsize * _mixer->_output_rate / _rate;
+ if (_flags & FLAG_16BITS) _size = _size >> 1;
+ if (_flags & FLAG_STEREO) _size = _size >> 1;
_pos = 0;
_fp_pos = 0;
@@ -248,7 +252,19 @@ static void mix_unsigned_stereo_8(int16 *data, uint len, byte **s_ptr, uint32 *f
warning("Mixing stereo unsigned 8 bit is not supported yet ");
}
static void mix_signed_mono_16(int16 *data, uint len, byte **s_ptr, uint32 *fp_pos_ptr, int fp_speed, const int16 *vol_tab) {
- warning("Mixing mono 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 << 8) + *(s + 1);
+ s += (fp_pos >> 16) << 1;
+ fp_pos &= 0x0000FFFF;
+ } while (--len);
+
+ *fp_pos_ptr = fp_pos;
+ *s_ptr = s;
}
static void mix_unsigned_mono_16(int16 *data, uint len, byte **s_ptr, uint32 *fp_pos_ptr, int fp_speed, const int16 *vol_tab) {
warning("Mixing mono unsigned 16 bit is not supported yet ");