aboutsummaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorGravatar 3araht <69518343+3araht@users.noreply.github.com>2020-10-05 06:32:24 +0900
committerGravatar GitHub <noreply@github.com>2020-10-04 14:32:24 -0700
commit2bcac45650563822f20a2336a9fc4d95b2cc4e3e (patch)
treebf99edc3e02b8deb76b019b7c790c7ee99eb6302 /quantum
parentc8cff1489a82bb61266ce32750895c6935b256a3 (diff)
downloadqmk_firmware-2bcac45650563822f20a2336a9fc4d95b2cc4e3e.tar.gz
Fix for MIDI sustain effect issue (#10361)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/process_keycode/process_midi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c
index b2fb902eb..e52577014 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) {