diff options
author | adiron <adi@adiron.me> | 2018-04-19 05:22:08 +0300 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-04-18 22:22:08 -0400 |
commit | 3d3c093173f6e9a838671bd7484b3a11dc564c1a (patch) | |
tree | 7d3f5a5781e18ce5ec306b554c10851638d9685e /quantum/process_keycode/process_midi.c | |
parent | a7fca476866ea7efac69c7519d9666665c9a62a8 (diff) | |
download | qmk_firmware-3d3c093173f6e9a838671bd7484b3a11dc564c1a.tar.gz qmk_firmware-3d3c093173f6e9a838671bd7484b3a11dc564c1a.zip |
Added bending to MIDI (#2740)
This is done via MI_BENDD and MI_BENDU. At the moment the value is
hardcoded and cannot be adjusted (future commit?) and is the max for the
`midi_send_pitchbend` function (up or down).
`MI_BENDD` and `MI_BENDU` both require `#define MIDI_ADVANCED`
MIDI pitch bend was already implemented in `protocol/midi.c`, I merely
added the keycodes to trigger them. :) (thanks to Jack, two years ago
in commit fb4fe52c apparently)
Diffstat (limited to 'quantum/process_keycode/process_midi.c')
-rw-r--r-- | quantum/process_keycode/process_midi.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c index 9728076df..a67f73628 100644 --- a/quantum/process_keycode/process_midi.c +++ b/quantum/process_keycode/process_midi.c | |||
@@ -222,6 +222,26 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) | |||
222 | dprintf("midi modulation interval %d\n", midi_config.modulation_interval); | 222 | dprintf("midi modulation interval %d\n", midi_config.modulation_interval); |
223 | } | 223 | } |
224 | return false; | 224 | return false; |
225 | case MI_BENDD: | ||
226 | if (record->event.pressed) { | ||
227 | midi_send_pitchbend(&midi_device, midi_config.channel, -0x2000); | ||
228 | dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, -0x2000); | ||
229 | } | ||
230 | else { | ||
231 | midi_send_pitchbend(&midi_device, midi_config.channel, 0); | ||
232 | dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0); | ||
233 | } | ||
234 | return false; | ||
235 | case MI_BENDU: | ||
236 | if (record->event.pressed) { | ||
237 | midi_send_pitchbend(&midi_device, midi_config.channel, 0x1fff); | ||
238 | dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0x1fff); | ||
239 | } | ||
240 | else { | ||
241 | midi_send_pitchbend(&midi_device, midi_config.channel, 0); | ||
242 | dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0); | ||
243 | } | ||
244 | return false; | ||
225 | }; | 245 | }; |
226 | 246 | ||
227 | return true; | 247 | return true; |