-
Notifications
You must be signed in to change notification settings - Fork 0
/
keymaps.h
71 lines (49 loc) · 1.37 KB
/
keymaps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
struct KeySettings {
String action;
int value;
};
struct Keymap {
String type;
int typeNum;
String keymapName;
UIState *UI;
KeySettings keys[16];
};
Keymap base = {
"normal",
0,
"BASE",
&UIbase,
{
{"oct", -1}, {"note", 1}, {"note", 3}, {"empty", 0}, {"note", 6}, {"note", 8}, {"note", 10}, {"oct", 1},
{"note", 0}, {"note", 2}, {"note", 4}, {"note", 5}, {"note", 7}, {"note", 9}, {"note", 11}, {"note", 12}
}
};
Keymap twoOctaves = {
"2oct",
1,
"2OCT",
&UI2oct,
{
{"note", 12}, {"note", 14}, {"note", 16}, {"note", 17}, {"note", 19}, {"note", 21}, {"note", 23}, {"note", 24},
{"note", 0}, {"note", 2}, {"note", 4}, {"note", 5}, {"note", 7}, {"note", 9}, {"note", 11}, {"note", 12}
}
};
#define KEYMAP_COUNT 2
Keymap keymaps[KEYMAP_COUNT] = { base, twoOctaves };
int currentKeymap = 0;
int changeKeymap(int keymapOffset) {
int keymapCount = KEYMAP_COUNT;
if (keymapOffset > 0 && (currentKeymap + keymapOffset) >= keymapCount) {
currentKeymap = 0;
keymapSelector.update(keymaps[0].keymapName);
} else if ((currentKeymap + keymapOffset) < 0) {
currentKeymap = (keymapCount - 1);
keymapSelector.update(keymaps[currentKeymap].keymapName);
} else {
currentKeymap += keymapOffset;
keymapSelector.update(keymaps[currentKeymap].keymapName);
}
keymaps[currentKeymap].UI->select();
return 0;
}