On Mon, Feb 22, 2010 at 10:24 PM, Roger Dannenberg <[email protected]> wrote:
> I made a stripped-down version of the PortMidi sysex loopback code that
> loses messages under OS X and submitted it to Apple with a bug report.
>
> I just got a reply that there is a 15000 byte/second limit on MIDI data
> to prevent MIDI feedback loops.
>
> If the limit is achieved by dropping messages, this would explain the
> bad behavior we've seen. I will do more testing and think about how to
> limit the data rate going out of PortMidi. I suppose blocking to slow
> the sender would be possible and better than allowing senders to send
> data that OS X will drop.
I think portmidi might already use this api, and my memory from when I
implemented it is a little fuzzy, but the core midi MIDISendSysex
already spaces a large message into chunks separated by time to avoid
sending too much too fast. I'm not sure if my core midi binding has
the same problem, but the code, included below, is very simple. What
exactly is the pattern that causes problems? Sending one very large
sysex? A stream of them?
static void
sysex_complete(MIDISysexSendRequest *req)
{
Byte *bytes = (Byte *) req->completionRefCon;
delete[] bytes;
delete req;
}
static Error
write_sysex(MIDIEndpointRef dest, WDevId wdev, int len,
const unsigned char *bytes)
{
MIDISysexSendRequest *req = new MIDISysexSendRequest;
req->destination = dest;
req->data = new Byte[len];
memcpy(const_cast<Byte *>(req->data), bytes, len);
req->bytesToSend = len;
req->complete = false;
req->completionProc = sysex_complete;
req->completionRefCon = (void *) req->data;
return MIDISendSysex(req);
}
_______________________________________________
media_api mailing list
[email protected]
http://lists.create.ucsb.edu/mailman/listinfo/media_api