aboutsummaryrefslogtreecommitdiff
path: root/sound/softsynth
diff options
context:
space:
mode:
authorMax Horn2005-11-02 20:50:37 +0000
committerMax Horn2005-11-02 20:50:37 +0000
commit5e75092decb10ee760d62e2b42272b70eda05e2e (patch)
tree10a909cea251ab3c0f89f6df51d4f5ccf97ba0d2 /sound/softsynth
parente3cdcdfcb8cfc69617e4853693911750efcef80c (diff)
downloadscummvm-rg350-5e75092decb10ee760d62e2b42272b70eda05e2e.tar.gz
scummvm-rg350-5e75092decb10ee760d62e2b42272b70eda05e2e.tar.bz2
scummvm-rg350-5e75092decb10ee760d62e2b42272b70eda05e2e.zip
Avoid using powf/expf/logf under Mac OS X, as they cause binary & compile incompatibilities with older system versions
svn-id: r19396
Diffstat (limited to 'sound/softsynth')
-rw-r--r--sound/softsynth/mt32/partial.cpp7
-rw-r--r--sound/softsynth/mt32/synth.cpp7
-rw-r--r--sound/softsynth/mt32/tables.cpp19
3 files changed, 27 insertions, 6 deletions
diff --git a/sound/softsynth/mt32/partial.cpp b/sound/softsynth/mt32/partial.cpp
index e7e7af2a7f..7d4b985b49 100644
--- a/sound/softsynth/mt32/partial.cpp
+++ b/sound/softsynth/mt32/partial.cpp
@@ -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)
diff --git a/sound/softsynth/mt32/synth.cpp b/sound/softsynth/mt32/synth.cpp
index 62356dcda9..5441f12a77 100644
--- a/sound/softsynth/mt32/synth.cpp
+++ b/sound/softsynth/mt32/synth.cpp
@@ -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;
diff --git a/sound/softsynth/mt32/tables.cpp b/sound/softsynth/mt32/tables.cpp
index 006f91d0b8..7ed55ca4ee 100644
--- a/sound/softsynth/mt32/tables.cpp
+++ b/sound/softsynth/mt32/tables.cpp
@@ -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 @@ void Tables::initEnvelopes(float samplerate) {
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 @@ void Tables::initMT32ConstantTables(Synth *synth) {
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 @@ void Tables::initMT32ConstantTables(Synth *synth) {
/*
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 @@ void Tables::initMT32ConstantTables(Synth *synth) {
//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 @@ static void initNFiltTable(NoteLookup *noteLookup, float freq, float rate) {
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);