[Scummvm-cvs-logs] CVS: scummvm/sound rate.h,1.20,1.21

Max Horn fingolfin at users.sourceforge.net
Fri Sep 12 12:48:57 CEST 2003


Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv25712

Modified Files:
	rate.h 
Log Message:
some (untested!) support for backends which require unsigned audio samples

Index: rate.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/rate.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- rate.h	5 Sep 2003 23:27:11 -0000	1.20
+++ rate.h	11 Sep 2003 22:57:06 -0000	1.21
@@ -42,14 +42,23 @@
 #define ST_SUCCESS (0)
 
 static inline void clampedAdd(int16& a, int b) {
-	register int val = a + b;
+	register int val;
+#ifdef OUTPUT_UNSIGNED_AUDIO
+	val = (a ^ 0x8000) + b;
+#else
+	val = a + b;
+#endif
 
 	if (val > ST_SAMPLE_MAX)
 		val = ST_SAMPLE_MAX;
 	else if (val < ST_SAMPLE_MIN)
 		val = ST_SAMPLE_MIN;
 
+#ifdef OUTPUT_UNSIGNED_AUDIO
+	a = ((int16)val) ^ 0x8000;
+#else
 	a = val;
+#endif
 }
 
 // Q&D hack to get this SOX stuff to work





More information about the Scummvm-git-logs mailing list