prepare for .opm support

goodbye addInstrumentFromFile
hello instrumentFromFile + addInstrumentPtr

these changes are required to allow loading instrument banks
This commit is contained in:
tildearrow 2022-04-03 01:56:49 -05:00
parent 44d72c2106
commit e44d081adc
3 changed files with 49 additions and 32 deletions

View file

@ -2628,15 +2628,20 @@ bool FurnaceGUI::loop() {
case GUI_FILE_EXPORT_AUDIO_PER_CHANNEL:
exportAudio(copyOfName,DIV_EXPORT_MODE_MANY_CHAN);
break;
case GUI_FILE_INS_OPEN:
if (e->addInstrumentFromFile(copyOfName.c_str())) {
case GUI_FILE_INS_OPEN: {
std::vector<DivInstrument*> instruments=e->instrumentFromFile(copyOfName.c_str());
if (!instruments.empty()) {
if (!e->getWarnings().empty()) {
showWarning(e->getWarnings(),GUI_WARN_GENERIC);
}
for (DivInstrument* i: instruments) {
e->addInstrumentPtr(i);
}
} else {
showError("cannot load instrument! ("+e->getLastError()+")");
}
break;
}
case GUI_FILE_WAVE_OPEN:
e->addWaveFromFile(copyOfName.c_str());
MARK_MODIFIED;