Add support for single-octave "asdfg.." key-bindings

This commit is contained in:
Robin Gareus 2019-10-26 23:49:57 +02:00
parent f1d614b15d
commit 9fd0813d16
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 71 additions and 2 deletions

View file

@ -462,6 +462,65 @@ APianoKeyboard::bind_keys_dvorak ()
#endif #endif
} }
void
APianoKeyboard::bind_keys_basic_qwerty ()
{
clear_notes ();
bind_key ("space", 128);
/* simple - middle rows only */
bind_key ("a", 12); /* C0 */
bind_key ("w", 13);
bind_key ("s", 14);
bind_key ("e", 15);
bind_key ("d", 16);
bind_key ("f", 17);
bind_key ("t", 18);
bind_key ("g", 19);
bind_key ("y", 20);
bind_key ("h", 21);
bind_key ("u", 22);
bind_key ("j", 23);
bind_key ("k", 24); /* C1 */
bind_key ("o", 25);
bind_key ("l", 26);
bind_key ("p", 27);
bind_key ("semicolon", 28);
bind_key ("apostrophe", 29);
}
void
APianoKeyboard::bind_keys_basic_qwertz ()
{
clear_notes ();
bind_key ("space", 128);
/* simple - middle rows only */
bind_key ("a", 12); /* C0 */
bind_key ("w", 13);
bind_key ("s", 14);
bind_key ("e", 15);
bind_key ("d", 16);
bind_key ("f", 17);
bind_key ("t", 18);
bind_key ("g", 19);
bind_key ("z", 20);
bind_key ("h", 21);
bind_key ("u", 22);
bind_key ("j", 23);
bind_key ("k", 24); /* C1 */
bind_key ("o", 25);
bind_key ("l", 26);
bind_key ("p", 27);
bind_key ("semicolon", 28);
bind_key ("apostrophe", 29);
}
bool bool
APianoKeyboard::on_key_press_event (GdkEventKey* event) APianoKeyboard::on_key_press_event (GdkEventKey* event)
{ {
@ -825,7 +884,6 @@ APianoKeyboard::set_annotate_octave (bool enabled)
void void
APianoKeyboard::set_monophonic (bool monophonic) APianoKeyboard::set_monophonic (bool monophonic)
{ {
_monophonic = monophonic; _monophonic = monophonic;
} }
@ -978,6 +1036,12 @@ APianoKeyboard::set_keyboard_layout (Layout layout)
case DVORAK: case DVORAK:
bind_keys_dvorak (); bind_keys_dvorak ();
break; break;
case S_QWERTY:
bind_keys_basic_qwerty ();
break;
case S_QWERTZ:
bind_keys_basic_qwertz ();
break;
} }
queue_draw (); queue_draw ();
} }

View file

@ -39,7 +39,9 @@ public:
QWERTY, QWERTY,
QWERTZ, QWERTZ,
AZERTY, AZERTY,
DVORAK DVORAK,
S_QWERTY,
S_QWERTZ
}; };
void sustain_press (); void sustain_press ();
@ -90,6 +92,9 @@ private:
void bind_keys_azerty (); void bind_keys_azerty ();
void bind_keys_dvorak (); void bind_keys_dvorak ();
void bind_keys_basic_qwerty ();
void bind_keys_basic_qwertz ();
int get_note_for_xy (int x, int y) const; int get_note_for_xy (int x, int y) const;
int get_velocity_for_note_at_y (int note, int y) const; int get_velocity_for_note_at_y (int note, int y) const;