• 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
CoreMIDI functions returning kMIDIWrongThread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: CoreMIDI functions returning kMIDIWrongThread
      • From: Doug Wyatt <email@hidden>
  • Prev by Date: Re: WireTap, CoreAudio's API, and system capture, and kexts...
  • Next by Date: Re: Is there such a thing as a "CoreMIDI Version Number" that can be queried?
  • Previous by thread: Re: WireTap, CoreAudio's API, and system capture, and kexts...
  • Next by thread: Re: CoreMIDI functions returning kMIDIWrongThread
  • Index(es):
    • Date
    • Thread