• 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: question about CoreMIDI & cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about CoreMIDI & cocoa


  • Subject: Re: question about CoreMIDI & cocoa
  • From: Shaun Wexler <email@hidden>
  • Date: Tue, 28 Sep 2004 14:51:48 -0700

On Sep 28, 2004, at 7:23 AM, Khamba Staring wrote:

I've setup the midi callback so that a standard C function is called when a midi message is received by the system. I'd like to make this C function signal a method in an ojbc class, in order to let that method update an NSTextView in my programs window.

Now, the callback is called when a signal is received; it can call a method in my MIDI class, which also seems to work (some printf()s showed me). However, when I try to send a message to the NSTextView outlet from the method called by the C callback, the program buserrors.

That usually results from an access to revoked memory, which indicates some other programming error in your code. You certainly shouldn't manipulate GUI objects or block a realtime thread such as the CoreMIDI callback, and attempts at memory allocation will block and often fail.


I suppose this happens because the C function lives in the midi thread which is automatically
created by CoreMIDI?


What can I do to call a function/send a message to the MIDI class so I can safely update the NSTextView?

All interaction with AppKit should be done on the main thread. To start with, try:


[myMidiObject performSelectorOnMainThread:selector withObject:object waitUntilDone:NO];

... which creates and enqueues a mach message and returns immediately.
--
Shaun Wexler
MacFOH
http://www.macfoh.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: 
 >question about CoreMIDI & cocoa (From: Khamba Staring <email@hidden>)

  • Prev by Date: Re: question about CoreMIDI & cocoa
  • Next by Date: Re: How to check if a system has an audio input?
  • Previous by thread: Re: question about CoreMIDI & cocoa
  • Next by thread: Re: question about CoreMIDI & cocoa
  • Index(es):
    • Date
    • Thread