aboutsummaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_midi.c
diff options
context:
space:
mode:
authorGabriel Young <gabeplaysdrums@live.com>2017-02-25 19:25:33 -0800
committerGabriel Young <gabeplaysdrums@live.com>2017-02-25 19:25:33 -0800
commit1000799d1ef594bf9f48076986ec300ef9e536db (patch)
treee561400e2a5f2e0c27238b1e2602164140039918 /quantum/process_keycode/process_midi.c
parent525be99ee938aa6e48448d7dd6ea6e6fe50bb36d (diff)
downloadqmk_firmware-1000799d1ef594bf9f48076986ec300ef9e536db.tar.gz
qmk_firmware-1000799d1ef594bf9f48076986ec300ef9e536db.zip
Factor basic note processing into respective processors
Diffstat (limited to 'quantum/process_keycode/process_midi.c')
-rw-r--r--quantum/process_keycode/process_midi.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c
index 161f04a24..214bba902 100644
--- a/quantum/process_keycode/process_midi.c
+++ b/quantum/process_keycode/process_midi.c
@@ -1,6 +1,28 @@
1#include "process_midi.h" 1#include "process_midi.h"
2 2
3#if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) 3#ifdef MIDI_ENABLE
4#include "midi.h"
5
6#ifdef MIDI_BASIC
7
8void process_midi_basic_noteon(uint8_t note)
9{
10 midi_send_noteon(&midi_device, 0, note, 128);
11}
12
13void process_midi_basic_noteoff(uint8_t note)
14{
15 midi_send_noteoff(&midi_device, 0, note, 0);
16}
17
18void process_midi_basic_stop_all_notes(void)
19{
20 midi_send_cc(&midi_device, 0, 0x7B, 0);
21}
22
23#endif // MIDI_BASIC
24
25#ifdef MIDI_ADVANCED
4 26
5#include "timer.h" 27#include "timer.h"
6 28
@@ -165,7 +187,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
165 case MI_ALLOFF: 187 case MI_ALLOFF:
166 if (record->event.pressed) { 188 if (record->event.pressed) {
167 midi_send_cc(&midi_device, midi_config.channel, 0x7B, 0); 189 midi_send_cc(&midi_device, midi_config.channel, 0x7B, 0);
168 dprintf("midi off\n"); 190 dprintf("midi all notes off\n");
169 } 191 }
170 return false; 192 return false;
171 case MI_SUS: 193 case MI_SUS:
@@ -212,3 +234,5 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
212} 234}
213 235
214#endif // MIDI_ADVANCED 236#endif // MIDI_ADVANCED
237
238#endif // MIDI_ENABLE