[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.33,1.34
Max Horn
fingolfin at users.sourceforge.net
Wed Jul 17 16:51:02 CEST 2002
Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv11943/sound
Modified Files:
mixer.cpp
Log Message:
added cubic spline interpolation (only to mix_unsigned_mono_8 because that's what I used to test); next step will be to put this into a seperate function which all the 9 mixers (8 normal ones and one for MP3) will then use, but I gotta sleep now :-)
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- mixer.cpp 7 Jul 2002 18:04:03 -0000 1.33
+++ mixer.cpp 17 Jul 2002 23:50:38 -0000 1.34
@@ -261,6 +261,7 @@
static int16 *mix_unsigned_mono_8(int16 *data, uint * len_ptr, byte **s_ptr, uint32 *fp_pos_ptr,
int fp_speed, const int16 *vol_tab, byte *s_end)
{
+#if OLD
uint32 fp_pos = *fp_pos_ptr;
byte *s = *s_ptr;
uint len = *len_ptr;
@@ -277,6 +278,49 @@
*len_ptr = len;
return data;
+#else
+ uint32 fp_pos = *fp_pos_ptr;
+ byte *s = *s_ptr;
+ uint len = *len_ptr;
+ int x0, x1, x2, x3;
+ int a, b, c, d;
+ int inc = 1, result, t;
+ x0 = x1 = vol_tab[*s ^ 0x80];
+ x2 = vol_tab[*(s+1) ^ 0x80];
+ x3 = vol_tab[*(s+2) ^ 0x80];
+ do {
+ a = ((-x0*2)+(x1*5)-(x2*4)+x3);
+ b = ((x0+x2-(2*x1))*6) << 8;
+ c = ((-4*x0)+x1+(x2*4)-x3) << 8;
+ d = (x1*6) << 8;
+ do {
+ t = fp_pos >> 8;
+ result = (a*t + b) >> 8;
+ result = (result * t + c) >> 8;
+ result = (result * t + d) >> 8;
+ result = (result/3 + 1) >> 1;
+
+ *data++ += result;
+ *data++ += result;
+
+ fp_pos += fp_speed;
+ inc = fp_pos >> 16;
+ s += inc;
+ fp_pos &= 0x0000FFFF;
+ } while ((--len) && !inc && (s < s_end));
+ x0 = x1;
+ x1 = x2;
+ x2 = x3;
+ if (s+2 < s_end)
+ x3 = vol_tab[*(s+2) ^ 0x80];
+ } while (len && (s < s_end));
+
+ *fp_pos_ptr = fp_pos;
+ *s_ptr = s;
+ *len_ptr = len;
+
+ return data;
+#endif
}
static int16 *mix_signed_stereo_8(int16 *data, uint * len_ptr, byte **s_ptr, uint32 *fp_pos_ptr,
int fp_speed, const int16 *vol_tab, byte *s_end)
More information about the Scummvm-git-logs
mailing list