Re: Passing data to my CocoaView efficiently
Re: Passing data to my CocoaView efficiently
- Subject: Re: Passing data to my CocoaView efficiently
- From: Ian Kemmish <email@hidden>
- Date: Tue, 26 Jun 2007 20:48:07 +0100
On 26 Jun 2007, at 1:31 pm, Nat! <email@hidden> wrote:
Hi
I have a growing number of statistical value, that I want to
visualize in my AudioUnit's Cocoa View.
From reading the documentation it seems, that properties are not the
way to pass real time information between a view and it's AudioUnit.
Relax.
It is true that any data you communicate using a property has to be
flattened, converted to a canonical byte order, and copied into a
temporary buffer just in case Apple ever decide to fix the, ahem,
unintended feature about passing CFString pointers though what was
supposed to be a thin-wire API:-)
BUT - this is a user interface you're dealing with. Remember that
"real time" means anything above 12 frames per second.
There are (at least) two possible methods, both of which I use:
1) For continuously updating load and spectrum displays, I have a
repeating NSTimer in the Cocoa UI which wakes up ten or so times a
second and requests the relevant properties from the AU. For the
spectrum display, requesting the pitches and levels of even 8,000
sine oscillators takes a negligible amount of CPU time. (And
certainly less time than it takes to actually *draw* the display!)
2) When performing sinusoidal analysis of audio samples, the AU kicks
the user interface every 10 partials or so, using PropertyChanged.
This allows the user interface to animate in a way which provides
natural-looking feedback on the progress of the analysis.
Both these methods work well, as long as you set the update rate high
enough to avoid obvious flicker, but low enough not to be a drain on
resources. Which you choose to employ will depend on exactly what it
is you want your UI to do.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
Ian Kemmish 18 Durham Close, Biggleswade, Beds
SG18 8HZ
email@hidden Tel: +44 1767 601361 Mob: +44 7952
854387
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
_______________________________________________
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