Cocoa, Threads and Callbacks
Cocoa, Threads and Callbacks
- Subject: Cocoa, Threads and Callbacks
- From: "Mark's Studio" <email@hidden>
- Date: Sun, 13 Jul 2003 23:24:06 +0200
I'm still experimenting, adding more and more different widgets.
XYScope, peakmeters, etc. just to see how it works.
I have a soundPlayer object, that has the callBack that feeds data to
the defaultOutput,
within the callBack i send NSNotifications with position info, at
various intervals to other objects to update there UI.
and it's beginnig to be a bit crowded.
I was thinking of implementing it in another way.
When the soundPlayer starts playing,
Start a thread for every widget, and then access the position info from
the soundPlayer,from the thread at certain intervals.
if i have something like this in the soundPlayer
-(int)positionInfo{
return positionInfo;
}
it's only the soundPlayer that updates the positionInfo (in the
callback),
do i then need to use a NSLock when updating the positionInfo?
can i just call [soundPlayer positionInfo] from the other threads?
Is accessing a immutable object always thread safe?
Will this work, and is it the right way to do it?
Peter Mark
Mark's Recording Studio A/S
Lundeskovsvej 3 2900 Hellerup
Denmark
Tel: +45 35366078 Fax: +45 35366038
www.marks-studio.dk
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.