diff options
Diffstat (limited to 'utils/gen_adldata/file_formats/load_jv.h')
-rw-r--r-- | utils/gen_adldata/file_formats/load_jv.h | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/utils/gen_adldata/file_formats/load_jv.h b/utils/gen_adldata/file_formats/load_jv.h index a498bb6..1cb6a16 100644 --- a/utils/gen_adldata/file_formats/load_jv.h +++ b/utils/gen_adldata/file_formats/load_jv.h @@ -4,7 +4,7 @@ #include "../progs_cache.h" #include "../midi_inst_list.h" -static bool LoadJunglevision(const char *fn, unsigned bank, const char *prefix) +bool BankFormats::LoadJunglevision(BanksDump &db, const char *fn, unsigned bank, const std::string &bankTitle, const char *prefix) { #ifdef HARD_BANKS writeIni("Junglevision", fn, prefix, bank, INI_Both); @@ -22,6 +22,10 @@ static bool LoadJunglevision(const char *fn, unsigned bank, const char *prefix) } std::fclose(fp); + size_t bankDb = db.initBank(bank, bankTitle, BanksDump::BankEntry::SETUP_Win9X); + BanksDump::MidiBank bnkMelodique; + BanksDump::MidiBank bnkPercussion; + uint16_t ins_count = uint16_t(data[0x20] + (data[0x21] << 8)); uint16_t drum_count = uint16_t(data[0x22] + (data[0x23] << 8)); uint16_t first_ins = uint16_t(data[0x24] + (data[0x25] << 8)); @@ -38,6 +42,12 @@ static bool LoadJunglevision(const char *fn, unsigned bank, const char *prefix) : gmno < 128 + 88 ? int(gmno - 35) : -1; + bool isPercussion = a >= ins_count; + size_t patchId = (a < ins_count) ? (a + first_ins) : ((a - ins_count) + first_drum); + BanksDump::MidiBank &bnk = isPercussion ? bnkPercussion : bnkMelodique; + BanksDump::InstrumentEntry inst; + BanksDump::Operator ops[5]; + insdata tmp[2]; tmp[0].data[0] = data[offset + 2]; @@ -83,6 +93,13 @@ static bool LoadJunglevision(const char *fn, unsigned bank, const char *prefix) tmp[1].finetune -= 12; } + if(data[offset] != 0) + inst.instFlags |= BanksDump::InstrumentEntry::WOPL_Ins_4op; + inst.percussionKeyNumber = data[offset + 1]; + inst.setFbConn(data[offset + 7], data[offset + 7 + 11]); + db.toOps(tmp[0], ops, 0); + db.toOps(tmp[1], ops, 2); + std::string name; if(midi_index >= 0) name = std::string(1, '\377') + MidiInsName[midi_index]; @@ -92,22 +109,26 @@ static bool LoadJunglevision(const char *fn, unsigned bank, const char *prefix) if(!data[offset]) { - size_t resno = InsertIns(tmp[0], tmp2, name, name2); - SetBank(bank, gmno, resno); +// size_t resno = InsertIns(tmp[0], tmp2, name, name2); +// SetBank(bank, gmno, resno); } else // Double instrument { - size_t resno = InsertIns(tmp[0], tmp[1], tmp2, name, name2); - SetBank(bank, gmno, resno); +// size_t resno = InsertIns(tmp[0], tmp[1], tmp2, name, name2); +// SetBank(bank, gmno, resno); } + db.addInstrument(bnk, patchId, inst, ops, fn); } - AdlBankSetup setup; - setup.volumeModel = VOLUME_9X; - setup.deepTremolo = true; - setup.deepVibrato = true; - setup.scaleModulators = false; - SetBankSetup(bank, setup); + db.addMidiBank(bankDb, false, bnkMelodique); + db.addMidiBank(bankDb, true, bnkPercussion); + +// AdlBankSetup setup; +// setup.volumeModel = VOLUME_9X; +// setup.deepTremolo = true; +// setup.deepVibrato = true; +// setup.scaleModulators = false; +// SetBankSetup(bank, setup); return true; } |