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.
This commit is contained in:
parent
7e0abc0dbf
commit
9873e1d211
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user