Efficient View - AU communication when host is not running
Efficient View - AU communication when host is not running
- Subject: Efficient View - AU communication when host is not running
- From: Stefan Huber <email@hidden>
- Date: Sun, 27 Feb 2011 23:53:41 +0100
So, here is the deal:
- I have control points in my View.
-These control points are used to calculate a graph in the audio unit.
- This graph is used for calculations in the processing loop.
- The graph also has to be sent to the View when calculations are done in order to display it. (The graph actually passes through the control points, so any big delay would lead to a bad user experience)
Here are my thought about dealing with that situation:
- When the control points are moved, notice the host using AUParameterSet
- The audio unit notices in the process loop that parameters have changed and calculates the new graph
- when the graph is calculated a property change is sent to the view
- the view gets the property containing the graph using AudioUnitGetProperty
This is the situation I favor most, since it is a clean and efficient way to handle that data. However, the problem appears when the host is not currently processing and therefore the process loop of the plug-in isn't called. In that case the graph is not updated, as the plug-in doesn't notice the changes.
So what to do about that?
- Create a thread in the audio unit, that constantly checks for changes of parameters? I don't think that would be a good idea since then the data the process loop uses might change in the middle of the process loop. So I would have to implement a technique to deal with concurrency. However, this would solve the problem when the host is not processing.
What I am doing at the moment: After Reporting changes from the UI to the host, I am calling the getProperty method from within the view. In the getProperty method in the AU I am updating the needed parameters, calculating the new graph and returning the graph to the view. Even though this doesn't seem as clean as I would like to have it, this works. Is getProperty called from the same thread as the process Loop? At least that would explain why it is working without glitches so far.
So, big question: How are you dealing with a situation like this?
Regards,
Stefan _______________________________________________
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