Skip to content

Commit

Permalink
Fix for MIDI sustain effect issue (qmk#10361)
Browse files Browse the repository at this point in the history
  • Loading branch information
3araht authored Oct 4, 2020
1 parent 73ac06c commit 779692c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions quantum/process_keycode/process_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 779692c

Please sign in to comment.