Re: MIDI read proc and screen update
Re: MIDI read proc and screen update
- Subject: Re: MIDI read proc and screen update
- From: Kurt Revis <email@hidden>
- Date: Fri, 8 Feb 2002 21:13:05 -0800
On Friday, February 8, 2002, at 08:42 PM, Joe Chang (l%l,m8) wrote:
Suppose I'm making a MIDI monitor application.
Hee hee, already done!
http://www.snoize.com/MIDIMonitor/
I'm wondering what is the best way to update screen (in Cocoa app) as
MIDI signals comes in. Is it ok to send message to a controller object
for screen update from the midi-read-proc? or should I take another way?
The MIDI read proc is called in a CoreMIDI thread, which is a
high-priority, time-constraint thread. So ideally you want to do as
little work as possible and get out as soon as you can. Also, in a
Cocoa app, you generally manipulate the interface from the main thread
only.
So your read proc should do its processing, and then inform the main
thread that there are new messages (via whatever method you like--there
are a few). In the next pass through your app's run loop in the main
thread, you should notice that new messages have come in, and refresh
the interface.
More docs about Cocoa threading here:
file:///Developer/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/Multithreading/
Also take a look at the Cocoa-Dev mailing list archives--this issue
(updating the UI based on work done in a separate thread) has come up
multiple times.
I am using the message queue stuff from OmniFoundation for communicating
from my work threads to the main thread. This code is very useful but
unfortunately not at all documented...
http://www.omnigroup.com/developer/sourcecode/
--
Kurt Revis
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.