diff options
author | Gabriel Young <gabeplaysdrums@live.com> | 2017-02-18 03:13:43 -0800 |
---|---|---|
committer | Gabriel Young <gabeplaysdrums@live.com> | 2017-02-19 16:42:04 -0800 |
commit | f2b2e05f126403c8a6f0fc3d542beddac7974e9b (patch) | |
tree | 2588e712e4f99c96379fc42b78594d11533e7f64 /quantum/process_keycode | |
parent | e405ab4bc6ff47d189d99c4d51aadf60a642d82a (diff) | |
download | qmk_firmware-f2b2e05f126403c8a6f0fc3d542beddac7974e9b.tar.gz qmk_firmware-f2b2e05f126403c8a6f0fc3d542beddac7974e9b.zip |
clean up commented code
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r-- | quantum/process_keycode/process_midi.c | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c index bc48b3905..acaae7c30 100644 --- a/quantum/process_keycode/process_midi.c +++ b/quantum/process_keycode/process_midi.c | |||
@@ -19,82 +19,6 @@ midi_config_t midi_config; | |||
19 | 19 | ||
20 | #define MIDI_INVALID_NOTE 0xFF | 20 | #define MIDI_INVALID_NOTE 0xFF |
21 | 21 | ||
22 | #if 0 | ||
23 | typedef struct { | ||
24 | uint64_t low; | ||
25 | uint64_t high; | ||
26 | } uint128_t; | ||
27 | |||
28 | #if 0 | ||
29 | static void right_shift_uint128_t(uint128_t* val, uint8_t shift) | ||
30 | { | ||
31 | uint64_t high_mask = ~0 >> (64 - shift); | ||
32 | uint64_t high_bits = (val->high & high_mask) << (64 - shift); | ||
33 | val->high = val->high >> shift; | ||
34 | val->low = (val->low >> shift) | high_bits; | ||
35 | } | ||
36 | #endif | ||
37 | |||
38 | static uint64_t left_shift_uint64_t(uint64_t val, uint8_t shift) | ||
39 | { | ||
40 | dprintf("left_shift_uint64_t(val, %c) ...\n", val, shift); | ||
41 | while (shift > 16u) { | ||
42 | dprintf(" left_shift_uint64_t: val=?, shift=%c\n", val, shift); | ||
43 | val <<= 16; | ||
44 | shift -= 16; | ||
45 | } | ||
46 | dprintf(" left_shift_uint64_t: val=?, shift=%c\n", val, shift); | ||
47 | val <<= shift; | ||
48 | return val; | ||
49 | } | ||
50 | |||
51 | static void set_bit_uint128_t(uint128_t* val, uint8_t shift) | ||
52 | { | ||
53 | uint64_t x = 1u; | ||
54 | |||
55 | if (shift < 64) | ||
56 | { | ||
57 | x = left_shift_uint64_t(x, shift); | ||
58 | dprintf("x: %d\n", x); | ||
59 | dprintf("set_bit_uint128_t (%d): 0x%016X%016X\n", shift, 0, x); | ||
60 | val->low = val->low | left_shift_uint64_t(1u, shift); | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | x = left_shift_uint64_t(x, shift - 64); | ||
65 | dprintf("set_bit_uint128_t (%d): 0x%016X%016X\n", shift, x, 0); | ||
66 | val->high = val->high | left_shift_uint64_t(1u, shift - 64); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | static void clear_bit_uint128_t(uint128_t* val, uint8_t shift) | ||
71 | { | ||
72 | if (shift < 64) | ||
73 | { | ||
74 | val->low = val->low & ~left_shift_uint64_t(1u, shift); | ||
75 | } | ||
76 | else | ||
77 | { | ||
78 | val->high = val->high & ~left_shift_uint64_t(1u, shift - 64); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | static bool is_bit_set_uint128_t(const uint128_t* val, uint8_t shift) | ||
83 | { | ||
84 | if (shift < 64) | ||
85 | { | ||
86 | return !!(val->low & (1u << shift)); | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | return !!(val->high & (1u << (shift - 64))); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | uint128_t note_status = { 0, 0 }; | ||
95 | #endif | ||
96 | |||
97 | |||
98 | #define MIDI_MAX_NOTES_ON 10 | 22 | #define MIDI_MAX_NOTES_ON 10 |
99 | 23 | ||
100 | typedef struct { | 24 | typedef struct { |
@@ -198,66 +122,5 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) | |||
198 | return false; | 122 | return false; |
199 | }; | 123 | }; |
200 | 124 | ||
201 | #if 0 | ||
202 | if (keycode == MI_ON && record->event.pressed) { | ||
203 | midi_activated = true; | ||
204 | #ifdef AUDIO_ENABLE | ||
205 | music_scale_user(); | ||
206 | #endif | ||
207 | return false; | ||
208 | } | ||
209 | |||
210 | if (keycode == MI_OFF && record->event.pressed) { | ||
211 | midi_activated = false; | ||
212 | midi_send_cc(&midi_device, 0, 0x7B, 0); | ||
213 | return false; | ||
214 | } | ||
215 | |||
216 | if (midi_activated) { | ||
217 | if (record->event.key.col == (MATRIX_COLS - 1) && record->event.key.row == (MATRIX_ROWS - 1)) { | ||
218 | if (record->event.pressed) { | ||
219 | midi_starting_note++; // Change key | ||
220 | midi_send_cc(&midi_device, 0, 0x7B, 0); | ||
221 | } | ||
222 | return false; | ||
223 | } | ||
224 | if (record->event.key.col == (MATRIX_COLS - 2) && record->event.key.row == (MATRIX_ROWS - 1)) { | ||
225 | if (record->event.pressed) { | ||
226 | midi_starting_note--; // Change key | ||
227 | midi_send_cc(&midi_device, 0, 0x7B, 0); | ||
228 | } | ||
229 | return false; | ||
230 | } | ||
231 | if (record->event.key.col == (MATRIX_COLS - 3) && record->event.key.row == (MATRIX_ROWS - 1) && record->event.pressed) { | ||
232 | midi_offset++; // Change scale | ||
233 | midi_send_cc(&midi_device, 0, 0x7B, 0); | ||
234 | return false; | ||
235 | } | ||
236 | if (record->event.key.col == (MATRIX_COLS - 4) && record->event.key.row == (MATRIX_ROWS - 1) && record->event.pressed) { | ||
237 | midi_offset--; // Change scale | ||
238 | midi_send_cc(&midi_device, 0, 0x7B, 0); | ||
239 | return false; | ||
240 | } | ||
241 | // basic | ||
242 | // uint8_t note = (midi_starting_note + SCALE[record->event.key.col + midi_offset])+12*(MATRIX_ROWS - record->event.key.row); | ||
243 | // advanced | ||
244 | // uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+12*(MATRIX_ROWS - record->event.key.row); | ||
245 | // guitar | ||
246 | uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+5*(MATRIX_ROWS - record->event.key.row); | ||
247 | // violin | ||
248 | // uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+7*(MATRIX_ROWS - record->event.key.row); | ||
249 | |||
250 | if (record->event.pressed) { | ||
251 | // midi_send_noteon(&midi_device, record->event.key.row, midi_starting_note + SCALE[record->event.key.col], 127); | ||
252 | midi_send_noteon(&midi_device, 0, note, 127); | ||
253 | } else { | ||
254 | // midi_send_noteoff(&midi_device, record->event.key.row, midi_starting_note + SCALE[record->event.key.col], 127); | ||
255 | midi_send_noteoff(&midi_device, 0, note, 127); | ||
256 | } | ||
257 | |||
258 | if (keycode < 0xFF) // ignores all normal keycodes, but lets RAISE, LOWER, etc through | ||
259 | return false; | ||
260 | } | ||
261 | #endif | ||
262 | return true; | 125 | return true; |
263 | } | 126 | } |