summaryrefslogtreecommitdiff
path: root/gtk2_ardour/pianokeyboard.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-11-03 17:48:36 +0100
committerRobin Gareus <robin@gareus.org>2019-11-03 17:50:25 +0100
commit5ec9e0fa5e4f91b545994ff80fa50c15a11a2491 (patch)
treef0eae25243222d9b143d4167804a84587a5be74d /gtk2_ardour/pianokeyboard.cc
parent4a99efe588656788bebeb5d124ca0002c2251aa9 (diff)
Virtual-keyboard: momentary pedal (no toggle)
Diffstat (limited to 'gtk2_ardour/pianokeyboard.cc')
-rw-r--r--gtk2_ardour/pianokeyboard.cc22
1 files changed, 9 insertions, 13 deletions
diff --git a/gtk2_ardour/pianokeyboard.cc b/gtk2_ardour/pianokeyboard.cc
index d7635cf3c6..9c56ae8a0e 100644
--- a/gtk2_ardour/pianokeyboard.cc
+++ b/gtk2_ardour/pianokeyboard.cc
@@ -556,7 +556,7 @@ APianoKeyboard::on_key_press_event (GdkEventKey* event)
return false;
}
if (note == 129) {
- toggle_sustain ();
+ sustain_press ();
return true;
}
@@ -582,14 +582,20 @@ APianoKeyboard::on_key_release_event (GdkEventKey* event)
return false;
}
- if (key_binding (key) == 128) {
+ int note = key_binding (key);
+
+ if (note == 128) {
Rest (); /* EMIT SIGNAL */
return true;
}
+ if (note == 129) {
+ sustain_release ();
+ return true;
+ }
std::map<std::string, int>::const_iterator kv = _note_stack.find (key);
if (kv == _note_stack.end ()) {
- return key_binding (key) != -1;
+ return note != -1;
}
release_key (kv->second);
@@ -927,16 +933,6 @@ APianoKeyboard::set_velocities (int min_vel, int max_vel, int key_vel)
}
void
-APianoKeyboard::toggle_sustain ()
-{
- if (_sustain_new_notes) {
- sustain_release ();
- } else {
- sustain_press ();
- }
-}
-
-void
APianoKeyboard::sustain_press ()
{
if (_sustain_new_notes) {