aboutsummaryrefslogtreecommitdiff
path: root/backends/midi/mt32/tables.h
diff options
context:
space:
mode:
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();
};
}