diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2019-07-08 02:28:48 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2019-07-08 02:28:48 +0300 |
commit | bfd932874f5e107eaf81c40b87d5c722170a5ace (patch) | |
tree | d3f0dbf53533eb2716d3a62a62c460eeb9cf6ba6 /utils/gen_adldata | |
parent | ddeb2a43fd2bf7361f388b5bc6692b0efc46665c (diff) | |
download | libADLMIDI-bfd932874f5e107eaf81c40b87d5c722170a5ace.tar.gz libADLMIDI-bfd932874f5e107eaf81c40b87d5c722170a5ace.tar.bz2 libADLMIDI-bfd932874f5e107eaf81c40b87d5c722170a5ace.zip |
More accurate silence detector
Now, there are very low level of error! The only one weird condition is still be there...
Diffstat (limited to 'utils/gen_adldata')
-rw-r--r-- | utils/gen_adldata/file_formats/load_ail.h | 2 | ||||
-rw-r--r-- | utils/gen_adldata/file_formats/load_bisqwit.h | 2 | ||||
-rw-r--r-- | utils/gen_adldata/file_formats/load_bnk.h | 2 | ||||
-rw-r--r-- | utils/gen_adldata/file_formats/load_bnk2.h | 4 | ||||
-rw-r--r-- | utils/gen_adldata/file_formats/load_ea.h | 10 | ||||
-rw-r--r-- | utils/gen_adldata/file_formats/load_ibk.h | 2 | ||||
-rw-r--r-- | utils/gen_adldata/file_formats/load_jv.h | 2 | ||||
-rw-r--r-- | utils/gen_adldata/file_formats/load_op2.h | 2 | ||||
-rw-r--r-- | utils/gen_adldata/file_formats/load_tmb.h | 2 | ||||
-rw-r--r-- | utils/gen_adldata/file_formats/load_wopl.h | 2 | ||||
-rw-r--r-- | utils/gen_adldata/measurer.cpp | 31 | ||||
-rw-r--r-- | utils/gen_adldata/progs_cache.cpp | 160 | ||||
-rw-r--r-- | utils/gen_adldata/progs_cache.h | 6 |
13 files changed, 141 insertions, 86 deletions
diff --git a/utils/gen_adldata/file_formats/load_ail.h b/utils/gen_adldata/file_formats/load_ail.h index 286b665..a12789b 100644 --- a/utils/gen_adldata/file_formats/load_ail.h +++ b/utils/gen_adldata/file_formats/load_ail.h @@ -169,7 +169,7 @@ bool BankFormats::LoadMiles(BanksDump &db, const char *fn, unsigned bank, unsigned fb_c = data[offset + 3 + 5]; inst.fbConn = (static_cast<uint_fast16_t>(fb_c & 0x0F)) | (static_cast<uint_fast16_t>((fb_c & 0x0E) | (fb_c >> 7)) << 8); - db.addInstrument(bnk, h.patch, inst, ops); + db.addInstrument(bnk, h.patch, inst, ops, fn); } } diff --git a/utils/gen_adldata/file_formats/load_bisqwit.h b/utils/gen_adldata/file_formats/load_bisqwit.h index 8ff91b1..7ea3a38 100644 --- a/utils/gen_adldata/file_formats/load_bisqwit.h +++ b/utils/gen_adldata/file_formats/load_bisqwit.h @@ -71,7 +71,7 @@ bool BankFormats::LoadBisqwit(BanksDump &db, const char *fn, unsigned bank, cons inst.fbConn = uint_fast16_t(tmp[0].data[10]) | (uint_fast16_t(tmp[1].data[10]) << 8); inst.percussionKeyNumber = a >= 128 ? tmp2.notenum : 0; inst.noteOffset1 = a < 128 ? tmp2.notenum : 0; - db.addInstrument(bnk, patchId, inst, ops); + db.addInstrument(bnk, patchId, inst, ops, fn); } std::fclose(fp); diff --git a/utils/gen_adldata/file_formats/load_bnk.h b/utils/gen_adldata/file_formats/load_bnk.h index beb2bd5..9379de5 100644 --- a/utils/gen_adldata/file_formats/load_bnk.h +++ b/utils/gen_adldata/file_formats/load_bnk.h @@ -132,7 +132,7 @@ bool BankFormats::LoadBNK(BanksDump &db, const char *fn, unsigned bank, if(!is_fat) { SetBank(bank, (unsigned int)gmno, resno); - db.addInstrument(bnk, n & 127, inst, ops); + db.addInstrument(bnk, n & 127, inst, ops, fn); } else { diff --git a/utils/gen_adldata/file_formats/load_bnk2.h b/utils/gen_adldata/file_formats/load_bnk2.h index e977cd7..5468cb5 100644 --- a/utils/gen_adldata/file_formats/load_bnk2.h +++ b/utils/gen_adldata/file_formats/load_bnk2.h @@ -124,7 +124,7 @@ bool BankFormats::LoadBNK2(BanksDump &db, const char *fn, unsigned bank, SetBank(bank, (unsigned int)gmno, resno); inst.instFlags |= BanksDump::InstrumentEntry::WOPL_Ins_4op; - db.addInstrument(bnk, patchId, inst, opsD); + db.addInstrument(bnk, patchId, inst, opsD, fn); } else { @@ -132,7 +132,7 @@ bool BankFormats::LoadBNK2(BanksDump &db, const char *fn, unsigned bank, size_t resno = InsertIns(tmp[0], tmp2, std::string(1, '\377') + name, name2); SetBank(bank, (unsigned int)gmno, resno); - db.addInstrument(bnk, patchId, inst, opsD); + db.addInstrument(bnk, patchId, inst, opsD, fn); } } diff --git a/utils/gen_adldata/file_formats/load_ea.h b/utils/gen_adldata/file_formats/load_ea.h index 7d15883..4b40b0f 100644 --- a/utils/gen_adldata/file_formats/load_ea.h +++ b/utils/gen_adldata/file_formats/load_ea.h @@ -113,14 +113,14 @@ bool BankFormats::LoadEA(BanksDump &db, const char *fn, unsigned bank, size_t resno = InsertIns(tmp, tmp2, std::string(1, '\377') + name, name2); SetBank(bank, gmno, resno); - db.addInstrument(bnkMelodic, gmno, inst, ops); + db.addInstrument(bnkMelodic, gmno, inst, ops, fn); if(gmno == 10) { /*tmp.finetune=0;*/ tmp2.notenum = 0x49; SetBank(bank, 0x80 + 0x36, InsertIns(tmp, tmp2, std::string(1, '\377') + MidiInsName[0x80 + 0x36 - 35], std::string(1, '\377') + prefix + "P54")); inst.percussionKeyNumber = 0x49; - db.addInstrument(bnkPercussion, 0x36, inst, ops); + db.addInstrument(bnkPercussion, 0x36, inst, ops, fn); } if(gmno == 18) @@ -128,7 +128,7 @@ bool BankFormats::LoadEA(BanksDump &db, const char *fn, unsigned bank, /*tmp.finetune=0;*/ tmp2.notenum = 0x17; SetBank(bank, 0x80 + 0x2A, InsertIns(tmp, tmp2, std::string(1, '\377') + MidiInsName[0x80 + 0x2A - 35], std::string(1, '\377') + prefix + "P42")); inst.percussionKeyNumber = 0x17; - db.addInstrument(bnkPercussion, 0x2A, inst, ops); + db.addInstrument(bnkPercussion, 0x2A, inst, ops, fn); } if(gmno == 16) @@ -136,7 +136,7 @@ bool BankFormats::LoadEA(BanksDump &db, const char *fn, unsigned bank, /*tmp.finetune=0;*/ tmp2.notenum = 0x0C; SetBank(bank, 0x80 + 0x24, InsertIns(tmp, tmp2, std::string(1, '\377') + MidiInsName[0x80 + 0x24 - 35], std::string(1, '\377') + prefix + "P36")); inst.percussionKeyNumber = 0x0C; - db.addInstrument(bnkPercussion, 0x24, inst, ops); + db.addInstrument(bnkPercussion, 0x24, inst, ops, fn); } if(gmno == 17) @@ -144,7 +144,7 @@ bool BankFormats::LoadEA(BanksDump &db, const char *fn, unsigned bank, /*tmp.finetune=0;*/ tmp2.notenum = 0x01; SetBank(bank, 0x80 + 0x26, InsertIns(tmp, tmp2, std::string(1, '\377') + MidiInsName[0x80 + 0x26 - 35], std::string(1, '\377') + prefix + "P38")); inst.percussionKeyNumber = 0x01; - db.addInstrument(bnkPercussion, 0x26, inst, ops); + db.addInstrument(bnkPercussion, 0x26, inst, ops, fn); } } diff --git a/utils/gen_adldata/file_formats/load_ibk.h b/utils/gen_adldata/file_formats/load_ibk.h index 029d193..d4b54f6 100644 --- a/utils/gen_adldata/file_formats/load_ibk.h +++ b/utils/gen_adldata/file_formats/load_ibk.h @@ -115,7 +115,7 @@ bool BankFormats::LoadIBK(BanksDump &db, const char *fn, unsigned bank, size_t resno = InsertIns(tmp, tmp2, std::string(1, '\377') + name, name2); SetBank(bank, (unsigned int)gmno, resno); - db.addInstrument(bnk, a, inst, ops); + db.addInstrument(bnk, a, inst, ops, fn); } db.addMidiBank(bankDb, percussive, bnk); diff --git a/utils/gen_adldata/file_formats/load_jv.h b/utils/gen_adldata/file_formats/load_jv.h index ef36f76..bb4fbdb 100644 --- a/utils/gen_adldata/file_formats/load_jv.h +++ b/utils/gen_adldata/file_formats/load_jv.h @@ -117,7 +117,7 @@ bool BankFormats::LoadJunglevision(BanksDump &db, const char *fn, unsigned bank, size_t resno = InsertIns(tmp[0], tmp[1], tmp2, name, name2); SetBank(bank, gmno, resno); } - db.addInstrument(bnk, patchId, inst, ops); + db.addInstrument(bnk, patchId, inst, ops, fn); } db.addMidiBank(bankDb, false, bnkMelodique); diff --git a/utils/gen_adldata/file_formats/load_op2.h b/utils/gen_adldata/file_formats/load_op2.h index 6599a9f..e31a803 100644 --- a/utils/gen_adldata/file_formats/load_op2.h +++ b/utils/gen_adldata/file_formats/load_op2.h @@ -155,7 +155,7 @@ bool BankFormats::LoadDoom(BanksDump &db, const char *fn, unsigned bank, const s SetBank(bank, (unsigned int)gmno, resno); } - db.addInstrument(bnk, patchId, inst, ops); + db.addInstrument(bnk, patchId, inst, ops, fn); /*const Doom_OPL2instrument& A = ins.patchdata[0]; const Doom_OPL2instrument& B = ins.patchdata[1]; diff --git a/utils/gen_adldata/file_formats/load_tmb.h b/utils/gen_adldata/file_formats/load_tmb.h index 66ced30..d9d57dd 100644 --- a/utils/gen_adldata/file_formats/load_tmb.h +++ b/utils/gen_adldata/file_formats/load_tmb.h @@ -80,7 +80,7 @@ bool BankFormats::LoadTMB(BanksDump &db, const char *fn, unsigned bank, const st size_t resno = InsertIns(tmp, tmp2, name, name2); SetBank(bank, gmno, resno); - db.addInstrument(bnk, patchId, inst, ops); + db.addInstrument(bnk, patchId, inst, ops, fn); } db.addMidiBank(bankDb, false, bnkMelodique); diff --git a/utils/gen_adldata/file_formats/load_wopl.h b/utils/gen_adldata/file_formats/load_wopl.h index 0db911c..047ed7b 100644 --- a/utils/gen_adldata/file_formats/load_wopl.h +++ b/utils/gen_adldata/file_formats/load_wopl.h @@ -271,7 +271,7 @@ bool BankFormats::LoadWopl(BanksDump &db, const char *fn, unsigned bank, const s SetBank(bank, gmno, resno); } } - db.addInstrument(bnk, i, inst, ops); + db.addInstrument(bnk, i, inst, ops, fn); } db.addMidiBank(bankDb, is_percussion, bnk); } diff --git a/utils/gen_adldata/measurer.cpp b/utils/gen_adldata/measurer.cpp index 33e9012..4e47723 100644 --- a/utils/gen_adldata/measurer.cpp +++ b/utils/gen_adldata/measurer.cpp @@ -285,7 +285,6 @@ struct TinySynth m_chip->writeReg(0x40 + o2, y2 & 0xFF); } - m_isSilentGuess = BanksDump::isSilent(ops, ins.fbConn, opsNum, isPseudo4ops); // for(unsigned n = 0; n < m_notesNum; ++n) // { // static const unsigned char patchdata[11] = @@ -737,16 +736,36 @@ DurationInfo MeasureDurations(BanksDump &db, const BanksDump::InstrumentEntry &i db.instruments[ins.instId].delay_off_ms = result.ms_sound_koff; if(result.nosound) db.instruments[ins.instId].instFlags |= BanksDump::InstrumentEntry::WOPL_Ins_IsBlank; -// { -// bool silent1 = result.nosound; -// bool silent2 = synth.m_isSilentGuess; -// assert(silent1 == silent2); -// } + #ifdef GEN_ADLDATA_DEEP_DEBUG /***************DEBUG******************/ ctx_wave_close(waveCtx); /***************DEBUG******************/ #endif + { + bool silent1 = result.nosound; + bool silent2 = BanksDump::isSilent(db, ins); + if(silent1 != silent2) + { + std::fprintf(stdout, + "\n\n%04lu - %s AN=%u NN=%u -- con1=%lu, con2=%lu\n%s computed - %s actual (%g peak)\n\n", + ins.instId, synth.m_isPseudo4op ? "pseudo4op" : + synth.m_isReal4op ? "4op" : "2op", + synth.m_actualNotesNum, + synth.m_notesNum, + (ins.fbConn) & 0x01, + (ins.fbConn >> 8) & 0x01, + silent2 ? "silent" : "sound", + silent1 ? "silent" : "sound", + peak_amplitude_value); + for(auto &sss : ins.instMetas) + std::fprintf(stdout, "%s\n", sss.c_str()); + BanksDump::isSilent(db, ins, true); + std::fprintf(stdout, "\n\n"); + std::fflush(stdout); + assert(silent1 == silent2); + } + } return result; } diff --git a/utils/gen_adldata/progs_cache.cpp b/utils/gen_adldata/progs_cache.cpp index 2225f74..d4ba10e 100644 --- a/utils/gen_adldata/progs_cache.cpp +++ b/utils/gen_adldata/progs_cache.cpp @@ -204,7 +204,10 @@ void BanksDump::addMidiBank(size_t bankId, bool percussion, BanksDump::MidiBank be.melodic.push_back(b.midiBankId); } -void BanksDump::addInstrument(BanksDump::MidiBank &bank, size_t patchId, BanksDump::InstrumentEntry e, BanksDump::Operator *ops) +void BanksDump::addInstrument(BanksDump::MidiBank &bank, size_t patchId, + BanksDump::InstrumentEntry e, + BanksDump::Operator *ops, + const std::string &meta) { assert(patchId < 128); size_t opsCount = ((e.instFlags & InstrumentEntry::WOPL_Ins_4op) != 0 || @@ -237,11 +240,14 @@ void BanksDump::addInstrument(BanksDump::MidiBank &bank, size_t patchId, BanksDu if(it == instruments.end()) { e.instId = instruments.size(); + e.instMetas.push_back(meta + "_" + std::to_string(patchId)); instruments.push_back(e); } else { e.instId = it->instId; + e.instMetas.push_back(meta + "_" + std::to_string(patchId)); + it->instMetas.push_back(meta + "_" + std::to_string(patchId)); } bank.instruments[patchId] = static_cast<int_fast32_t>(e.instId); } @@ -398,70 +404,98 @@ void BanksDump::exportBanks(const std::string &outPath, const std::string &heade std::fclose(out); } -bool BanksDump::isSilent(const BanksDump::Operator *ops, uint_fast16_t fbConn, size_t countOps, bool pseudo4op) +struct OpCheckData { - // TODO: Implement this completely!!! - const uint_fast8_t conn1 = (fbConn) & 0x01; - const uint_fast8_t conn2 = (fbConn >> 8) & 0x01; - const uint_fast8_t egEn[4] = - { - static_cast<uint_fast8_t>(((ops[0].d_E862 & 0xFF) >> 5) & 0x01), - static_cast<uint_fast8_t>(((ops[1].d_E862 & 0xFF) >> 5) & 0x01), - static_cast<uint_fast8_t>(((ops[2].d_E862 & 0xFF) >> 5) & 0x01), - static_cast<uint_fast8_t>(((ops[3].d_E862 & 0xFF) >> 5) & 0x01) - }; - const uint_fast8_t attack[4] = + uint_fast8_t egEn; + uint_fast8_t attack; + uint_fast8_t decay; + uint_fast8_t sustain; + uint_fast8_t release; + uint_fast8_t level; + + void setData(uint_fast32_t d_E862, uint_fast32_t d_40) { - static_cast<uint_fast8_t>((((ops[0].d_E862 >> 8) & 0xFF) >> 4) & 0x0F), - static_cast<uint_fast8_t>((((ops[1].d_E862 >> 8) & 0xFF) >> 4) & 0x0F), - static_cast<uint_fast8_t>((((ops[2].d_E862 >> 8) & 0xFF) >> 4) & 0x0F), - static_cast<uint_fast8_t>((((ops[3].d_E862 >> 8) & 0xFF) >> 4) & 0x0F) - }; - const uint_fast8_t decay[4] = - { - static_cast<uint_fast8_t>((ops[0].d_E862 >> 8) & 0x0F), - static_cast<uint_fast8_t>((ops[1].d_E862 >> 8) & 0x0F), - static_cast<uint_fast8_t>((ops[2].d_E862 >> 8) & 0x0F), - static_cast<uint_fast8_t>((ops[3].d_E862 >> 8) & 0x0F) - }; - const uint_fast8_t sustain[4] = + egEn = static_cast<uint_fast8_t>(((d_E862 & 0xFF) >> 5) & 0x01); + decay = static_cast<uint_fast8_t>((d_E862 >> 8) & 0x0F); + attack = static_cast<uint_fast8_t>((d_E862 >> 12) & 0x0F); + release = static_cast<uint_fast8_t>((d_E862 >> 16) & 0x0F); + sustain = static_cast<uint_fast8_t>((d_E862 >> 20) & 0x0F); + level = static_cast<uint_fast8_t>(d_40); + } + + bool isOpSilent(bool moreInfo) { - static_cast<uint_fast8_t>((((ops[0].d_E862 >> 16) & 0xFF) >> 4) & 0x0F), - static_cast<uint_fast8_t>((((ops[1].d_E862 >> 16) & 0xFF) >> 4) & 0x0F), - static_cast<uint_fast8_t>((((ops[2].d_E862 >> 16) & 0xFF) >> 4) & 0x0F), - static_cast<uint_fast8_t>((((ops[3].d_E862 >> 16) & 0xFF) >> 4) & 0x0F) - }; - const uint_fast8_t level[4] = + // level=0x3f - silence + // attack=0x00 - silence + // attack=0x0F & sustain=0x0F & decay=0x0F - silence + // attack=0x0F & decay=0x0F & release=0x00 & egOff - silence + if(level == 0x3F) + { + if(moreInfo) + std::fprintf(stdout, "== volume=0x3F ==\n"); + return true; + } + if(attack == 0x00) + { + if(moreInfo) + std::fprintf(stdout, "== attack=0x00 ==\n"); + return true; + } + if(attack == 0x0F && sustain == 0x0F && decay == 0x0F) + { + if(moreInfo) + std::fprintf(stdout, "== attack=0x0F, sustain=0x0F, decay=0x0F ==\n"); + return true; + } + if(attack == 0x0F && decay == 0x0F && release == 0x00 && !egEn) + { + if(moreInfo) + std::fprintf(stdout, "== attack=0x0F, decay=0x0F, release=0x00, !egEn ==\n"); + return true; + } + return false; + } +}; + +bool BanksDump::isSilent(const BanksDump &db, const BanksDump::InstrumentEntry &ins, bool moreInfo) +{ + bool isPseudo4ops = ((ins.instFlags & BanksDump::InstrumentEntry::WOPL_Ins_Pseudo4op) != 0); + bool is4ops = ((ins.instFlags & BanksDump::InstrumentEntry::WOPL_Ins_4op) != 0) && !isPseudo4ops; + size_t opsNum = (is4ops || isPseudo4ops) ? 4 : 2; + BanksDump::Operator ops[4]; + assert(ins.ops[0] >= 0); + assert(ins.ops[1] >= 0); + ops[0] = db.operators[ins.ops[0]]; + ops[1] = db.operators[ins.ops[1]]; + if(opsNum > 2) { - static_cast<uint_fast8_t>(ops[0].d_40), - static_cast<uint_fast8_t>(ops[1].d_40), - static_cast<uint_fast8_t>(ops[2].d_40), - static_cast<uint_fast8_t>(ops[3].d_40) - }; + assert(ins.ops[2] >= 0); + assert(ins.ops[3] >= 0); + ops[2] = db.operators[ins.ops[2]]; + ops[3] = db.operators[ins.ops[3]]; + } + return isSilent(ops, ins.fbConn, opsNum, isPseudo4ops, moreInfo); +} - // level=0x3f - silence - // attack=0x00 - silence - // attack=0x0F & sustain=0 & decay=0x0F & egOff - silence +bool BanksDump::isSilent(const BanksDump::Operator *ops, uint_fast16_t fbConn, size_t countOps, bool pseudo4op, bool moreInfo) +{ + // TODO: Implement this completely!!! + const uint_fast8_t conn1 = (fbConn) & 0x01; + const uint_fast8_t conn2 = (fbConn >> 8) & 0x01; + OpCheckData opd[4]; + for(size_t i = 0; i < 4; i++) + opd[i].setData(ops[i].d_E862, ops[i].d_40); if(countOps == 2) { if(conn1 == 0) { - if(level[1] == 0x3F) - return true; - if(attack[1] == 0x00) - return true; - if(attack[1] == 0x0F && sustain[1] == 0x00 && decay[1] == 0x0F && !egEn[1]) + if(opd[1].isOpSilent(moreInfo)) return true; } if(conn1 == 1) { - if(level[0] == 0x3F && level[1] == 0x3F) - return true; - if(attack[0] == 0x00 && attack[1] == 0x00) - return true; - if(attack[0] == 0x0F && sustain[0] == 0x00 && decay[0] == 0x0F && !egEn[0] && - attack[1] == 0x0F && sustain[1] == 0x00 && decay[1] == 0x0F && !egEn[1]) + if(opd[0].isOpSilent(moreInfo) && opd[1].isOpSilent(moreInfo)) return true; } } @@ -469,38 +503,38 @@ bool BanksDump::isSilent(const BanksDump::Operator *ops, uint_fast16_t fbConn, s { bool silent1 = false; bool silent2 = false; - if(conn1 == 0 && (level[1] == 0x3F)) + if(conn1 == 0 && opd[1].isOpSilent(moreInfo)) silent1 = true; - if(conn1 == 1 && (level[0] == 0x3F) && (level[1] == 0x3F)) + if(conn1 == 1 && opd[0].isOpSilent(moreInfo) && opd[1].isOpSilent(moreInfo)) silent1 = true; - if(conn2 == 0 && (level[3] == 0x3F)) + if(conn2 == 0 && opd[3].isOpSilent(moreInfo)) silent2 = true; - if(conn2 == 1 && (level[2] == 0x3F) && (level[3] == 0x3F)) + if(conn2 == 1 && opd[2].isOpSilent(moreInfo) && opd[3].isOpSilent(moreInfo)) silent2 = true; if(silent1 && silent2) return true; } else if(countOps == 4 && !pseudo4op) { - if(conn1 == 0 && conn1 == 0) // FM-FM [0, 0, 0, 1] + if(conn1 == 0 && conn2 == 0) // FM-FM [0, 0, 0, 1] { - if(level[3] == 0x3F ) + if(opd[3].isOpSilent(moreInfo)) return true; } - if(conn1 == 1 && conn1 == 0) // AM-FM [1, 0, 0, 1] + if(conn1 == 1 && conn2 == 0) // AM-FM [1, 0, 0, 1] { - if(level[0] == 0x3F && level[3] == 0x3F) + if(opd[0].isOpSilent(moreInfo) && opd[3].isOpSilent(moreInfo)) return true; } - if(conn1 == 0 && conn1 == 1) // FM-AM [0, 1, 0, 1] + if(conn1 == 0 && conn2 == 1) // FM-AM [0, 1, 0, 1] { - if(level[1] == 0x3F && level[3] == 0x3F) + if(opd[1].isOpSilent(moreInfo) && opd[3].isOpSilent(moreInfo)) return true; } - if(conn1 == 1 && conn1 == 1) // FM-AM [1, 0, 1, 1] + if(conn1 == 1 && conn2 == 1) // FM-AM [1, 0, 1, 1] { - if(level[0] == 0x3F && level[2] == 0x3F && level[3] == 0x3F) + if(opd[0].isOpSilent(moreInfo) && opd[2].isOpSilent(moreInfo) && opd[3].isOpSilent(moreInfo)) return true; } } diff --git a/utils/gen_adldata/progs_cache.h b/utils/gen_adldata/progs_cache.h index 0f25a5d..195c5f1 100644 --- a/utils/gen_adldata/progs_cache.h +++ b/utils/gen_adldata/progs_cache.h @@ -297,6 +297,7 @@ struct BanksDump struct InstrumentEntry { uint_fast32_t instId = 0; + std::vector<std::string> instMetas; typedef enum WOPL_InstrumentFlags { @@ -399,11 +400,12 @@ struct BanksDump static void toOps(const insdata &inData, Operator *outData, size_t begin = 0); //! WIP - static bool isSilent(const Operator *ops, uint_fast16_t fbConn, size_t countOps = 2, bool pseudo4op = false); + static bool isSilent(const BanksDump &db, const BanksDump::InstrumentEntry &ins, bool moreInfo = false); + static bool isSilent(const Operator *ops, uint_fast16_t fbConn, size_t countOps = 2, bool pseudo4op = false, bool moreInfo = false); size_t initBank(size_t bankId, const std::string &title, uint_fast16_t bankSetup); void addMidiBank(size_t bankId, bool percussion, MidiBank b); - void addInstrument(MidiBank &bank, size_t patchId, InstrumentEntry e, Operator *ops); + void addInstrument(MidiBank &bank, size_t patchId, InstrumentEntry e, Operator *ops, const std::string &meta = std::string()); void exportBanks(const std::string &outPath, const std::string &headerName = "adlmidi_db.h"); }; |