• 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: Sending large sysex dump
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending large sysex dump


  • Subject: Re: Sending large sysex dump
  • From: Doug Wyatt <email@hidden>
  • Date: Mon, 7 Feb 2005 07:45:12 -0800

On Feb 7, 2005, at 0:02, Peter Karlsson wrote:
The memory area is 100000 bytes, and my dump only 8160 bytes.

It seems to be some kind of limit here. I can send 262 bytes with MIDISend,
if I try to send more then that nothing will be sent. Can someone please
tell me why?

Peter

Below is a quick program I wrote to test this.

I successfully sent a sysex with 384 bytes in the body to the IAC driver and it came back to another test tool's readProc intact.

Does it work for you?

Can you verify with MIDIMonitor that your sysex is making it intact to the driver? (spy on the application output) If it's not getting to the driver, then I'll investigate it further.

If the sysex is getting to the driver, then it's possibly a driver issue -- does your interface have an output activity indicator? Does it look like the interface is receiving and retransmitting the bytes to the device?

While testing this I noticed that MIDIPacketListAdd will not fail if asked to make a packet list larger than 65536 bytes (there are good internal reasons to limit the size of any one contiguous message and it's simple enough to break it up).

Is there a reason you're not using MIDISendSysex?

Doug

- - - - - - - - - - - - - - - - -

#include <CoreMIDI/CoreMIDI.h>

#define kBodySize 384

MIDIPortRef gOutputPort;
MIDIEndpointRef gDestEndpoint;

static void SendBytes(Byte *msg, int len)
{
Byte buffer[kBodySize+16];
MIDIPacketList *pktlist = (MIDIPacketList *)buffer;
MIDIPacket *pkt;

pkt = MIDIPacketListInit(pktlist);
if (pkt == NULL) {
printf("MIDIPacketListInit failed\n");
exit(1);
}

pkt = MIDIPacketListAdd(pktlist, sizeof(buffer), pkt, 0, len, msg);
if (pkt == NULL) {
printf("MIDIPacketListAdd failed; first byte: X\n", msg[0]);
exit(1);
}

MIDISend(gOutputPort, gDestEndpoint, pktlist);
}

static MIDIEndpointRef FindDestinationByName(char *destName)
{
CFStringRef pname;
char name[64];
int n = MIDIGetNumberOfDestinations();

for (int i = 0; i < n; ++i) {
MIDIEndpointRef dest = MIDIGetDestination(i);
MIDIObjectGetStringProperty(dest, kMIDIPropertyName, &pname);
CFStringGetCString(pname, name, sizeof(name), 0);
CFRelease(pname);
if (!strcmp(name, destName))
return dest;
}
return NULL;
}

int main (int argc, const char * argv[])
{
MIDIClientRef client;

if (MIDIClientCreate(CFSTR(""), NULL, 0, &client)) {
printf("MIDIClientCreate failed\n");
return 1;
}
if (MIDIOutputPortCreate(client, CFSTR("out"), &gOutputPort)) {
printf("MIDIOutputPortCreate failed\n");
return 1;
}

//gDestEndpoint = MIDIGetDestination(0);
gDestEndpoint = FindDestinationByName("IAC Bus 1");
if (gDestEndpoint == NULL) {
printf("no destination found\n");
return 1;
}

static Byte hdr[] = { 0xF0, 0x0F, 0x02, 0x00, 0x02 };
SendBytes(hdr, sizeof(hdr));

// construct sysex body -- just a series of MIDI data bytes corresponding to the index
Byte *body = new Byte[kBodySize];
for (int i = 0; i < kBodySize; ++i)
body[i] = i & 0x7F;

SendBytes(body, kBodySize);

Byte eox = 0xF7;
SendBytes(&eox, 1);

return 0;
}


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >RE: Re: Sending large sysex dump (From: "Peter Karlsson" <email@hidden>)

  • Prev by Date: RE: Re: Sending large sysex dump
  • Next by Date: [SOLVED]Re: Sending large sysex dump
  • Previous by thread: RE: Re: Sending large sysex dump
  • Next by thread: [SOLVED]Re: Sending large sysex dump
  • Index(es):
    • Date
    • Thread