Re: CoreMIDI behavior?
Re: CoreMIDI behavior?
- Subject: Re: CoreMIDI behavior?
- From: Doug Wyatt <email@hidden>
- Date: Mon, 7 Jan 2002 05:07:54 -0800
On Monday, January 7, 2002, at 01:23 , Stephen Davis wrote:
Just wanted to ask a question or two about current/future behavior of
the CoreMIDI framework with regard to a MIDIReadProc().
Excluding SysEx, so far I've noticed that I only get full MIDI messages
in the call back (status byte + 1/2 data bytes). Usually one per
packet but sometimes two. Either way, it's always whole messages, i.e.
no fragments. Then again, I don't have a wealth of instruments I can
test with to see what happens. Obviously, if one can depend on this
behavior, then that makes packet parsing simpler. The example code
seems to assume this. I'm wondering if it's safe to assume that this
will always be the case. Again, SysEx packets are an exception. One
other notable exception might be real-time SysEx messages. What
happens with them?
Also, running status is not supported in the MIDISend() function but
does CoreMIDI do anything with running status on the inputs? Does it
add the status byte for me or do I need to watch out for running
status? If the status byte is not added, does that my break my above
assumption that packets will always contain complete messages?
Here's what the comments in MIDIServices.h say about MIDIPacket.data:
A variable-length stream of MIDI messages. Running status
is not allowed. In the case of system-exclusive
messages, a packet may only contain a single message, or
portion of one, with no other MIDI events.
So yes, you do not have to be aware of running status; you can assume
that a packet starting with a data byte ((c & 0x80) == 0) is a continued
sysex.
I should probably make it more specific: except for running status, the
MIDI messages must be complete.
Doug
--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden
http://www.sonosphere.com
"Music happens when you disrupt space in a secure and confident manner."
-- One of the members of the Art Ensemble of Chicago