Re: MIDIPacket
Re: MIDIPacket
- Subject: Re: MIDIPacket
- From: Kurt Revis <email@hidden>
- Date: Tue, 4 Feb 2003 00:15:58 -0800
On Monday, February 3, 2003, at 11:33 PM, Vigour Vigour wrote:
If I look at the documentation for 'MIDIPacket' I can read that:
'a packet may only contain a single message'.
Check that sentence again. It says:
"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 if you send or receive a sysex message, it must start in its own
MIDIPacket. It may extend over multiple packets until it is finished.
Each packet will not contain any other messages.
In every other case--every other MIDI message--there may be multiple
messages in the same packet, and the messages must be completely
contained within the packet.
Does it mean that I can for example have a single note on message like
this:
90 34 56
And nothing more in that packet?
No, you can put other messages in that packet, as long as they aren't
sysex.
If that is the case, why is 'data' declared to 256 bytes?
For convenience. For simple uses, you can just allocate a simple
MIDIPacket and use it without worrying too much about allocating the
exact amount of memory you need. Considering that most MIDI messages
are only 3 bytes, 256 bytes is plenty of room to play with.
If you are dong more complicated work, you can allocate the exact
amount of memory you need, and then cast that pointer to a (MIDIPacket
*), In practice, the MIDIPacket structure has variable length--that's
why it has a field stating the length of the data that follws. The 256
byte size only affects your code at compile time; nothing checks it
during run time.
--
Kurt Revis
email@hidden
_______________________________________________
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.
References: | |
| >MIDIPacket (From: "Vigour Vigour" <email@hidden>) |