[Scummvm-cvs-logs] CVS: scummvm/sound/softsynth/mt32 partial.cpp,1.3,1.4 synth.cpp,1.5,1.6 tables.cpp,1.6,1.7

Max Horn fingolfin at users.sourceforge.net
Wed Nov 2 12:53:27 CET 2005


Update of /cvsroot/scummvm/scummvm/sound/softsynth/mt32
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10188

Modified Files:
	partial.cpp synth.cpp tables.cpp 
Log Message:
Avoid using powf/expf/logf under Mac OS X, as they cause binary & compile incompatibilities with older system versions

Index: partial.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/softsynth/mt32/partial.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- partial.cpp	8 May 2005 21:49:51 -0000	1.3
+++ partial.cpp	2 Nov 2005 20:50:37 -0000	1.4
@@ -25,6 +25,13 @@
 
 #include "mt32emu.h"
 
+#ifdef MACOSX
+// Older versions of Mac OS X didn't supply a powf function. To ensure
+// binary compatibiity, we force using pow instead of powf (the only
+// potential drawback is that it might be a little bit slower).
+#define powf pow
+#endif
+
 #define FIXEDPOINT_UDIV(x, y, point) (((x) << (point)) / ((y)))
 #define FIXEDPOINT_SDIV(x, y, point) (((x) * (1 << point)) / ((y)))
 #define FIXEDPOINT_UMULT(x, y, point) (((x) * (y)) >> point)

Index: synth.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/softsynth/mt32/synth.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- synth.cpp	30 Jul 2005 21:11:44 -0000	1.5
+++ synth.cpp	2 Nov 2005 20:50:37 -0000	1.6
@@ -25,6 +25,13 @@
 
 #include "mt32emu.h"
 
+#ifdef MACOSX
+// Older versions of Mac OS X didn't supply a powf function. To ensure
+// binary compatibiity, we force using pow instead of powf (the only
+// potential drawback is that it might be a little bit slower).
+#define powf pow
+#endif
+
 namespace MT32Emu {
 
 const int MAX_SYSEX_SIZE = 512;

Index: tables.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/softsynth/mt32/tables.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- tables.cpp	30 Jul 2005 21:11:44 -0000	1.6
+++ tables.cpp	2 Nov 2005 20:50:37 -0000	1.7
@@ -25,6 +25,13 @@
 
 #include "mt32emu.h"
 
+#ifdef MACOSX
+// Older versions of Mac OS X didn't supply a powf function. To ensure
+// binary compatibiity, we force using pow instead of powf (the only
+// potential drawback is that it might be a little bit slower).
+#define powf pow
+#endif
+
 #define FIXEDPOINT_MAKE(x, point) ((Bit32u)((1 << point) * x))
 
 namespace MT32Emu {
@@ -164,7 +171,7 @@
 		if (elf == 0) {
 			envDeltaMaxTime[lf] = 63;
 		} else {
-			float cap = 11.0f * logf(elf) + 64;
+			float cap = 11.0f * log(elf) + 64;
 			if (cap > 100.0f) {
 				cap = 100.0f;
 			}
@@ -328,7 +335,7 @@
 				tlf = (float)lf - padjtable[depti];
 				if (tlf < 0)
 					tlf = 0;
-				lfp = expf(0.713619942f * tlf) / 407.4945111f;
+				lfp = exp(0.713619942f * tlf) / 407.4945111f;
 
 				if (depat < 50)
 					finalval = 4096.0f * powf(2, -lfp);
@@ -372,7 +379,7 @@
 				/*
 				amplog = powf(1.431817011f, (float)lf) / FLOAT_PI;
 				dval = ((128.0f - (float)distval) / 128.0f);
-				amplog = expf(amplog);
+				amplog = exp(amplog);
 				dval = powf(amplog, dval) / amplog;
 				tvaBiasMult[lf][distval] = (int)(dval * 256.0);
 				*/
@@ -403,7 +410,7 @@
 				//amplog = pow(1.431817011, filval) / FLOAT_PI;
 				amplog = powf(1.531817011f, filval) / FLOAT_PI;
 				dval = (128.0f - (float)distval) / 128.0f;
-				amplog = expf(amplog);
+				amplog = exp(amplog);
 				dval = powf(amplog,dval)/amplog;
 				if (lf < 8) {
 					tvfBiasMult[lf][distval] = (int)(dval * 256.0f);
@@ -549,8 +556,8 @@
 		for (int tf = 0;tf <= 100; tf++) {
 			float tfadd = (float)tf;
 
-			//float freqsum = expf((cfmult + tfadd) / 30.0f) / 4.0f;
-			//float freqsum = 0.15f * expf(0.45f * ((cfmult + tfadd) / 10.0f));
+			//float freqsum = exp((cfmult + tfadd) / 30.0f) / 4.0f;
+			//float freqsum = 0.15f * exp(0.45f * ((cfmult + tfadd) / 10.0f));
 
 			float freqsum = powf(2.0f, ((cfmult + tfadd) - 40.0f) / 16.0f);
 





More information about the Scummvm-git-logs mailing list