Re: Crashing when calling MIDISendSysex()
Re: Crashing when calling MIDISendSysex()
- Subject: Re: Crashing when calling MIDISendSysex()
- From: Hidetomo Katsura <email@hidden>
- Date: Sat, 19 May 2007 16:30:11 -0700
your "MIDISysexSendRequest sysexSendRequest" is on the stack. it
likely gets destroyed after your function returns (or some other
functions get called).
you need to malloc/calloc it (and free later, of course) or use
"static MIDISysexSendRequest sysexSendRequest" if the same static
variable doesn't get used until it completes.
regards,
katsura
On May 19, 2007, at 4:10 PM, Stephen Kay wrote:
I'm having some problems trying to get MIDISendSysex() to work in
my app.
Mac OS X 10.4.8, PowerMac.
Up until now, I have been using MIDISend() for sysex messages, and
just not
doing anything over about 256 Bytes. It's now time to finish
implementing
the stuff in my app that handles large/huge sysex dumps.
So I started trying to use MIDISendSysex() today. It crashes
directly after
being called, with an access fault, dumping me into the CoreMIDI
Lib with I
EXC_BAD_INSTRUCTION.
Question 1:
Anyone know of some example Code that shows how to use MIDISendSysex?
I have been unable to find any example code that shows how to use
this.
Question 2:
Here's what I'm doing. Note that my code works fine for normal
MIDISend()
stuff, and has been for 6 months or so, so I know the endpoints and
basic
initialization etc. is all fairly robust. So I'm not going to show
all of
that here at the moment.
Here's what I'm trying:
It didn't seem to matter whether I specified a MIDICompletionProc
or NULL.
data is a Byte ptr to a properly formatted Sysex Message, about
2500 bytes
long. But I tried this with short little messages, and it crashes
the same
way.
void MyCompletionProc(void *ptr);
void MyCompletionProc(void *ptr)
{
// nothing for now
}
MIDIEndpointRef dst = MIDIGetDestination(0); // just testing
// I know it's a valid endpoint because I can send
// normal MIDI messages to it
If (dst){
MIDISysexSendRequest sysexSendRequest;
sysexSendRequest.destination = dst;
sysexSendRequest.data = (Byte *) data;
sysexSendRequest.bytesToSend = len;
sysexSendRequest.complete = false;
sysexSendRequest.completionProc = (MIDICompletionProc)
MyCompletionProc;
sysexSendRequest.completionRefCon = NULL;
MIDISendSysex(&sysexSendRequest);
}
Any suggestions?
Thanks,
- Stephen
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Stephen Kay
Karma-Lab :: developers of KARMA
http://www.karma-lab.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
_______________________________________________
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
_______________________________________________
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