diff options
author | 3araht <69518343+3araht@users.noreply.github.com> | 2020-10-05 06:32:24 +0900 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2021-01-12 22:43:30 -0800 |
commit | 5872797820f69d183d347cddc06656017b211378 (patch) | |
tree | ec26e474421d58d964c1b1ef0785514f569d9f38 /quantum/process_keycode/process_midi.c | |
parent | 08bbda71115e9eaf48a91c60803c5c7ae1c0c344 (diff) |
Fix for MIDI sustain effect issue (#10361)
Diffstat (limited to 'quantum/process_keycode/process_midi.c')
-rw-r--r-- | quantum/process_keycode/process_midi.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c index b2fb902eb4..e525770144 100644 --- a/quantum/process_keycode/process_midi.c +++ b/quantum/process_keycode/process_midi.c @@ -68,10 +68,12 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) { uint8_t tone = keycode - MIDI_TONE_MIN; uint8_t velocity = compute_velocity(midi_config.velocity); if (record->event.pressed) { - uint8_t note = midi_compute_note(keycode); - midi_send_noteon(&midi_device, channel, note, velocity); - dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity); - tone_status[tone] = note; + if (tone_status[tone] == MIDI_INVALID_NOTE) { + uint8_t note = midi_compute_note(keycode); + midi_send_noteon(&midi_device, channel, note, velocity); + dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity); + tone_status[tone] = note; + } } else { uint8_t note = tone_status[tone]; if (note != MIDI_INVALID_NOTE) { |