Virtual-keyboard: momentary pedal (no toggle)

This commit is contained in:
Robin Gareus 2019-11-03 17:48:36 +01:00
parent 4a99efe588
commit 5ec9e0fa5e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 9 additions and 14 deletions

View File

@ -556,7 +556,7 @@ APianoKeyboard::on_key_press_event (GdkEventKey* event)
return false; return false;
} }
if (note == 129) { if (note == 129) {
toggle_sustain (); sustain_press ();
return true; return true;
} }
@ -582,14 +582,20 @@ APianoKeyboard::on_key_release_event (GdkEventKey* event)
return false; return false;
} }
if (key_binding (key) == 128) { int note = key_binding (key);
if (note == 128) {
Rest (); /* EMIT SIGNAL */ Rest (); /* EMIT SIGNAL */
return true; return true;
} }
if (note == 129) {
sustain_release ();
return true;
}
std::map<std::string, int>::const_iterator kv = _note_stack.find (key); std::map<std::string, int>::const_iterator kv = _note_stack.find (key);
if (kv == _note_stack.end ()) { if (kv == _note_stack.end ()) {
return key_binding (key) != -1; return note != -1;
} }
release_key (kv->second); release_key (kv->second);
@ -926,16 +932,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 void
APianoKeyboard::sustain_press () APianoKeyboard::sustain_press ()
{ {

View File

@ -79,7 +79,6 @@ private:
void queue_note_draw (int note); void queue_note_draw (int note);
void toggle_sustain ();
void press_key (int key, int vel); void press_key (int key, int vel);
void release_key (int key); void release_key (int key);
void stop_sustained_notes (); void stop_sustained_notes ();