Re: Audio unit view communication
Re: Audio unit view communication
- Subject: Re: Audio unit view communication
- From: Marc Poirier <email@hidden>
- Date: Mon, 14 Jun 2004 12:13:55 -0400 (EDT)
On Mon, 14 Jun 2004, stiwi wrote:
>
Hi ,
>
>
some more questions on how to share data between an view and an audio
>
thread.
>
>
typedef struct TimeLine
>
{
>
float leftMarkerPos;
>
float rightMarkerPos;
>
int numOfActivePoints;
>
int activePoint;
>
HIPoint points[kNumberOfPoints];
>
}
>
TimeData;
>
>
In my custom view (click / drag timeline) i create a data-set (see
>
above) of n values that should be used as a
>
lookup-table for an simple lfo or envelope. Right now the view keeps
>
track of the data-set so that if it needs to
>
redraw itself it doesn't have to pull the data from the au first. The
>
communication is mostly one way (view to au),
>
except if the data is changed by an preset and i need to refresh the
>
view.
>
>
After reading Marc's post i understand that the correct way is to setup
>
a AudioUnitAddPropertyListener
>
to tell my au that the view got new data and copy it to my local au
>
data-set and not to use pointers directly.
>
>
Is this the right way to do this kind of thing if you got big data-sets?
>
Do i really need two data-set? One for the view and one for the au.
>
Do i need to synchronize the copy in any way?
Regardless of which approach you take, you probably do need to synchronize
things (not sure of you specific details, so I can't say for sure). For
one thing, it may depend whether you're using the immediate or queued
property listeners in your AUView.
How large is your data? I can't imagine that it's really large enough for
this to be a concern, for an LFO or envelope points table. What is
kNumberOfPoints, maybe 1000 or so at most? That would make your data a
little under 8 KB in size. Which is completely trivial to have a
duplicate of. Even something several times that size is trivial. We're
not booting off of floppies anymore today... ;)
P.S. - For some example code of sharing a struct of analysis data for
visual display in the GUI via a property listener, you could look at my
RMS Buddy AU's source code:
http://destroyfx.org/extras/#rmsbuddy
Marc
_______________________________________________
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.