Ardour  9.0-pre0-582-g084a23a80d
piano_key_bindings.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010-2016 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef _PIANO_KEY_BINDINGS_H_
21 #define _PIANO_KEY_BINDINGS_H_
22 
23 #include <map>
24 #include <string>
25 
26 #include <gtk/gtk.h>
27 
28 /*
29  * Class for mapping PC keyboard keys to note pitches. Used by the
30  * Virtual MIDI Keyboard.
31  */
33 {
34 public:
37 
38  enum Layout {
45  S_QWERTZ
46  };
47 
49  int key_binding (const char* key) const;
50  const char* note_binding (int note) const;
51 
52  static Layout layout (std::string const& l);
53  static const char* get_keycode (GdkEventKey* event);
54 
55 private:
56  void bind_key (const char* key, int note);
57  void clear_notes ();
58 
63 
66 
67  std::map<std::string, int> _key_bindings;
68  std::map<int, std::string> _note_bindings;
69 };
70 
71 #endif
const char * note_binding(int note) const
void bind_keys_dvorak()
void set_layout(Layout layout)
void bind_key(const char *key, int note)
static const char * get_keycode(GdkEventKey *event)
void bind_keys_qwertz()
void bind_keys_basic_qwertz()
void bind_keys_qwerty()
void bind_keys_azerty()
static Layout layout(std::string const &l)
std::map< std::string, int > _key_bindings
void bind_keys_basic_qwerty()
std::map< int, std::string > _note_bindings
int key_binding(const char *key) const