Vkeybd: force release notes on panic
authorRobin Gareus <robin@gareus.org>
Thu, 26 Dec 2019 11:17:20 +0000 (12:17 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 26 Dec 2019 11:17:20 +0000 (12:17 +0100)
If key(s) are still being pressed, a key-repeat will re-trigger
the most recently pressed note (depending on keyboard settings).

gtk2_ardour/pianokeyboard.cc
gtk2_ardour/pianokeyboard.h
gtk2_ardour/virtual_keyboard_window.cc

index d317a33bed271795b670b5720188e8d4bc9947ac..c4e0df0ebc2fdcc5c8258cc5e843210c81e145d9 100644 (file)
@@ -1044,6 +1044,13 @@ APianoKeyboard::sustain_release ()
        }
 }
 
+void
+APianoKeyboard::reset ()
+{
+       sustain_release ();
+       stop_unsustained_notes ();
+}
+
 void
 APianoKeyboard::set_note_on (int note)
 {
index 042afcd2834ff7f10b3e550f1589cfe281323c98..bf92e20936f9e96b171e20da16d910e75567ff73 100644 (file)
@@ -52,6 +52,7 @@ public:
 
        void set_note_on (int note);
        void set_note_off (int note);
+       void reset ();
 
        void set_grand_piano_highlight (bool enabled);
        void set_annotate_layout (bool enabled);
index ebe5a040e0355467e61d2da8e51f3f84e9f79de8..2af739e920adb8fbabb75923a42d58967ab64c55 100644 (file)
@@ -398,6 +398,7 @@ VirtualKeyboardWindow::update_octave_range ()
 bool
 VirtualKeyboardWindow::send_panic_message (GdkEventButton*)
 {
+       _piano.reset ();
        uint8_t channel = PBD::atoi (_midi_channel.get_text ()) - 1;
        uint8_t ev[3];
        ev[0] = MIDI_CMD_CONTROL | channel;