Re: MIDIPacketList behaviour problem
Re: MIDIPacketList behaviour problem
- Subject: Re: MIDIPacketList behaviour problem
- From: Doug Wyatt <email@hidden>
- Date: Wed, 21 Jan 2004 16:49:19 -0800
On Jan 20, 2004, at 14:36, Michael Harbour wrote:
Thanks for replying, Thomas, but I'm still a bit flummoxed.
As I understand it, sysex messages can be spread across multiple
packets. This is logical, since a single packet is for a specific
time,
and you might not want reception delayed until the complete packet has
been received, especially with a large message.
righto, but
1. how would such multiple MIDIPacket be bundled up inside
MIDIPacketLists (or not and sent from the driver to the app as a bunch
ot MIDIPacketlists
(is this process driver-specific or specified by Apple?)
The driver is in control of how incoming MIDI bytes are coalesced into
packets and packetlists, though generally it should be doing it as
quickly as possible soas not to add latency.
2. how can we explain the presentation of 127 separate MIDIPacketLists
to my app which originated as a single MIDIPacketList that I squirted
to the unit? The raw bytes i stuck into the MIDIData was signed-Int
versions of some note-on 0x80 or 0x90 (cant remember off the top of my
head) - this doesnt count as a Sysex, i dont think ??
No it doesn't. -112 is 0x90, a note-on.
I have no idea how the Java binding to CoreMIDI works, but I'm looking
at this:
com.apple.audio.midi.MIDIPacketList list = null;
com.apple.audio.util.MIDIData md =
com.apple.audio.util.MIDIData.newMIDIPacketData(256);
md.addRawData( new byte[] { -112, 38, 67 });
list = new com.apple.audio.midi.MIDIPacketList(0, md);
and wondering -- how big a MIDIPacket is being created? It looks like
you want 3 bytes, but if it ends up being 256 bytes, then, depending on
what's in the other bytes, that could explain what you're seeing. In
fact, if the extra 253 bytes are all in the range 0-0x7F, then that
would result in precisely 127 MIDI events.
Also note that it is preferable to use 'sysexSend' for sending sysex
messages, as opposed to 'send' (not sure about the java names,
MIDISysexSend and MIDISend respectively in the C world). The later
returns after the complete message has been sent, whereas the former
completes asynchronously with a callback notification
(MIDISysexSendRequest, if my memory serves). This might be important
from the standpoint of timing considerations wrt large sysex packets.
Ahhh. right mate, There's a separate MIDISysexSendRequest java object
which I'll use from now on. But as I mentioned, i'm not sure i'm
constructing Sysex messages. - ought the sending of sysexes through
MIDISend and not MIDISysexSend throw exceptions or be deprecated or
something?
If the sysex is small (as a rule of thumb, say, less than 128-256
bytes) -- and there's only one of them! -- then it might as well be
sent with MIDISend instead of going through the overhead of
MIDISysexSend.
Doug
_______________________________________________
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.