aboutsummaryrefslogtreecommitdiff
path: root/audio/softsynth/mt32/Tables.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2012-11-15 14:09:52 +0200
committerFilippos Karapetis2012-11-15 14:30:41 +0200
commit3233edf9b843f16018b6142b344b08dedae74d67 (patch)
tree147da92c466ad5646373521ed8088ce9b399356e /audio/softsynth/mt32/Tables.cpp
parent97854df1a8d5b322fab12bad11ad4c859a28062b (diff)
downloadscummvm-rg350-3233edf9b843f16018b6142b344b08dedae74d67.tar.gz
scummvm-rg350-3233edf9b843f16018b6142b344b08dedae74d67.tar.bz2
scummvm-rg350-3233edf9b843f16018b6142b344b08dedae74d67.zip
MT32: Update the MT32 emulator to the latest munt revision
Previous munt revision was 189f607c88e7404ad99abcf4b90f23b103003ed1 (Feb 09, 2012). Current munt revision is f969d2081d41b669c1bfebd0026b5419c09517ae (Nov 15, 2012)
Diffstat (limited to 'audio/softsynth/mt32/Tables.cpp')
-rw-r--r--audio/softsynth/mt32/Tables.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/audio/softsynth/mt32/Tables.cpp b/audio/softsynth/mt32/Tables.cpp
index c9bd40b7a4..b6e63840bc 100644
--- a/audio/softsynth/mt32/Tables.cpp
+++ b/audio/softsynth/mt32/Tables.cpp
@@ -22,18 +22,14 @@
#include "mt32emu.h"
#include "mmath.h"
-using namespace MT32Emu;
+namespace MT32Emu {
-Tables::Tables() {
- initialised = false;
+const Tables &Tables::getInstance() {
+ static const Tables instance;
+ return instance;
}
-void Tables::init() {
- if (initialised) {
- return;
- }
- initialised = true;
-
+Tables::Tables() {
int lf;
for (lf = 0; lf <= 100; lf++) {
// CONFIRMED:KG: This matches a ROM table found by Mok
@@ -83,19 +79,9 @@ void Tables::init() {
pulseLenFactor[i] = (1.241857812f - pt) * pt; // seems to be 2 ^ (5 / 16) = 1.241857812f
}
- for (int i = 0; i < 65536; i++) {
- // Aka (slightly slower): EXP2F(pitchVal / 4096.0f - 16.0f) * 32000.0f
- pitchToFreq[i] = EXP2F(i / 4096.0f - 1.034215715f);
- }
-
- // found from sample analysis
- for (int i = 0; i < 1024; i++) {
- cutoffToCosineLen[i] = EXP2F(i / -128.0f);
- }
-
- // found from sample analysis
- for (int i = 0; i < 1024; i++) {
- cutoffToFilterAmp[i] = EXP2F(-0.125f * (128.0f - i / 8.0f));
+ // The LA32 chip presumably has such a table inside as the internal computaions seem to be performed using fixed point math with 12-bit fractions
+ for (int i = 0; i < 4096; i++) {
+ exp2[i] = EXP2F(i / 4096.0f);
}
// found from sample analysis
@@ -117,3 +103,5 @@ void Tables::init() {
sinf10[i] = sin(FLOAT_PI * i / 2048.0f);
}
}
+
+}