Re: Audio unit view communication
Re: Audio unit view communication
- Subject: Re: Audio unit view communication
- From: stiwi kirch <email@hidden>
- Date: Tue, 15 Jun 2004 11:31:10 +0200
On 14.06.2004, at 18:13, Marc Poirier wrote:
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.
I am rewriting my code right now to use the queued listener to not
interrupt the render thread.
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... ;)
LOL. (Thank god) The size depends on what the user wants to do with
this custom view.
But your estimation is correct. For an Absynth kind of enveloper
kNumberOfPoints
would be less than 128 and 128 to 1024 for an simple LFO (interpolate
between point).
But it's not the size alone, its also the refresh rate if the user is
playing a note and editing the
view at the same time.
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
Thanks a lot. I'll do that before i ask some more questions. ;)
stiwi
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.
------------------------------------------------------------------------
---------------------------
Stefan Kirch
web: www.alphakanal.de
iChat: 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.