summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quantum/process_keycode/process_midi.c61
-rw-r--r--quantum/quantum_keycodes.h11
2 files changed, 57 insertions, 15 deletions
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c
index 2ce7418ea..f7a8b6650 100644
--- a/quantum/process_keycode/process_midi.c
+++ b/quantum/process_keycode/process_midi.c
@@ -62,43 +62,84 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
return false;
}
case MIDI_OCTAVE_MIN ... MIDI_OCTAVE_MAX:
- if (record->event.pressed)
+ if (record->event.pressed) {
midi_config.octave = keycode - MIDI_OCTAVE_MIN;
+ dprintf("midi octave %d\n", midi_config.octave);
+ }
return false;
case MI_OCTD:
- if (record->event.pressed && midi_config.octave > 0)
+ if (record->event.pressed && midi_config.octave > 0) {
midi_config.octave--;
+ dprintf("midi octave %d\n", midi_config.octave);
+ }
return false;
case MI_OCTU:
- if (record->event.pressed && midi_config.octave < (MIDI_OCTAVE_MAX - MIDI_OCTAVE_MIN))
+ if (record->event.pressed && midi_config.octave < (MIDI_OCTAVE_MAX - MIDI_OCTAVE_MIN)) {
midi_config.octave++;
+ dprintf("midi octave %d\n", midi_config.octave);
+ }
return false;
case MIDI_VELOCITY_MIN ... MIDI_VELOCITY_MAX:
- if (record->event.pressed)
+ if (record->event.pressed) {
midi_config.velocity = keycode - MIDI_VELOCITY_MIN;
+ dprintf("midi velocity %d\n", midi_config.velocity);
+ }
return false;
case MI_VELD:
- if (record->event.pressed && midi_config.velocity > 0)
+ if (record->event.pressed && midi_config.velocity > 0) {
midi_config.velocity--;
+ dprintf("midi velocity %d\n", midi_config.velocity);
+ }
return false;
case MI_VELU:
- if (record->event.pressed)
+ if (record->event.pressed) {
midi_config.velocity++;
+ dprintf("midi velocity %d\n", midi_config.velocity);
+ }
return false;
case MIDI_CHANNEL_MIN ... MIDI_CHANNEL_MAX:
- if (record->event.pressed)
+ if (record->event.pressed) {
midi_config.channel = keycode - MIDI_CHANNEL_MIN;
+ dprintf("midi channel %d\n", midi_config.channel);
+ }
return false;
case MI_CHD:
- if (record->event.pressed)
+ if (record->event.pressed) {
midi_config.channel--;
+ dprintf("midi channel %d\n", midi_config.channel);
+ }
return false;
case MI_CHU:
- if (record->event.pressed)
+ if (record->event.pressed) {
midi_config.channel++;
+ dprintf("midi channel %d\n", midi_config.channel);
+ }
+ return false;
+ case MI_OFF:
+ if (record->event.pressed) {
+ midi_send_cc(&midi_device, midi_config.channel, 0x7B, 0);
+ dprintf("midi off\n");
+ }
return false;
case MI_SUS:
- //TODO
+ 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:
+ 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:
+ 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:
+ 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);
+ dprintf("midi legato %d\n", record->event.pressed);
return false;
};
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index a024a9639..f2b9509b5 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -109,8 +109,6 @@ enum quantum_keycodes {
#ifdef MIDI_ENABLE
// Midi
- MIDI_ON,
- MIDI_OFF,
MIDI_TONE_MIN,
@@ -221,7 +219,13 @@ enum quantum_keycodes {
MI_CHD, // previous channel
MI_CHU, // next channel
+ MI_OFF, // all notes off
+
MI_SUS, // sustain
+ MI_PORT, // portamento
+ MI_SOST, // sostenuto
+ MI_SOFT, // soft
+ MI_LEG, // legato
#endif
// Backlight functionality
@@ -394,9 +398,6 @@ enum quantum_keycodes {
#define BL_ON BL_9
#define BL_OFF BL_0
-#define MI_ON MIDI_ON
-#define MI_OFF MIDI_OFF
-
// GOTO layer - 16 layers max
// when:
// ON_PRESS = 1