aboutsummaryrefslogtreecommitdiff
path: root/backends/midi/mt32/tables.h
diff options
context:
space:
mode:
authorJerome Fisher2004-11-28 05:35:07 +0000
committerJerome Fisher2004-11-28 05:35:07 +0000
commit077d19f5008e5cb911b1291f59b63fc46da18cc8 (patch)
treed3361671ac04d9d7f0e5e4354a78f4bd48a847d1 /backends/midi/mt32/tables.h
parent67b8abac08befed3e545dd500df4f28b7524348a (diff)
downloadscummvm-rg350-077d19f5008e5cb911b1291f59b63fc46da18cc8.tar.gz
scummvm-rg350-077d19f5008e5cb911b1291f59b63fc46da18cc8.tar.bz2
scummvm-rg350-077d19f5008e5cb911b1291f59b63fc46da18cc8.zip
- Added graphical representation of initialisation progress. This is quite hacky.
- Initialisation is now interruptible. - All data is now loaded from MT32_CONTROL.ROM. drumpat.rom, Preset1.syx, Preset2.syx and patchlog.cfg are no longer used. - Major cleanup. In particular, separated Rhythm part into a new class, instead of dealing with it as a special case everywhere. - Improved accuracy of pitch key-follow. - Recaching now happens lazily. - Changed some right-shifts to divs, due to the former not being arithmetic on some architectures. - Setting "MT32EMU_ACCURATENOTES" to 1 will generate lookup tables for the exact frequency of every note played. Not recommended. - Several small bugs fixed. svn-id: r15929
Diffstat (limited to 'backends/midi/mt32/tables.h')
-rw-r--r--backends/midi/mt32/tables.h28
1 files changed, 13 insertions, 15 deletions
diff --git a/backends/midi/mt32/tables.h b/backends/midi/mt32/tables.h
index 46be3f1548..0c85796f4f 100644
--- a/backends/midi/mt32/tables.h
+++ b/backends/midi/mt32/tables.h
@@ -36,21 +36,19 @@ const int FILTERGRAN = 512;
const int MIDDLEC = 60;
const int MIDDLEA = 69; // By this I mean "A above middle C"
-// Constant tuning for now. The manual claims "Standard pitch" is 442.0.
-// I assume they mean this is the MT-32 default pitch, and not concert pitch,
-// since the latter has been internationally defined as 440Hz for decades.
-// FIXME:KG: Keeping it at 440.0f for now, as in original. Check with CC
-const float TUNING = 440.0f;
-
-const int NUM_NOTES = 128; // Number of slots for note LUT (we actually only use 12..108)
+//FIXME:KG: may only need to do 12 to 108
+//12..108 is the range allowed by note on commands, but the key can be modified by pitch keyfollow
+//and adjustment for timbre pitch, so the results can be outside that range. Do move it (by octave) into
+// the 12..108 range, or keep it in 0..127 range, or something else altogether?
+const int LOWEST_NOTE = 12;
+const int HIGHEST_NOTE = 127;
+const int NUM_NOTES = HIGHEST_NOTE - LOWEST_NOTE + 1; // Number of slots for note LUT
// Amplitude of waveform generator
const int WGAMP = 7168; // 8192?
class Synth;
-extern const Bit8s LoopPatterns[9][10];
-
extern Bit16s smallnoise[MAX_SAMPLE_OUTPUT];
// Some optimization stuff
@@ -75,9 +73,8 @@ extern Bit32s voltable[128];
extern float ResonInv[31];
struct NoteLookup {
- Bit32s div;
- Bit32u wavTable[54];
- Bit32u loopTable[9][10];
+ Bit32u div;
+ Bit32u wavTable[128];
Bit32s sawTable[101];
Bit32s fildepTable[5];
Bit32s timekeyTable[5];
@@ -92,10 +89,11 @@ extern NoteLookup noteLookups[NUM_NOTES];
class TableInitialiser {
static void initMT32ConstantTables(Synth *synth);
static File *initWave(Synth *synth, NoteLookup *noteLookup, float ampsize, float div, File *file);
- static void initNotes(Synth *synth, PCMWave pcms[54], float rate, float tuning);
+ static bool initNotes(Synth *synth, PCMWaveEntry pcmWaves[128], float rate, float tuning);
public:
- static bool initMT32Tables(Synth *synth, PCMWave pcms[54], float sampleRate);
- static File *initNote(Synth *synth, NoteLookup *noteLookup, float note, float rate, float tuning, PCMWave pcmWaves[54], File *file);
+ static bool initMT32Tables(Synth *synth, PCMWaveEntry pcmWaves[128], float sampleRate, float masterTune);
+ static File *initNote(Synth *synth, NoteLookup *noteLookup, float note, float rate, float tuning, PCMWaveEntry pcmWaves[128], File *file);
+ static void freeNotes();
};
}