aboutsummaryrefslogtreecommitdiff
path: root/utils/gen_adldata/file_formats/load_bisqwit.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/gen_adldata/file_formats/load_bisqwit.h')
-rw-r--r--utils/gen_adldata/file_formats/load_bisqwit.h54
1 files changed, 31 insertions, 23 deletions
diff --git a/utils/gen_adldata/file_formats/load_bisqwit.h b/utils/gen_adldata/file_formats/load_bisqwit.h
index 9749a76..63d133f 100644
--- a/utils/gen_adldata/file_formats/load_bisqwit.h
+++ b/utils/gen_adldata/file_formats/load_bisqwit.h
@@ -4,36 +4,41 @@
#include "../progs_cache.h"
#include "../midi_inst_list.h"
-static bool LoadBisqwit(const char *fn, unsigned bank, const char *prefix)
+bool BankFormats::LoadBisqwit(BanksDump &db, const char *fn, unsigned bank, const std::string &bankTitle, const char *prefix)
{
- #ifdef HARD_BANKS
+#ifdef HARD_BANKS
writeIni("Bisqwit", fn, prefix, bank, INI_Both);
- #endif
+#endif
FILE *fp = std::fopen(fn, "rb");
if(!fp)
return false;
- for(uint32_t a = 0; a < 256; ++a)
+ size_t bankDb = db.initBank(bank, bankTitle, BanksDump::BankEntry::SETUP_Generic);
+ BanksDump::MidiBank bnkMelodique;
+ BanksDump::MidiBank bnkPercussion;
+
+ for(uint32_t a = 0, patchId = 0; a < 256; ++a, patchId++)
{
//unsigned offset = a * 25;
uint32_t gmno = a;
+ bool isPercussion = gmno >= 128;
int32_t midi_index = gmno < 128 ? int32_t(gmno)
: gmno < 128 + 35 ? -1
: gmno < 128 + 88 ? int32_t(gmno - 35)
: -1;
+ if(patchId == 128)
+ patchId = 0;
+
+ BanksDump::MidiBank &bnk = isPercussion ? bnkPercussion : bnkMelodique;
+ BanksDump::InstrumentEntry inst;
+ BanksDump::Operator ops[5];
- struct ins tmp2;
- tmp2.notenum = (uint8_t)std::fgetc(fp);
- tmp2.pseudo4op = false;
- tmp2.voice2_fine_tune = 0.0;
- tmp2.midi_velocity_offset = 0;
- tmp2.rhythmModeDrum = 0;
+ uint8_t notenum = static_cast<uint8_t>(std::fgetc(fp));
- insdata tmp[2];
+ InstBuffer tmp[2];
for(int side = 0; side < 2; ++side)
{
- tmp[side].finetune = (int8_t)std::fgetc(fp);
- tmp[side].diff = false;
+ std::fseek(fp, +1, SEEK_CUR); // skip first byte, unused "fine tune"
if(std::fread(tmp[side].data, 1, 11, fp) != 11)
return false;
}
@@ -45,19 +50,22 @@ static bool LoadBisqwit(const char *fn, unsigned bank, const char *prefix)
sprintf(name2, "%s%c%u", prefix,
(gmno < 128 ? 'M' : 'P'), gmno & 127);
- tmp[1].diff = (tmp[0] != tmp[1]);
- tmp2.real4op = tmp[1].diff;
- size_t resno = InsertIns(tmp[0], tmp[1], tmp2, name, name2, (tmp[0] == tmp[1]));
- SetBank(bank, gmno, resno);
+ db.toOps(tmp[0].d, ops, 0);
+ if(tmp[0].d != tmp[1].d)
+ {
+ inst.instFlags |= BanksDump::InstrumentEntry::WOPL_Ins_4op;
+ db.toOps(tmp[1].d, ops, 2);
+ }
+
+ inst.fbConn = uint_fast16_t(tmp[0].data[10]) | (uint_fast16_t(tmp[1].data[10]) << 8);
+ inst.percussionKeyNumber = a >= 128 ? notenum : 0;
+ inst.noteOffset1 = a < 128 ? notenum : 0;
+ db.addInstrument(bnk, patchId, inst, ops, fn);
}
std::fclose(fp);
- AdlBankSetup setup;
- setup.volumeModel = VOLUME_Generic;
- setup.deepTremolo = true;
- setup.deepVibrato = true;
- setup.scaleModulators = false;
- SetBankSetup(bank, setup);
+ db.addMidiBank(bankDb, false, bnkMelodique);
+ db.addMidiBank(bankDb, true, bnkPercussion);
return true;
}