summaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_midi.c
diff options
context:
space:
mode:
authorGabriel Young <gabeplaysdrums@live.com>2017-02-18 03:13:43 -0800
committerGabriel Young <gabeplaysdrums@live.com>2017-02-19 16:42:04 -0800
commitf2b2e05f126403c8a6f0fc3d542beddac7974e9b (patch)
tree2588e712e4f99c96379fc42b78594d11533e7f64 /quantum/process_keycode/process_midi.c
parente405ab4bc6ff47d189d99c4d51aadf60a642d82a (diff)
clean up commented code
Diffstat (limited to 'quantum/process_keycode/process_midi.c')
-rw-r--r--quantum/process_keycode/process_midi.c137
1 files changed, 0 insertions, 137 deletions
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c
index bc48b39059..acaae7c30a 100644
--- a/quantum/process_keycode/process_midi.c
+++ b/quantum/process_keycode/process_midi.c
@@ -19,82 +19,6 @@ midi_config_t midi_config;
#define MIDI_INVALID_NOTE 0xFF
-#if 0
-typedef struct {
- uint64_t low;
- uint64_t high;
-} uint128_t;
-
-#if 0
-static void right_shift_uint128_t(uint128_t* val, uint8_t shift)
-{
- uint64_t high_mask = ~0 >> (64 - shift);
- uint64_t high_bits = (val->high & high_mask) << (64 - shift);
- val->high = val->high >> shift;
- val->low = (val->low >> shift) | high_bits;
-}
-#endif
-
-static uint64_t left_shift_uint64_t(uint64_t val, uint8_t shift)
-{
- dprintf("left_shift_uint64_t(val, %c) ...\n", val, shift);
- while (shift > 16u) {
- dprintf(" left_shift_uint64_t: val=?, shift=%c\n", val, shift);
- val <<= 16;
- shift -= 16;
- }
- dprintf(" left_shift_uint64_t: val=?, shift=%c\n", val, shift);
- val <<= shift;
- return val;
-}
-
-static void set_bit_uint128_t(uint128_t* val, uint8_t shift)
-{
- uint64_t x = 1u;
-
- if (shift < 64)
- {
- x = left_shift_uint64_t(x, shift);
- dprintf("x: %d\n", x);
- dprintf("set_bit_uint128_t (%d): 0x%016X%016X\n", shift, 0, x);
- val->low = val->low | left_shift_uint64_t(1u, shift);
- }
- else
- {
- x = left_shift_uint64_t(x, shift - 64);
- dprintf("set_bit_uint128_t (%d): 0x%016X%016X\n", shift, x, 0);
- val->high = val->high | left_shift_uint64_t(1u, shift - 64);
- }
-}
-
-static void clear_bit_uint128_t(uint128_t* val, uint8_t shift)
-{
- if (shift < 64)
- {
- val->low = val->low & ~left_shift_uint64_t(1u, shift);
- }
- else
- {
- val->high = val->high & ~left_shift_uint64_t(1u, shift - 64);
- }
-}
-
-static bool is_bit_set_uint128_t(const uint128_t* val, uint8_t shift)
-{
- if (shift < 64)
- {
- return !!(val->low & (1u << shift));
- }
- else
- {
- return !!(val->high & (1u << (shift - 64)));
- }
-}
-
-uint128_t note_status = { 0, 0 };
-#endif
-
-
#define MIDI_MAX_NOTES_ON 10
typedef struct {
@@ -198,66 +122,5 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
return false;
};
-#if 0
- if (keycode == MI_ON && record->event.pressed) {
- midi_activated = true;
-#ifdef AUDIO_ENABLE
- music_scale_user();
-#endif
- return false;
- }
-
- if (keycode == MI_OFF && record->event.pressed) {
- midi_activated = false;
- midi_send_cc(&midi_device, 0, 0x7B, 0);
- return false;
- }
-
- if (midi_activated) {
- if (record->event.key.col == (MATRIX_COLS - 1) && record->event.key.row == (MATRIX_ROWS - 1)) {
- if (record->event.pressed) {
- midi_starting_note++; // Change key
- midi_send_cc(&midi_device, 0, 0x7B, 0);
- }
- return false;
- }
- if (record->event.key.col == (MATRIX_COLS - 2) && record->event.key.row == (MATRIX_ROWS - 1)) {
- if (record->event.pressed) {
- midi_starting_note--; // Change key
- midi_send_cc(&midi_device, 0, 0x7B, 0);
- }
- return false;
- }
- if (record->event.key.col == (MATRIX_COLS - 3) && record->event.key.row == (MATRIX_ROWS - 1) && record->event.pressed) {
- midi_offset++; // Change scale
- midi_send_cc(&midi_device, 0, 0x7B, 0);
- return false;
- }
- if (record->event.key.col == (MATRIX_COLS - 4) && record->event.key.row == (MATRIX_ROWS - 1) && record->event.pressed) {
- midi_offset--; // Change scale
- midi_send_cc(&midi_device, 0, 0x7B, 0);
- return false;
- }
- // basic
- // uint8_t note = (midi_starting_note + SCALE[record->event.key.col + midi_offset])+12*(MATRIX_ROWS - record->event.key.row);
- // advanced
- // uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+12*(MATRIX_ROWS - record->event.key.row);
- // guitar
- uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+5*(MATRIX_ROWS - record->event.key.row);
- // violin
- // uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+7*(MATRIX_ROWS - record->event.key.row);
-
- if (record->event.pressed) {
- // midi_send_noteon(&midi_device, record->event.key.row, midi_starting_note + SCALE[record->event.key.col], 127);
- midi_send_noteon(&midi_device, 0, note, 127);
- } else {
- // midi_send_noteoff(&midi_device, record->event.key.row, midi_starting_note + SCALE[record->event.key.col], 127);
- midi_send_noteoff(&midi_device, 0, note, 127);
- }
-
- if (keycode < 0xFF) // ignores all normal keycodes, but lets RAISE, LOWER, etc through
- return false;
- }
-#endif
return true;
}