summaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-11-07 13:26:15 +1100
committerGitHub <noreply@github.com>2022-11-07 02:26:15 +0000
commit8b658dcc9a826b03fedb1ef2bfcc692f3e25da1b (patch)
treee8a4c156505d5e81046145d9dcffb60b0797253f /quantum/process_keycode
parent442e7653cc833e95a84178dedafb4034738c52a1 (diff)
Normalise MIDI keycodes (#18972)
* `MI_ON`, `MI_OFF`, `MI_TOG` -> `MI_TOGG` * `MI_CH*`, `MI_CHU` -> `MI_CHNU`, `MI_CHD` -> `MI_CHND` * `MI_VEL_*` -> `MI_VL*`, `MI_VELU`, `MI_VELD` * `MI_TRNS_*` -> `MI_TR*`, `MI_TRNSU` -> `MI_TRSU`, `MI_TRNSD` -> `MI_TRSD` * `MI_OCT_*` -> `MI_OC*`, `MI_OCTU`, `MI_OCTD` * Misc controls * Note keycodes * Add legacy keycodes * Regenerate keycodes * Typo
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_midi.c48
-rw-r--r--quantum/process_keycode/process_music.c6
2 files changed, 27 insertions, 27 deletions
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c
index c49c31a525..ce62559849 100644
--- a/quantum/process_keycode/process_midi.c
+++ b/quantum/process_keycode/process_midi.c
@@ -52,7 +52,7 @@ inline uint8_t compute_velocity(uint8_t setting) {
}
void midi_init(void) {
- midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN;
+ midi_config.octave = QK_MIDI_OCTAVE_2 - MIDI_OCTAVE_MIN;
midi_config.transpose = 0;
midi_config.velocity = 127;
midi_config.channel = 0;
@@ -103,13 +103,13 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
dprintf("midi octave %d\n", midi_config.octave);
}
return false;
- case MI_OCTD:
+ case QK_MIDI_OCTAVE_DOWN:
if (record->event.pressed && midi_config.octave > 0) {
midi_config.octave--;
dprintf("midi octave %d\n", midi_config.octave);
}
return false;
- case MI_OCTU:
+ case QK_MIDI_OCTAVE_UP:
if (record->event.pressed && midi_config.octave < (MIDI_OCTAVE_MAX - MIDI_OCTAVE_MIN)) {
midi_config.octave++;
dprintf("midi octave %d\n", midi_config.octave);
@@ -117,18 +117,18 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
return false;
case MIDI_TRANSPOSE_MIN ... MIDI_TRANSPOSE_MAX:
if (record->event.pressed) {
- midi_config.transpose = keycode - MI_TRNS_0;
+ midi_config.transpose = keycode - QK_MIDI_TRANSPOSE_0;
dprintf("midi transpose %d\n", midi_config.transpose);
}
return false;
- case MI_TRNSD:
- if (record->event.pressed && midi_config.transpose > (MIDI_TRANSPOSE_MIN - MI_TRNS_0)) {
+ case QK_MIDI_TRANSPOSE_DOWN:
+ if (record->event.pressed && midi_config.transpose > (MIDI_TRANSPOSE_MIN - QK_MIDI_TRANSPOSE_0)) {
midi_config.transpose--;
dprintf("midi transpose %d\n", midi_config.transpose);
}
return false;
- case MI_TRNSU:
- if (record->event.pressed && midi_config.transpose < (MIDI_TRANSPOSE_MAX - MI_TRNS_0)) {
+ case QK_MIDI_TRANSPOSE_UP:
+ if (record->event.pressed && midi_config.transpose < (MIDI_TRANSPOSE_MAX - QK_MIDI_TRANSPOSE_0)) {
const bool positive = midi_config.transpose > 0;
midi_config.transpose++;
if (positive && midi_config.transpose < 0) midi_config.transpose--;
@@ -141,7 +141,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
dprintf("midi velocity %d\n", midi_config.velocity);
}
return false;
- case MI_VELD:
+ case QK_MIDI_VELOCITY_DOWN:
if (record->event.pressed && midi_config.velocity > 0) {
if (midi_config.velocity == 127) {
midi_config.velocity -= 10;
@@ -154,7 +154,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
dprintf("midi velocity %d\n", midi_config.velocity);
}
return false;
- case MI_VELU:
+ case QK_MIDI_VELOCITY_UP:
if (record->event.pressed && midi_config.velocity < 127) {
if (midi_config.velocity < 115) {
midi_config.velocity += 13;
@@ -170,48 +170,48 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
dprintf("midi channel %d\n", midi_config.channel);
}
return false;
- case MI_CHD:
+ case QK_MIDI_CHANNEL_DOWN:
if (record->event.pressed) {
midi_config.channel--;
dprintf("midi channel %d\n", midi_config.channel);
}
return false;
- case MI_CHU:
+ case QK_MIDI_CHANNEL_UP:
if (record->event.pressed) {
midi_config.channel++;
dprintf("midi channel %d\n", midi_config.channel);
}
return false;
- case MI_ALLOFF:
+ case QK_MIDI_ALL_NOTES_OFF:
if (record->event.pressed) {
midi_send_cc(&midi_device, midi_config.channel, 0x7B, 0);
dprintf("midi all notes off\n");
}
return false;
- case MI_SUS:
+ case QK_MIDI_SUSTAIN:
midi_send_cc(&midi_device, midi_config.channel, 0x40, record->event.pressed ? 127 : 0);
dprintf("midi sustain %d\n", record->event.pressed);
return false;
- case MI_PORT:
+ case QK_MIDI_PORTAMENTO:
midi_send_cc(&midi_device, midi_config.channel, 0x41, record->event.pressed ? 127 : 0);
dprintf("midi portamento %d\n", record->event.pressed);
return false;
- case MI_SOST:
+ case QK_MIDI_SOSTENUTO:
midi_send_cc(&midi_device, midi_config.channel, 0x42, record->event.pressed ? 127 : 0);
dprintf("midi sostenuto %d\n", record->event.pressed);
return false;
- case MI_SOFT:
+ case QK_MIDI_SOFT:
midi_send_cc(&midi_device, midi_config.channel, 0x43, record->event.pressed ? 127 : 0);
dprintf("midi soft %d\n", record->event.pressed);
return false;
- case MI_LEG:
- midi_send_cc(&midi_device, midi_config.channel, 0x43, record->event.pressed ? 127 : 0);
+ case QK_MIDI_LEGATO:
+ midi_send_cc(&midi_device, midi_config.channel, 0x44, record->event.pressed ? 127 : 0);
dprintf("midi legato %d\n", record->event.pressed);
return false;
- case MI_MOD:
+ case QK_MIDI_MODULATION:
midi_modulation_step = record->event.pressed ? 1 : -1;
return false;
- case MI_MODSD:
+ case QK_MIDI_MODULATION_SPEED_DOWN:
if (record->event.pressed) {
midi_config.modulation_interval++;
// prevent overflow
@@ -219,13 +219,13 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
dprintf("midi modulation interval %d\n", midi_config.modulation_interval);
}
return false;
- case MI_MODSU:
+ case QK_MIDI_MODULATION_SPEED_UP:
if (record->event.pressed && midi_config.modulation_interval > 0) {
midi_config.modulation_interval--;
dprintf("midi modulation interval %d\n", midi_config.modulation_interval);
}
return false;
- case MI_BENDD:
+ case QK_MIDI_PITCH_BEND_DOWN:
if (record->event.pressed) {
midi_send_pitchbend(&midi_device, midi_config.channel, -0x2000);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, -0x2000);
@@ -234,7 +234,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0);
}
return false;
- case MI_BENDU:
+ case QK_MIDI_PITCH_BEND_UP:
if (record->event.pressed) {
midi_send_pitchbend(&midi_device, midi_config.channel, 0x1fff);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0x1fff);
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index 950aec22f9..ee697a0cc6 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -120,17 +120,17 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
return false;
}
- if (keycode == MI_ON && record->event.pressed) {
+ if (keycode == QK_MIDI_ON && record->event.pressed) {
midi_on();
return false;
}
- if (keycode == MI_OFF && record->event.pressed) {
+ if (keycode == QK_MIDI_OFF && record->event.pressed) {
midi_off();
return false;
}
- if (keycode == MI_TOG && record->event.pressed) {
+ if (keycode == QK_MIDI_TOGGLE && record->event.pressed) {
if (midi_activated) {
midi_off();
} else {