[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.26,1.27

Pawe? Ko?odziejski aquadran at users.sourceforge.net
Tue May 21 22:56:02 CEST 2002


Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv2814

Modified Files:
	mixer.cpp 
Log Message:
Fix for mixer 16 bits samples. Samples are clear now.
bbrox: This patch works fine for me, previous not. (MSVC6 + SP5)

Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mixer.cpp	20 May 2002 20:35:25 -0000	1.26
+++ mixer.cpp	22 May 2002 05:55:10 -0000	1.27
@@ -267,7 +267,7 @@
 	unsigned char volume = ((int) vol_tab[1]) * 32 / 255;
 	byte *s = *s_ptr;
 	do {
-		int16 sample = (int16) (((int32) ((*s << 8) | *(s + 1))) * volume / 32);
+		int16 sample = (((int16)(*s << 8) | *(s + 1)) * volume) / 32;
 		fp_pos += fp_speed;
 		*data++ += sample;
 		*data++ += sample;
@@ -287,8 +287,8 @@
 	byte *s = *s_ptr;
 	do {
 		fp_pos += fp_speed;
-		*data++ += (int16) ((((int32) ((*(s    ) << 8) | *(s + 1))) * volume) / 32);
-		*data++ += (int16) ((((int32) ((*(s + 2) << 8) | *(s + 3))) * volume) / 32);
+		*data++ += (((int16)(*(s    ) << 8) | *(s + 1)) * volume) / 32;
+		*data++ += (((int16)(*(s + 2) << 8) | *(s + 3)) * volume) / 32;
 		s += (fp_pos >> 16) << 2;
 		fp_pos &= 0x0000FFFF;
 	} while (--len);





More information about the Scummvm-git-logs mailing list