From 9fd0813d16e379890eaba29e407e27a66fd8eba1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 26 Oct 2019 23:49:57 +0200 Subject: Add support for single-octave "asdfg.." key-bindings --- gtk2_ardour/pianokeyboard.cc | 66 +++++++++++++++++++++++++++++++++++++++++++- gtk2_ardour/pianokeyboard.h | 7 ++++- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/pianokeyboard.cc b/gtk2_ardour/pianokeyboard.cc index 85187ce116..0e4e677e2f 100644 --- a/gtk2_ardour/pianokeyboard.cc +++ b/gtk2_ardour/pianokeyboard.cc @@ -462,6 +462,65 @@ APianoKeyboard::bind_keys_dvorak () #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 APianoKeyboard::on_key_press_event (GdkEventKey* event) { @@ -825,7 +884,6 @@ APianoKeyboard::set_annotate_octave (bool enabled) void APianoKeyboard::set_monophonic (bool monophonic) { - _monophonic = monophonic; } @@ -978,6 +1036,12 @@ APianoKeyboard::set_keyboard_layout (Layout layout) case DVORAK: bind_keys_dvorak (); break; + case S_QWERTY: + bind_keys_basic_qwerty (); + break; + case S_QWERTZ: + bind_keys_basic_qwertz (); + break; } queue_draw (); } diff --git a/gtk2_ardour/pianokeyboard.h b/gtk2_ardour/pianokeyboard.h index b3089f4d0b..7380cb5ec1 100644 --- a/gtk2_ardour/pianokeyboard.h +++ b/gtk2_ardour/pianokeyboard.h @@ -39,7 +39,9 @@ public: QWERTY, QWERTZ, AZERTY, - DVORAK + DVORAK, + S_QWERTY, + S_QWERTZ }; void sustain_press (); @@ -90,6 +92,9 @@ private: void bind_keys_azerty (); 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_velocity_for_note_at_y (int note, int y) const; -- cgit v1.2.3