[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.23,1.24
Pawe? Ko?odziejski
aquadran at users.sourceforge.net
Sun May 19 08:21:01 CEST 2002
Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv8033
Modified Files:
mixer.cpp
Log Message:
The Dig: 16 bit samples and mixer
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- mixer.cpp 18 May 2002 14:53:19 -0000 1.23
+++ mixer.cpp 19 May 2002 15:20:18 -0000 1.24
@@ -184,6 +184,8 @@
_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 @@
/* 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 @@
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 ");
More information about the Scummvm-git-logs
mailing list