diff options
author | Jack Humbert <jack.humb@gmail.com> | 2017-03-28 09:26:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-28 09:26:54 -0400 |
commit | 7e37daa2ce6edad82de3835384176b51a8081537 (patch) | |
tree | 58f349edb063667c9ae0affd99cec2bf7a7f93cb /quantum/quantum_keycodes.h | |
parent | 216f669276b30393fb35a409011ccdad8b521156 (diff) | |
parent | 0734f569409974624b40735fcd498dac9adba2d2 (diff) | |
download | qmk_firmware-7e37daa2ce6edad82de3835384176b51a8081537.tar.gz qmk_firmware-7e37daa2ce6edad82de3835384176b51a8081537.zip |
Merge pull request #1112 from newsboytko/newsboytko/midi-keycodes
Flesh out MIDI support
Diffstat (limited to 'quantum/quantum_keycodes.h')
-rw-r--r-- | quantum/quantum_keycodes.h | 241 |
1 files changed, 234 insertions, 7 deletions
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 78b02a0de..1e3df9fa6 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h | |||
@@ -1,7 +1,16 @@ | |||
1 | |||
2 | #ifndef QUANTUM_KEYCODES_H | 1 | #ifndef QUANTUM_KEYCODES_H |
3 | #define QUANTUM_KEYCODES_H | 2 | #define QUANTUM_KEYCODES_H |
4 | 3 | ||
4 | #ifndef MIDI_ENABLE_STRICT | ||
5 | #define MIDI_ENABLE_STRICT 0 | ||
6 | #endif | ||
7 | |||
8 | #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)) | ||
9 | #ifndef MIDI_TONE_KEYCODE_OCTAVES | ||
10 | #define MIDI_TONE_KEYCODE_OCTAVES 3 | ||
11 | #endif | ||
12 | #endif | ||
13 | |||
5 | enum quantum_keycodes { | 14 | enum quantum_keycodes { |
6 | // Ranges used in shortucuts - not to be used directly | 15 | // Ranges used in shortucuts - not to be used directly |
7 | QK_TMK = 0x0000, | 16 | QK_TMK = 0x0000, |
@@ -107,9 +116,230 @@ enum quantum_keycodes { | |||
107 | MUV_IN, | 116 | MUV_IN, |
108 | MUV_DE, | 117 | MUV_DE, |
109 | 118 | ||
110 | // Midi mode on/off | 119 | // Midi |
111 | MIDI_ON, | 120 | #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) |
112 | MIDI_OFF, | 121 | MI_ON, // send midi notes when music mode is enabled |
122 | MI_OFF, // don't send midi notes when music mode is enabled | ||
123 | #endif | ||
124 | |||
125 | #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)) | ||
126 | MIDI_TONE_MIN, | ||
127 | |||
128 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 0 | ||
129 | MI_C = MIDI_TONE_MIN, | ||
130 | MI_Cs, | ||
131 | MI_Db = MI_Cs, | ||
132 | MI_D, | ||
133 | MI_Ds, | ||
134 | MI_Eb = MI_Ds, | ||
135 | MI_E, | ||
136 | MI_F, | ||
137 | MI_Fs, | ||
138 | MI_Gb = MI_Fs, | ||
139 | MI_G, | ||
140 | MI_Gs, | ||
141 | MI_Ab = MI_Gs, | ||
142 | MI_A, | ||
143 | MI_As, | ||
144 | MI_Bb = MI_As, | ||
145 | MI_B, | ||
146 | #endif | ||
147 | |||
148 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 1 | ||
149 | MI_C_1, | ||
150 | MI_Cs_1, | ||
151 | MI_Db_1 = MI_Cs_1, | ||
152 | MI_D_1, | ||
153 | MI_Ds_1, | ||
154 | MI_Eb_1 = MI_Ds_1, | ||
155 | MI_E_1, | ||
156 | MI_F_1, | ||
157 | MI_Fs_1, | ||
158 | MI_Gb_1 = MI_Fs_1, | ||
159 | MI_G_1, | ||
160 | MI_Gs_1, | ||
161 | MI_Ab_1 = MI_Gs_1, | ||
162 | MI_A_1, | ||
163 | MI_As_1, | ||
164 | MI_Bb_1 = MI_As_1, | ||
165 | MI_B_1, | ||
166 | #endif | ||
167 | |||
168 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 2 | ||
169 | MI_C_2, | ||
170 | MI_Cs_2, | ||
171 | MI_Db_2 = MI_Cs_2, | ||
172 | MI_D_2, | ||
173 | MI_Ds_2, | ||
174 | MI_Eb_2 = MI_Ds_2, | ||
175 | MI_E_2, | ||
176 | MI_F_2, | ||
177 | MI_Fs_2, | ||
178 | MI_Gb_2 = MI_Fs_2, | ||
179 | MI_G_2, | ||
180 | MI_Gs_2, | ||
181 | MI_Ab_2 = MI_Gs_2, | ||
182 | MI_A_2, | ||
183 | MI_As_2, | ||
184 | MI_Bb_2 = MI_As_2, | ||
185 | MI_B_2, | ||
186 | #endif | ||
187 | |||
188 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 3 | ||
189 | MI_C_3, | ||
190 | MI_Cs_3, | ||
191 | MI_Db_3 = MI_Cs_3, | ||
192 | MI_D_3, | ||
193 | MI_Ds_3, | ||
194 | MI_Eb_3 = MI_Ds_3, | ||
195 | MI_E_3, | ||
196 | MI_F_3, | ||
197 | MI_Fs_3, | ||
198 | MI_Gb_3 = MI_Fs_3, | ||
199 | MI_G_3, | ||
200 | MI_Gs_3, | ||
201 | MI_Ab_3 = MI_Gs_3, | ||
202 | MI_A_3, | ||
203 | MI_As_3, | ||
204 | MI_Bb_3 = MI_As_3, | ||
205 | MI_B_3, | ||
206 | #endif | ||
207 | |||
208 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 4 | ||
209 | MI_C_4, | ||
210 | MI_Cs_4, | ||
211 | MI_Db_4 = MI_Cs_4, | ||
212 | MI_D_4, | ||
213 | MI_Ds_4, | ||
214 | MI_Eb_4 = MI_Ds_4, | ||
215 | MI_E_4, | ||
216 | MI_F_4, | ||
217 | MI_Fs_4, | ||
218 | MI_Gb_4 = MI_Fs_4, | ||
219 | MI_G_4, | ||
220 | MI_Gs_4, | ||
221 | MI_Ab_4 = MI_Gs_4, | ||
222 | MI_A_4, | ||
223 | MI_As_4, | ||
224 | MI_Bb_4 = MI_As_4, | ||
225 | MI_B_4, | ||
226 | #endif | ||
227 | |||
228 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5 | ||
229 | MI_C_5, | ||
230 | MI_Cs_5, | ||
231 | MI_Db_5 = MI_Cs_5, | ||
232 | MI_D_5, | ||
233 | MI_Ds_5, | ||
234 | MI_Eb_5 = MI_Ds_5, | ||
235 | MI_E_5, | ||
236 | MI_F_5, | ||
237 | MI_Fs_5, | ||
238 | MI_Gb_5 = MI_Fs_5, | ||
239 | MI_G_5, | ||
240 | MI_Gs_5, | ||
241 | MI_Ab_5 = MI_Gs_5, | ||
242 | MI_A_5, | ||
243 | MI_As_5, | ||
244 | MI_Bb_5 = MI_As_5, | ||
245 | MI_B_5, | ||
246 | #endif | ||
247 | |||
248 | #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5 | ||
249 | MIDI_TONE_MAX = MI_B_5, | ||
250 | #elif MIDI_TONE_KEYCODE_OCTAVES > 4 | ||
251 | MIDI_TONE_MAX = MI_B_4, | ||
252 | #elif MIDI_TONE_KEYCODE_OCTAVES > 3 | ||
253 | MIDI_TONE_MAX = MI_B_3, | ||
254 | #elif MIDI_TONE_KEYCODE_OCTAVES > 2 | ||
255 | MIDI_TONE_MAX = MI_B_2, | ||
256 | #elif MIDI_TONE_KEYCODE_OCTAVES > 1 | ||
257 | MIDI_TONE_MAX = MI_B_1, | ||
258 | #elif MIDI_TONE_KEYCODE_OCTAVES > 0 | ||
259 | MIDI_TONE_MAX = MI_B, | ||
260 | #endif | ||
261 | |||
262 | MIDI_OCTAVE_MIN, | ||
263 | MI_OCT_N2 = MIDI_OCTAVE_MIN, | ||
264 | MI_OCT_N1, | ||
265 | MI_OCT_0, | ||
266 | MI_OCT_1, | ||
267 | MI_OCT_2, | ||
268 | MI_OCT_3, | ||
269 | MI_OCT_4, | ||
270 | MI_OCT_5, | ||
271 | MI_OCT_6, | ||
272 | MI_OCT_7, | ||
273 | MIDI_OCTAVE_MAX = MI_OCT_7, | ||
274 | MI_OCTD, // octave down | ||
275 | MI_OCTU, // octave up | ||
276 | |||
277 | MIDI_TRANSPOSE_MIN, | ||
278 | MI_TRNS_N6 = MIDI_TRANSPOSE_MIN, | ||
279 | MI_TRNS_N5, | ||
280 | MI_TRNS_N4, | ||
281 | MI_TRNS_N3, | ||
282 | MI_TRNS_N2, | ||
283 | MI_TRNS_N1, | ||
284 | MI_TRNS_0, | ||
285 | MI_TRNS_1, | ||
286 | MI_TRNS_2, | ||
287 | MI_TRNS_3, | ||
288 | MI_TRNS_4, | ||
289 | MI_TRNS_5, | ||
290 | MI_TRNS_6, | ||
291 | MIDI_TRANSPOSE_MAX = MI_TRNS_6, | ||
292 | MI_TRNSD, // transpose down | ||
293 | MI_TRNSU, // transpose up | ||
294 | |||
295 | MIDI_VELOCITY_MIN, | ||
296 | MI_VEL_1 = MIDI_VELOCITY_MIN, | ||
297 | MI_VEL_2, | ||
298 | MI_VEL_3, | ||
299 | MI_VEL_4, | ||
300 | MI_VEL_5, | ||
301 | MI_VEL_6, | ||
302 | MI_VEL_7, | ||
303 | MI_VEL_8, | ||
304 | MI_VEL_9, | ||
305 | MI_VEL_10, | ||
306 | MIDI_VELOCITY_MAX = MI_VEL_10, | ||
307 | MI_VELD, // velocity down | ||
308 | MI_VELU, // velocity up | ||
309 | |||
310 | MIDI_CHANNEL_MIN, | ||
311 | MI_CH1 = MIDI_CHANNEL_MIN, | ||
312 | MI_CH2, | ||
313 | MI_CH3, | ||
314 | MI_CH4, | ||
315 | MI_CH5, | ||
316 | MI_CH6, | ||
317 | MI_CH7, | ||
318 | MI_CH8, | ||
319 | MI_CH9, | ||
320 | MI_CH10, | ||
321 | MI_CH11, | ||
322 | MI_CH12, | ||
323 | MI_CH13, | ||
324 | MI_CH14, | ||
325 | MI_CH15, | ||
326 | MI_CH16, | ||
327 | MIDI_CHANNEL_MAX = MI_CH16, | ||
328 | MI_CHD, // previous channel | ||
329 | MI_CHU, // next channel | ||
330 | |||
331 | MI_ALLOFF, // all notes off | ||
332 | |||
333 | MI_SUS, // sustain | ||
334 | MI_PORT, // portamento | ||
335 | MI_SOST, // sostenuto | ||
336 | MI_SOFT, // soft pedal | ||
337 | MI_LEG, // legato | ||
338 | |||
339 | MI_MOD, // modulation | ||
340 | MI_MODSD, // decrease modulation speed | ||
341 | MI_MODSU, // increase modulation speed | ||
342 | #endif // MIDI_ADVANCED | ||
113 | 343 | ||
114 | // Backlight functionality | 344 | // Backlight functionality |
115 | BL_0, | 345 | BL_0, |
@@ -279,9 +509,6 @@ enum quantum_keycodes { | |||
279 | #define BL_ON BL_9 | 509 | #define BL_ON BL_9 |
280 | #define BL_OFF BL_0 | 510 | #define BL_OFF BL_0 |
281 | 511 | ||
282 | #define MI_ON MIDI_ON | ||
283 | #define MI_OFF MIDI_OFF | ||
284 | |||
285 | // GOTO layer - 16 layers max | 512 | // GOTO layer - 16 layers max |
286 | // when: | 513 | // when: |
287 | // ON_PRESS = 1 | 514 | // ON_PRESS = 1 |