Re: How atomic is MIDPacket?
Re: How atomic is MIDPacket?
- Subject: Re: How atomic is MIDPacket?
- From: Robert Grant <email@hidden>
- Date: Tue, 27 Apr 2004 08:36:45 -0400
Hi Christopher,
The MIDI Packet is not atomic - it is actually a collection of MIDI
Messages that all occurred at the same timestamp. In my dumps of MIDI
messages I often find that I get just one MIDI message per packet - but
that's probably due to my lack of aggressive playing. Even with my
plinking about I occasionally get two or more messages per packet.
So iterate over the messages in the packet and dispatch your events
from there. It's not a big whup and I'm sure there's some code on the
Swiki that you can put in your program that handles the iteration.
Unfortunately the Swiki is asking for a user name and password that I'm
not aware of :-(
Robert.
On Apr 27, 2004, at 4:06 AM, Christopher Corbell wrote:
I'm developing a mechanism that allows specific MIDI events
to be mapped to specific targets or actions in an application.
I'm wondering, in practice, how much one should count on a
MIDIPacket to represent an atomic MIDI event or run of similar
MIDI events. I'd hope that driver developers wouldn't arbitrarily
stuff completely different types of MIDI events into a single MIDI
packet, but looking at MIDIServices.h it doesn't seem that this is
guaranteed.
As an example my app might allow certain controller messages
to be handled by one object and note messages to be handled
by another. I have a "dispatcher" object that gets the MIDIPacketList
from the usual callback, and iterating through my hope is that I
can just look at the status byte at the beginning of each packet
to determine where that packet should go.
In practice with a small variety of driver/controller configurations
(EDIROL, M-Audio, YAMAHA) this assumption seems to be reliable.
However if it's really the case that one should implement full
MIDI parsing for the bytes in each packet without this assumption
(i.e. treat it as just a raw "batch" of MIDI data and not necessarily
as relating to a single type of MIDI message) then I'd rather do it
right now than be forced to fix a failure later...
Thanks for any insights.
- Christopher
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.