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

Support for running status #301

Open
MicheleLonghi opened this issue Dec 10, 2020 · 5 comments
Open

Support for running status #301

MicheleLonghi opened this issue Dec 10, 2020 · 5 comments
Milestone

Comments

@MicheleLonghi
Copy link

I'm unable to receive running status control changes: after the first, subsequent CC are dropped.
Thanks

@armadsen armadsen assigned armadsen and unassigned armadsen Jan 31, 2021
@armadsen armadsen added this to the 1.8 milestone Jan 31, 2021
@armadsen
Copy link
Member

I need to dig into this. I believe sending running status is unsupported by CoreMIDI, but I was under the impression that receiving should "just work" and be handled at the CoreMIDI level. As long as the status-less messages are delivered by CoreMIDI into MIKMIDI, we could handle the rest at the MIKMIDI level.

@orchetect
Copy link

Core MIDI does not reconstitute received running status messages, you'd need to handle them in the parser.

@armadsen
Copy link
Member

@MicheleLonghi: I'm finally getting back to this. I don't seem to have any devices here that send messages using running status. I'm curious what device(s) you're using that do.

@armadsen
Copy link
Member

armadsen commented Jul 5, 2022

I got ahold of a device that (reportedly) uses running status, however, as I expected, the messages it sends are reconstituted before they ever hit the Core MIDI APIs. That is, the read callback passed to MIDIInputPortCreate gets fully-formed packets. It seems like the USB MIDI spec requires this at the adapter level.

@orchetect: I see that you've implemented explicit reconstitution of running status messages in MIDIKit. I'm curious to know what hardware/connection setup you know about that means this functionality is needed at the application level?

@orchetect
Copy link

orchetect commented Jul 5, 2022

It seems like the USB MIDI spec requires this at the adapter level.

Not sure if that's true but would be interesting to know.

I'm curious to know what hardware/connection setup you know about that means this functionality is needed at the application level

Through testing and countless hours poking Core MIDI, for legacy MIDI 1.0 (not UMP), de-facto you need to fully implement running status in the parser when receiving packets. Even just using some dummy virtual MIDI endpoints in isolated unit tests can confirm that Core MIDI won't reconstitute them. It somewhat makes sense, since properly implementing RS means that Core MIDI would have to maintain state for each port, and clearly they didn't do that and felt for some reason that should be handled by the consumer.

Some devices pack running status into a single packet, such as HUI control surfaces. And some MIDI keyboards I've used utilize running status globally.

TL;DR per MIDI 1.0 Spec:

  1. Parse running status within the same packet.

    ie: b0 2c 00 2c 01 2c 02 (equivalent to b0 2c 00, b0 2c 01, b0 2c 02) and it arrives as-is, requiring you to parse it out.

  2. Persist the status between packets in case ad-hoc running status messages arrive that omit the status, and clear the status when appropriate (Spec outlines when to clear status).

    ie: get a b0 2c 00, then packets following that contains just data bytes, ie. 2c 01 should be interpreted as b0 2c 01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants