]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/process_keycode/process_midi.h
Usbasploader bootloader option addition (#6304)
[qmk_firmware.git] / quantum / process_keycode / process_midi.h
1 /* Copyright 2016 Jack Humbert
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16
17 #ifndef PROCESS_MIDI_H
18 #define PROCESS_MIDI_H
19
20 #include "quantum.h"
21
22 #ifdef MIDI_ENABLE
23
24 #ifdef MIDI_BASIC
25 void process_midi_basic_noteon(uint8_t note);
26 void process_midi_basic_noteoff(uint8_t note);
27 void process_midi_all_notes_off(void);
28 #endif
29
30 void midi_task(void);
31
32 #ifdef MIDI_ADVANCED
33 typedef union {
34   uint32_t raw;
35   struct {
36     uint8_t octave              :4;
37     int8_t transpose            :4;
38     uint8_t velocity            :4;
39     uint8_t channel             :4;
40     uint8_t modulation_interval :4;
41   };
42 } midi_config_t;
43
44 extern midi_config_t midi_config;
45
46 void midi_init(void);
47 bool process_midi(uint16_t keycode, keyrecord_t *record);
48
49 #define MIDI_INVALID_NOTE 0xFF
50 #define MIDI_TONE_COUNT (MIDI_TONE_MAX - MIDI_TONE_MIN + 1)
51
52 uint8_t midi_compute_note(uint16_t keycode);
53 #endif // MIDI_ADVANCED
54
55 #endif // MIDI_ENABLE
56
57 #endif