diff options
Diffstat (limited to 'utils/gen_adldata/file_formats/load_tmb.h')
-rw-r--r-- | utils/gen_adldata/file_formats/load_tmb.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/utils/gen_adldata/file_formats/load_tmb.h b/utils/gen_adldata/file_formats/load_tmb.h index 4417b02..d9d57dd 100644 --- a/utils/gen_adldata/file_formats/load_tmb.h +++ b/utils/gen_adldata/file_formats/load_tmb.h @@ -4,7 +4,7 @@ #include "../progs_cache.h" #include "../midi_inst_list.h" -static bool LoadTMB(const char *fn, unsigned bank, const char *prefix) +bool BankFormats::LoadTMB(BanksDump &db, const char *fn, unsigned bank, const std::string &bankTitle, const char *prefix) { #ifdef HARD_BANKS writeIni("TMB", fn, prefix, bank, INI_Both); @@ -22,7 +22,11 @@ static bool LoadTMB(const char *fn, unsigned bank, const char *prefix) } std::fclose(fp); - for(unsigned a = 0; a < 256; ++a) + size_t bankDb = db.initBank(bank, bankTitle, BanksDump::BankEntry::SETUP_Apogee); + BanksDump::MidiBank bnkMelodique; + BanksDump::MidiBank bnkPercussion; + + for(unsigned a = 0, patchId = 0; a < 256; ++a, patchId++) { unsigned offset = a * 0x0D; unsigned gmno = a; @@ -30,6 +34,12 @@ static bool LoadTMB(const char *fn, unsigned bank, const char *prefix) : gmno < 128 + 35 ? -1 : gmno < 128 + 88 ? int(gmno - 35) : -1; + if(patchId == 128) + patchId = 0; + bool isPercussion = a >= 128; + BanksDump::MidiBank &bnk = isPercussion ? bnkPercussion : bnkMelodique; + BanksDump::InstrumentEntry inst; + BanksDump::Operator ops[5]; insdata tmp; @@ -55,6 +65,11 @@ static bool LoadTMB(const char *fn, unsigned bank, const char *prefix) tmp2.midi_velocity_offset = (int8_t)data[offset + 12]; tmp2.rhythmModeDrum = 0; + inst.percussionKeyNumber = data[offset + 11]; + inst.midiVelocityOffset = (int8_t)data[offset + 12]; + inst.fbConn = data[offset + 10]; + db.toOps(tmp, ops, 0); + std::string name; if(midi_index >= 0) name = std::string(1, '\377') + MidiInsName[midi_index]; @@ -64,8 +79,13 @@ static bool LoadTMB(const char *fn, unsigned bank, const char *prefix) size_t resno = InsertIns(tmp, tmp2, name, name2); SetBank(bank, gmno, resno); + + db.addInstrument(bnk, patchId, inst, ops, fn); } + db.addMidiBank(bankDb, false, bnkMelodique); + db.addMidiBank(bankDb, true, bnkPercussion); + AdlBankSetup setup; setup.volumeModel = VOLUME_APOGEE; setup.deepTremolo = false; |