• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MIDIPacketList behaviour problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MIDIPacketList behaviour problem


  • Subject: Re: MIDIPacketList behaviour problem
  • From: Michael Harbour <email@hidden>
  • Date: Thu, 22 Jan 2004 23:44:35 +0000

Doug, thanks for your comments - that's exactly whats going on.

I've change the code to

com.apple.audio.midi.MIDIPacketList list = null;
com.apple.audio.util.MIDIData md = com.apple.audio.util.MIDIData.newMIDIRawData(3);
md.addRawData( new byte[] { -112, 38, 67 });
list = new com.apple.audio.midi.MIDIPacketList(0, md);

and that works as I would expect.
Note the call is now MIDIData.newMIDIRawData() not MIDIData.newMIDIPacketData()

I originally used .newMIDIPacketData(256) because 256 was one of the few numbers i could get to make a Packet without throwing a CAMemoryObjectException
I'm still not clear about the difference between newMIDIPacketData and neRawData calls - do you get pre-built MIDI bytes inserted for you into a MIDIPacket? I need to know what the key MIDIpacket abstraction is and its relation to an n-byte MIDI protocol event.

The documentation in both Java and C APIs is _woefully_ thin (or non-existent in the JavaDoc case) on building up packets from scratch and sending them out.
All the nice architecture and layers and models aside, I would have thought that MIDIPacket building was the absolute focus of this API and yet I cant seem to find this emphasised anywhere - do these Packet building docs exist anywhere on the Developers Tools CD and I havent found them yet? I'll eat my hat and apologise if they are :)

Mike

On 21 Jan 2004, at 21:21, Doug Wyatt wrote:

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.

  • Follow-Ups:
    • Re: MIDIPacketList behaviour problem
      • From: Doug Wyatt <email@hidden>
References: 
 >MIDIPacketList behaviour problem (From: Michael Harbour <email@hidden>)
 >Re: MIDIPacketList behaviour problem (From: Michael Harbour <email@hidden>)

  • Prev by Date: Re: Streaming OS X audio over network
  • Next by Date: Re: TC PowerCore Plug-ins broken in GarageBand
  • Previous by thread: Re: MIDIPacketList behaviour problem
  • Next by thread: Re: MIDIPacketList behaviour problem
  • Index(es):
    • Date
    • Thread