GUI: batch wave/sample loading
This commit is contained in:
parent
d7d744e633
commit
c9d7b371e1
|
@ -1525,7 +1525,9 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
||||||
"all files", ".*"},
|
"all files", ".*"},
|
||||||
"compatible files{.fuw,.dmw},.*",
|
"compatible files{.fuw,.dmw},.*",
|
||||||
workingDirWave,
|
workingDirWave,
|
||||||
dpiScale
|
dpiScale,
|
||||||
|
NULL, // TODO
|
||||||
|
(type==GUI_FILE_WAVE_OPEN)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case GUI_FILE_WAVE_SAVE:
|
case GUI_FILE_WAVE_SAVE:
|
||||||
|
@ -1567,7 +1569,9 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
||||||
"all files", ".*"},
|
"all files", ".*"},
|
||||||
"compatible files{.wav,.dmc,.brr},.*",
|
"compatible files{.wav,.dmc,.brr},.*",
|
||||||
workingDirSample,
|
workingDirSample,
|
||||||
dpiScale
|
dpiScale,
|
||||||
|
NULL, // TODO
|
||||||
|
(type==GUI_FILE_SAMPLE_OPEN)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case GUI_FILE_SAMPLE_OPEN_RAW:
|
case GUI_FILE_SAMPLE_OPEN_RAW:
|
||||||
|
@ -4038,16 +4042,33 @@ bool FurnaceGUI::loop() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GUI_FILE_SAMPLE_OPEN: {
|
case GUI_FILE_SAMPLE_OPEN: {
|
||||||
DivSample* s=e->sampleFromFile(copyOfName.c_str());
|
String errs="there were some errors while loading wavetables:\n";
|
||||||
if (s==NULL) {
|
bool warn=false;
|
||||||
showError(e->getLastError());
|
for (String i: fileDialog->getFileName()) {
|
||||||
} else {
|
DivSample* s=e->sampleFromFile(i.c_str());
|
||||||
if (e->addSamplePtr(s)==-1) {
|
if (s==NULL) {
|
||||||
showError(e->getLastError());
|
if (fileDialog->getFileName().size()>1) {
|
||||||
|
warn=true;
|
||||||
|
errs+=fmt::sprintf("- %s: %s\n",i,e->getLastError());
|
||||||
|
} else {
|
||||||
|
showError(e->getLastError());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MARK_MODIFIED;
|
if (e->addSamplePtr(s)==-1) {
|
||||||
|
if (fileDialog->getFileName().size()>1) {
|
||||||
|
warn=true;
|
||||||
|
errs+=fmt::sprintf("- %s: %s\n",i,e->getLastError());
|
||||||
|
} else {
|
||||||
|
showError(e->getLastError());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MARK_MODIFIED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (warn) {
|
||||||
|
showWarning(errs,GUI_WARN_GENERIC);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GUI_FILE_SAMPLE_OPEN_REPLACE: {
|
case GUI_FILE_SAMPLE_OPEN_REPLACE: {
|
||||||
|
@ -4165,17 +4186,34 @@ bool FurnaceGUI::loop() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GUI_FILE_WAVE_OPEN: {
|
case GUI_FILE_WAVE_OPEN: {
|
||||||
DivWavetable* wave=e->waveFromFile(copyOfName.c_str());
|
String errs="there were some errors while loading wavetables:\n";
|
||||||
if (wave==NULL) {
|
bool warn=false;
|
||||||
showError("cannot load wavetable! ("+e->getLastError()+")");
|
for (String i: fileDialog->getFileName()) {
|
||||||
} else {
|
DivWavetable* wave=e->waveFromFile(i.c_str());
|
||||||
if (e->addWavePtr(wave)==-1) {
|
if (wave==NULL) {
|
||||||
showError("cannot load wavetable! ("+e->getLastError()+")");
|
if (fileDialog->getFileName().size()>1) {
|
||||||
|
warn=true;
|
||||||
|
errs+=fmt::sprintf("- %s: %s\n",i,e->getLastError());
|
||||||
|
} else {
|
||||||
|
showError("cannot load wavetable! ("+e->getLastError()+")");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MARK_MODIFIED;
|
if (e->addWavePtr(wave)==-1) {
|
||||||
RESET_WAVE_MACRO_ZOOM;
|
if (fileDialog->getFileName().size()>1) {
|
||||||
|
warn=true;
|
||||||
|
errs+=fmt::sprintf("- %s: %s\n",i,e->getLastError());
|
||||||
|
} else {
|
||||||
|
showError("cannot load wavetable! ("+e->getLastError()+")");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MARK_MODIFIED;
|
||||||
|
RESET_WAVE_MACRO_ZOOM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (warn) {
|
||||||
|
showWarning(errs,GUI_WARN_GENERIC);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GUI_FILE_WAVE_OPEN_REPLACE: {
|
case GUI_FILE_WAVE_OPEN_REPLACE: {
|
||||||
|
|
Loading…
Reference in a new issue