[SOLVED]Re: Sending large sysex dump
[SOLVED]Re: Sending large sysex dump
- Subject: [SOLVED]Re: Sending large sysex dump
- From: "Peter Karlsson" <email@hidden>
- Date: Tue, 8 Feb 2005 09:34:26 +0100
I tried MIDISendSysex and it worked without any problems so my problem is
solved.
Thanks Doug for you help.
Peter
Ursprungligt meddelande
>
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