diff --git a/src/gui/piano.cpp b/src/gui/piano.cpp index f4d4d9df..cb9ce969 100644 --- a/src/gui/piano.cpp +++ b/src/gui/piano.cpp @@ -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(); } }