aboutsummaryrefslogtreecommitdiff
path: root/utils/gen_adldata/file_formats/load_bnk.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/gen_adldata/file_formats/load_bnk.h')
-rw-r--r--utils/gen_adldata/file_formats/load_bnk.h37
1 files changed, 26 insertions, 11 deletions
diff --git a/utils/gen_adldata/file_formats/load_bnk.h b/utils/gen_adldata/file_formats/load_bnk.h
index f1412ba..4021831 100644
--- a/utils/gen_adldata/file_formats/load_bnk.h
+++ b/utils/gen_adldata/file_formats/load_bnk.h
@@ -7,7 +7,9 @@
#include <cstdint>
#include <string>
-static bool LoadBNK(const char *fn, unsigned bank, const char *prefix, bool is_fat, bool percussive)
+bool BankFormats::LoadBNK(BanksDump &db, const char *fn, unsigned bank,
+ const std::string &bankTitle, const char *prefix,
+ bool is_fat, bool percussive)
{
#ifdef HARD_BANKS
writeIni("HMI", fn, prefix, bank, percussive ? INI_Drums : INI_Melodic);
@@ -25,6 +27,9 @@ static bool LoadBNK(const char *fn, unsigned bank, const char *prefix, bool is_f
}
std::fclose(fp);
+ size_t bankDb = db.initBank(bank, bankTitle, BanksDump::BankEntry::SETUP_Generic);
+ BanksDump::MidiBank bnk;
+
/*printf("%s:\n", fn);*/
//unsigned short version = *(short*)&data[0]; // major,minor (2 bytes)
// "ADLIB-" (6 bytes)
@@ -80,6 +85,9 @@ static bool LoadBNK(const char *fn, unsigned bank, const char *prefix, bool is_f
else
sprintf(name2, "%s%u", prefix, n);
+ BanksDump::InstrumentEntry inst;
+ BanksDump::Operator ops[5];
+
insdata tmp;
tmp.data[0] = uint8_t(
(op1[ 9] << 7) // TREMOLO FLAG
@@ -115,16 +123,21 @@ static bool LoadBNK(const char *fn, unsigned bank, const char *prefix, bool is_f
if(is_fat) tmp.data[10] ^= 1;
- size_t resno = InsertIns(tmp, tmp2, std::string(1, '\377') + name, name2);
+ db.toOps(tmp, ops, 0);
+ inst.percussionKeyNumber = is_fat ? voice_num : (percussive ? usage_flag : 0);
+ inst.setFbConn(op1[2] * 2 + op1[12]);
+
+// size_t resno = InsertIns(tmp, tmp2, std::string(1, '\377') + name, name2);
if(!is_fat)
{
- SetBank(bank, (unsigned int)gmno, resno);
+// SetBank(bank, (unsigned int)gmno, resno);
+ db.addInstrument(bnk, n & 127, inst, ops, fn);
}
else
{
- if(name[2] == 'O' || name[1] == 'M') SetBank(bank + 0, (unsigned int)gmno, resno);
- if(name[2] == 'S' || name[1] == 'M') SetBank(bank + 1, (unsigned int)gmno, resno);
+// if(name[2] == 'O' || name[1] == 'M') SetBank(bank + 0, (unsigned int)gmno, resno);
+// if(name[2] == 'S' || name[1] == 'M') SetBank(bank + 1, (unsigned int)gmno, resno);
}
/*
@@ -151,12 +164,14 @@ static bool LoadBNK(const char *fn, unsigned bank, const char *prefix, bool is_f
*/
}
- AdlBankSetup setup;
- setup.volumeModel = VOLUME_Generic;
- setup.deepTremolo = false;
- setup.deepVibrato = false;
- setup.scaleModulators = false;
- SetBankSetup(bank, setup);
+ db.addMidiBank(bankDb, percussive, bnk);
+
+// AdlBankSetup setup;
+// setup.volumeModel = VOLUME_Generic;
+// setup.deepTremolo = false;
+// setup.deepVibrato = false;
+// setup.scaleModulators = false;
+// SetBankSetup(bank, setup);
return true;
}