Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select loaded instrument on open #1507

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions src/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3560,17 +3560,29 @@ bool FurnaceGUI::loop() {
if (!e->getWarnings().empty()) {
showWarning(e->getWarnings(),GUI_WARN_GENERIC);
}
int instrumentCount = -1;
for (DivInstrument* i: instruments) {
e->addInstrumentPtr(i);
instrumentCount = e->addInstrumentPtr(i);
}
if (instrumentCount >= 0) {
curIns = instrumentCount - 1;
}
nextWindow=GUI_WINDOW_INS_LIST;
MARK_MODIFIED;
} else if ((droppedWave=e->waveFromFile(ev.drop.file,false))!=NULL) {
e->addWavePtr(droppedWave);
int waveCount = -1;
waveCount = e->addWavePtr(droppedWave);
if (waveCount >= 0) {
curWave = waveCount - 1;
}
nextWindow=GUI_WINDOW_WAVE_LIST;
MARK_MODIFIED;
} else if ((droppedSample=e->sampleFromFile(ev.drop.file))!=NULL) {
e->addSamplePtr(droppedSample);
int sampleCount = -1;
sampleCount = e->addSamplePtr(droppedSample);
if (sampleCount >= 0) {
curSample = sampleCount;
}
nextWindow=GUI_WINDOW_SAMPLE_LIST;
MARK_MODIFIED;
} else if (modified) {
Expand Down Expand Up @@ -5032,8 +5044,12 @@ bool FurnaceGUI::loop() {
displayPendingIns=true;
pendingInsSingle=false;
} else { // load the only instrument
int instrumentCount = -1;
for (DivInstrument* i: instruments) {
e->addInstrumentPtr(i);
instrumentCount = e->addInstrumentPtr(i);
}
if (instrumentCount >= 0) {
curIns = instrumentCount - 1;
}
}
}
Expand Down Expand Up @@ -5083,14 +5099,17 @@ bool FurnaceGUI::loop() {
showError("cannot load wavetable! ("+e->getLastError()+")");
}
} else {
if (e->addWavePtr(wave)==-1) {
int waveCount = -1;
waveCount = e->addWavePtr(wave);
if (waveCount==-1) {
if (fileDialog->getFileName().size()>1) {
warn=true;
errs+=fmt::sprintf("- %s: %s\n",i,e->getLastError());
} else {
showError("cannot load wavetable! ("+e->getLastError()+")");
}
} else {
curWave = waveCount -1;
MARK_MODIFIED;
RESET_WAVE_MACRO_ZOOM;
}
Expand Down