CoreMIDI functions returning kMIDIWrongThread
CoreMIDI functions returning kMIDIWrongThread
- Subject: CoreMIDI functions returning kMIDIWrongThread
- From: "Brian Sheehan" <email@hidden>
- Date: Tue, 25 Apr 2006 16:02:56 +0100
Hi,
In the following code, all the CoreMIDI functions called return with errors:
#import <Cocoa/Cocoa.h>
#import <CoreMIDI/CoreMIDI.h>
#import <CoreFoundation/CoreFoundation.h>
int main(int argc, char *argv[])
{
ItemCount numOfEndpoints;
MIDIEndpointRef endpoint;
MIDIClientRef theMidiClient;
OSStatus err = MIDIRestart();
err = MIDIClientCreate(CFSTR("Test"), NULL, NULL, &theMidiClient);
numOfEndpoints = MIDIGetNumberOfDestinations();
if (numOfEndpoints)
{
endpoint = MIDIGetDestination(0);
}
return NSApplicationMain(argc, (const char **) argv);
}
MIDIRestart() and MIDIClientCreate() both return -10841 (from the
docs: "kMIDIWrongThread: A driver is calling a non-I/O function in the
server from a thread other than the server's main thread").
The puzzling thing is that in a different project with *exactly* the
same code, things work fine. I noticed that with the second project,
a thread is started by the call to MIDIRestart() - this doesn't happen
with the code in the first project.
Any ideas? I'm really scratching my head here... both the projects
concerned here are Cocoa document based projects. The first project is
a working application, and the second project (where the CoreMIDI
calls succeed) is the default doc-based cocoa app template from xcode.
thanks,
Brian
_______________________________________________
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