Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling multiples of the same MIDI note (fixes bug brought up in issue #10199) #11639

Merged
merged 3 commits into from
Mar 25, 2021
Merged

Conversation

jakobkg
Copy link

@jakobkg jakobkg commented Jan 20, 2021

Description

This change makes it so that MIDI note on messages are sent every time a MIDI key is pressed, but the MIDI note off message is only sent once all instances of the same MIDI note have been released. This issue would make it so that if you have a keymap with several MIDI chords, where the chords had overlapping notes, the common notes would be turned off once one chord was released even if another chord containing the same note is still being held. This PR fixes that.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@github-actions github-actions bot added the core label Jan 20, 2021
@drashna drashna requested review from mechmerlin, a team and jackhumbert and removed request for mechmerlin January 20, 2021 19:06
@jakobkg
Copy link
Author

jakobkg commented Jan 20, 2021

An issue I've noticed while playing some with this change applied is that if I change octaves on the keyboard while a note is held, the note is sustained as the note off message being sent when hte key is released is an octave off from the note on message that was sent when the key was pressed. I would optimally try to map the registered presses to physical keys rather than keycodes, but since that would be layout dependent I'm assuming it can't be done in core so I'll have to think of a different solution. I assume this also applies to transpositions.
Example: I press a key with keycode MI_C and while holding it, I press a key with MI_OCTU. Now when I release the first key the note off message does not get sent, and the original C is sustained until I press and release the same note elsewhere on the keyboard, or transpose back down an octave to press and release the same key again.

jakobkg and others added 2 commits January 21, 2021 11:04
@jakobkg
Copy link
Author

jakobkg commented Jan 21, 2021

Failing build is addressed in PR #11652

@stale
Copy link

stale bot commented Mar 16, 2021

Thank you for your contribution!
This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready.
For maintainers: Please label with awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

@tzarc tzarc merged commit 8e820cd into qmk:master Mar 25, 2021
mrlinuxfish pushed a commit to mrlinuxfish/qmk_firmware that referenced this pull request Mar 28, 2021
… issue qmk#10199) (qmk#11639)

* Fix handling multiples of the same MIDI note

* Extend MIDI note status to fix note releases
@jakobkg jakobkg deleted the master branch March 29, 2021 21:24
@jakobkg jakobkg restored the master branch March 29, 2021 21:24
@jakobkg jakobkg deleted the master branch March 29, 2021 21:24
@jakobkg jakobkg restored the master branch March 29, 2021 21:24
@3araht
Copy link
Contributor

3araht commented Apr 9, 2021

Hi @jakobkg.
Sorry that I couldn't comment on this pull request before the merge.
Somehow this update brought back the sutain issue again on my keyboard.

If I tried the previous version (c66df16) by the following command, the problems can be solved.
git checkout c66df16 quantum/process_keycode/process_midi.c

Could you check it at your enviromnent?

mrtnee pushed a commit to mrtnee/qmk_firmware that referenced this pull request Nov 20, 2021
… issue qmk#10199) (qmk#11639)

* Fix handling multiples of the same MIDI note

* Extend MIDI note status to fix note releases
@3araht 3araht mentioned this pull request Sep 23, 2023
14 tasks
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
… issue qmk#10199) (qmk#11639)

* Fix handling multiples of the same MIDI note

* Extend MIDI note status to fix note releases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants