mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-30 08:23:01 +00:00
OPM import: Fix reset read procedural flow
This commit is contained in:
parent
f716ac262d
commit
3550ad512a
3 changed files with 7 additions and 5 deletions
|
@ -830,11 +830,14 @@ void DivEngine::loadOPM(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
||||||
m2Read = false,
|
m2Read = false,
|
||||||
c2Read = false;
|
c2Read = false;
|
||||||
|
|
||||||
|
DivInstrument* newPatch = nullptr;
|
||||||
|
|
||||||
auto completePatchRead = [&]() {
|
auto completePatchRead = [&]() {
|
||||||
return patchNameRead && lfoRead && characteristicRead && m1Read && c1Read && m2Read && c2Read;
|
return patchNameRead && lfoRead && characteristicRead && m1Read && c1Read && m2Read && c2Read;
|
||||||
};
|
};
|
||||||
auto resetPatchRead = [&]() {
|
auto resetPatchRead = [&]() {
|
||||||
patchNameRead = lfoRead = characteristicRead = m1Read = c1Read = m2Read = c2Read = false;
|
patchNameRead = lfoRead = characteristicRead = m1Read = c1Read = m2Read = c2Read = false;
|
||||||
|
newPatch = nullptr;
|
||||||
};
|
};
|
||||||
auto readOpmOperator = [](SafeReader& reader, DivInstrumentFM::Operator& op) {
|
auto readOpmOperator = [](SafeReader& reader, DivInstrumentFM::Operator& op) {
|
||||||
op.ar = atoi(reader.readString_Token().c_str());
|
op.ar = atoi(reader.readString_Token().c_str());
|
||||||
|
@ -850,8 +853,6 @@ void DivEngine::loadOPM(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
||||||
op.ssgEnv = atoi(reader.readString_Token().c_str());
|
op.ssgEnv = atoi(reader.readString_Token().c_str());
|
||||||
};
|
};
|
||||||
|
|
||||||
DivInstrument* newPatch = nullptr;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
reader.seek(0, SEEK_SET);
|
reader.seek(0, SEEK_SET);
|
||||||
while (!reader.isEOF()) {
|
while (!reader.isEOF()) {
|
||||||
|
@ -922,7 +923,7 @@ void DivEngine::loadOPM(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
||||||
|
|
||||||
if (completePatchRead()) {
|
if (completePatchRead()) {
|
||||||
insList.push_back(newPatch);
|
insList.push_back(newPatch);
|
||||||
newPatch = nullptr;
|
resetPatchRead();
|
||||||
++readCount;
|
++readCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1290,9 +1290,9 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
||||||
if (!dirExists(workingDirIns)) workingDirIns=getHomeDir();
|
if (!dirExists(workingDirIns)) workingDirIns=getHomeDir();
|
||||||
hasOpened=fileDialog->openLoad(
|
hasOpened=fileDialog->openLoad(
|
||||||
"Load Instrument",
|
"Load Instrument",
|
||||||
{"compatible files", "*.fui *.dmp *.tfi *.vgi *.s3i *.sbi *.bnk *.ff",
|
{"compatible files", "*.fui *.dmp *.tfi *.vgi *.s3i *.sbi *.bnk *.ff *.opm",
|
||||||
"all files", ".*"},
|
"all files", ".*"},
|
||||||
"compatible files{.fui,.dmp,.tfi,.vgi,.s3i,.sbi,.bnk,.ff},.*",
|
"compatible files{.fui,.dmp,.tfi,.vgi,.s3i,.sbi,.bnk,.ff,.opm},.*",
|
||||||
workingDirIns,
|
workingDirIns,
|
||||||
dpiScale
|
dpiScale
|
||||||
);
|
);
|
||||||
|
|
|
@ -2489,6 +2489,7 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
||||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fti",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
|
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fti",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
|
||||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".bti",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
|
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".bti",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
|
||||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".ff",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
|
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".ff",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
|
||||||
|
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".opm",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
|
||||||
|
|
||||||
if (updateFonts) {
|
if (updateFonts) {
|
||||||
if (fileDialog!=NULL) delete fileDialog;
|
if (fileDialog!=NULL) delete fileDialog;
|
||||||
|
|
Loading…
Reference in a new issue