diff options
| author | QMK Bot <hello@qmk.fm> | 2022-02-12 10:29:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-12 18:29:31 +0000 |
| commit | 63646e8906e062d1c1de3925cba70c4e3426a855 (patch) | |
| tree | 4e91648b77b838e1125cf86331d7e84bde6d07a9 /quantum/process_keycode/process_midi.c | |
| parent | afcdd7079c774dec2aa4b7f2d08adf8b7310919b (diff) | |
Format code according to conventions (#16322)
Diffstat (limited to 'quantum/process_keycode/process_midi.c')
| -rw-r--r-- | quantum/process_keycode/process_midi.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c index 9632d2b757..c49c31a525 100644 --- a/quantum/process_keycode/process_midi.c +++ b/quantum/process_keycode/process_midi.c | |||
| @@ -22,13 +22,19 @@ | |||
| 22 | 22 | ||
| 23 | # ifdef MIDI_BASIC | 23 | # ifdef MIDI_BASIC |
| 24 | 24 | ||
| 25 | void process_midi_basic_noteon(uint8_t note) { midi_send_noteon(&midi_device, 0, note, 127); } | 25 | void process_midi_basic_noteon(uint8_t note) { |
| 26 | midi_send_noteon(&midi_device, 0, note, 127); | ||
| 27 | } | ||
| 26 | 28 | ||
| 27 | void process_midi_basic_noteoff(uint8_t note) { midi_send_noteoff(&midi_device, 0, note, 0); } | 29 | void process_midi_basic_noteoff(uint8_t note) { |
| 30 | midi_send_noteoff(&midi_device, 0, note, 0); | ||
| 31 | } | ||
| 28 | 32 | ||
| 29 | void process_midi_all_notes_off(void) { midi_send_cc(&midi_device, 0, 0x7B, 0); } | 33 | void process_midi_all_notes_off(void) { |
| 34 | midi_send_cc(&midi_device, 0, 0x7B, 0); | ||
| 35 | } | ||
| 30 | 36 | ||
| 31 | # endif // MIDI_BASIC | 37 | # endif // MIDI_BASIC |
| 32 | 38 | ||
| 33 | # ifdef MIDI_ADVANCED | 39 | # ifdef MIDI_ADVANCED |
| 34 | 40 | ||
| @@ -41,7 +47,9 @@ static int8_t midi_modulation_step; | |||
| 41 | static uint16_t midi_modulation_timer; | 47 | static uint16_t midi_modulation_timer; |
| 42 | midi_config_t midi_config; | 48 | midi_config_t midi_config; |
| 43 | 49 | ||
| 44 | inline uint8_t compute_velocity(uint8_t setting) { return setting * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN)); } | 50 | inline uint8_t compute_velocity(uint8_t setting) { |
| 51 | return setting * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN)); | ||
| 52 | } | ||
| 45 | 53 | ||
| 46 | void midi_init(void) { | 54 | void midi_init(void) { |
| 47 | midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN; | 55 | midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN; |
| @@ -60,7 +68,9 @@ void midi_init(void) { | |||
| 60 | midi_modulation_timer = 0; | 68 | midi_modulation_timer = 0; |
| 61 | } | 69 | } |
| 62 | 70 | ||
| 63 | uint8_t midi_compute_note(uint16_t keycode) { return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose; } | 71 | uint8_t midi_compute_note(uint16_t keycode) { |
| 72 | return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose; | ||
| 73 | } | ||
| 64 | 74 | ||
| 65 | bool process_midi(uint16_t keycode, keyrecord_t *record) { | 75 | bool process_midi(uint16_t keycode, keyrecord_t *record) { |
| 66 | switch (keycode) { | 76 | switch (keycode) { |
| @@ -238,7 +248,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) { | |||
| 238 | return true; | 248 | return true; |
| 239 | } | 249 | } |
| 240 | 250 | ||
| 241 | # endif // MIDI_ADVANCED | 251 | # endif // MIDI_ADVANCED |
| 242 | 252 | ||
| 243 | void midi_task(void) { | 253 | void midi_task(void) { |
| 244 | midi_device_process(&midi_device); | 254 | midi_device_process(&midi_device); |
| @@ -263,4 +273,4 @@ void midi_task(void) { | |||
| 263 | # endif | 273 | # endif |
| 264 | } | 274 | } |
| 265 | 275 | ||
| 266 | #endif // MIDI_ENABLE | 276 | #endif // MIDI_ENABLE |
