aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorNorbert Lange2009-07-09 00:02:12 +0000
committerNorbert Lange2009-07-09 00:02:12 +0000
commitd25f4814214018fdf7fdb0b9b732948a19da7d6d (patch)
tree83e3e2635abb0fe5c014b2d4ee5b483e3253a706 /sound
parenta9d9de7db4eeacab240a76bd29ed8e95316546c9 (diff)
downloadscummvm-rg350-d25f4814214018fdf7fdb0b9b732948a19da7d6d.tar.gz
scummvm-rg350-d25f4814214018fdf7fdb0b9b732948a19da7d6d.tar.bz2
scummvm-rg350-d25f4814214018fdf7fdb0b9b732948a19da7d6d.zip
fixed (and inlined) the "Antilog" function
svn-id: r42274
Diffstat (limited to 'sound')
-rw-r--r--sound/mods/maxtrax.cpp10
-rw-r--r--sound/mods/maxtrax.h1
2 files changed, 2 insertions, 9 deletions
diff --git a/sound/mods/maxtrax.cpp b/sound/mods/maxtrax.cpp
index 4f863ee7ba..e53099e480 100644
--- a/sound/mods/maxtrax.cpp
+++ b/sound/mods/maxtrax.cpp
@@ -165,13 +165,6 @@ void MaxTrax::interrupt() {
}
-int32 MaxTrax::omgItsAntiLog(uint32 val) {
- // some really weird exponential function, and some also very nonstandard "standard format" floats
- // format is 16? bit exponent, 16 bit mantissa. and we need to scale with log(2)
- const float v = ldexp((float)((val & 0xFFFF) + 0x10000) * (float)(0.69314718055994530942 / 65536), val >> 16);
- return (uint32)exp(v);
-}
-
void MaxTrax::stopMusic() {
}
@@ -249,7 +242,8 @@ int MaxTrax::calcNote(VoiceContext &voice) {
tone -= voice.periodOffset;
}
if (tone < PERIOD_LIMIT)
- voice.lastPeriod = (uint16)omgItsAntiLog((float)tone);
+ // we need to scale with log(2)
+ voice.lastPeriod = (uint16)exp((float)tone * (float)(0.69314718055994530942 / 65536));
return octave;
}
diff --git a/sound/mods/maxtrax.h b/sound/mods/maxtrax.h
index 3efed92954..bc04ad6246 100644
--- a/sound/mods/maxtrax.h
+++ b/sound/mods/maxtrax.h
@@ -205,7 +205,6 @@ public:
void freePatches();
void freeScores();
- static int32 omgItsAntiLog(uint32 val);
int calcNote(VoiceContext &voice);
int8 noteOn(ChannelContext &channel, byte note, uint16 volume, uint16 pri);
void noteOff(ChannelContext &channel, byte note);