summaryrefslogtreecommitdiff
path: root/gtk2_ardour/pianokeyboard.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-03-29 00:47:26 +0100
committerRobin Gareus <robin@gareus.org>2020-03-29 00:47:26 +0100
commit9873e1d211e1e5033d710aa5acefe2dcd9cfea1c (patch)
tree53a9d8b049d83d34dd812b4bac51130b88cba55e /gtk2_ardour/pianokeyboard.cc
parent7e0abc0dbf87cca4a66381eb006bedce91125c39 (diff)
VKeybd: fix stuck keys when changing octaves - #7957
Using the mouse/dropdown to change octaves can lead to stuck notes when keys are held. This is because the most recently pressed key, sends key-repeat events. Using Arrow keys to switch octaves does not cause this problem, because the most recently pressed key will be an arrow key. PS. Changing Chromatic Transpose while holding keys still can lead to stuck notes. This will need a different fix.
Diffstat (limited to 'gtk2_ardour/pianokeyboard.cc')
-rw-r--r--gtk2_ardour/pianokeyboard.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gtk2_ardour/pianokeyboard.cc b/gtk2_ardour/pianokeyboard.cc
index ae508fdd7a..5a17a35ee1 100644
--- a/gtk2_ardour/pianokeyboard.cc
+++ b/gtk2_ardour/pianokeyboard.cc
@@ -642,6 +642,15 @@ APianoKeyboard::on_key_press_event (GdkEventKey* event)
return true;
}
+ std::map<std::string, int>::const_iterator kv = _note_stack.find (key);
+ if (kv != _note_stack.end ()) {
+ /* key is already pressed, ignore event.
+ * this can happen when changing the octave with the mouse
+ * while playing.
+ */
+ return true;
+ }
+
note += _octave * 12;
assert (key);