GUI: wave/sample preview using piano

This commit is contained in:
tildearrow 2022-11-02 03:30:51 -05:00
parent 4531e9fc9c
commit d4e1a3e65f
1 changed files with 35 additions and 9 deletions

View File

@ -375,9 +375,21 @@ void FurnaceGUI::drawPiano() {
int note=i-60;
if (!pianoKeyPressed[i]) {
if (pianoKeyPressed[i]!=oldPianoKeyPressed[i]) {
e->synchronized([this,note]() {
e->autoNoteOff(-1,note);
});
switch (curWindow) {
case GUI_WINDOW_WAVE_LIST:
case GUI_WINDOW_WAVE_EDIT:
e->stopWavePreview();
break;
case GUI_WINDOW_SAMPLE_LIST:
case GUI_WINDOW_SAMPLE_EDIT:
e->stopSamplePreview();
break;
default:
e->synchronized([this,note]() {
e->autoNoteOff(-1,note);
});
break;
}
}
}
}
@ -386,10 +398,22 @@ void FurnaceGUI::drawPiano() {
int note=i-60;
if (pianoKeyPressed[i]) {
if (pianoKeyPressed[i]!=oldPianoKeyPressed[i]) {
e->synchronized([this,note]() {
e->autoNoteOn(-1,curIns,note);
});
if (edit) noteInput(note,0);
switch (curWindow) {
case GUI_WINDOW_WAVE_LIST:
case GUI_WINDOW_WAVE_EDIT:
e->previewWave(curWave,note);
break;
case GUI_WINDOW_SAMPLE_LIST:
case GUI_WINDOW_SAMPLE_EDIT:
e->previewSample(curWave,note);
break;
default:
e->synchronized([this,note]() {
e->autoNoteOn(-1,curIns,note);
});
if (edit) noteInput(note,0);
break;
}
}
}
}
@ -398,7 +422,8 @@ void FurnaceGUI::drawPiano() {
ImGui::EndTable();
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_PIANO;
// don't worry about it
//if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_PIANO;
ImGui::End();
// draw input pad if necessary
@ -459,7 +484,8 @@ void FurnaceGUI::drawPiano() {
}
ImGui::EndDisabled();
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_PIANO;
// don't worry about it either
//if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_PIANO;
ImGui::End();
}
}