Re: AUEffectBase and UI communication
Re: AUEffectBase and UI communication
- Subject: Re: AUEffectBase and UI communication
- From: Stephen Blinkhorn <email@hidden>
- Date: Sat, 6 Nov 2010 12:44:46 -0600
On 5 Nov 2010, at 11:32, George Tourtellot wrote:
Hello,
I have created an AudioUnit with a CocoaView, and want to be able to
communicate information from the class that inherits from
AUEffectBase back to a controller class for the UI.
For example, I would want to extract some analysis information from
the audio and then display that information back in the Cocoa GUI.
I know I could use a global structure for the data communication,
but there are obvious reasons why I'd rather not do that. What is
the preferred approach?
Properties are the preferred method for AU<>view communication.
So for example in my Cocoa view I have some peak meters. In the AU I
store the current peak levels for each channel/part etc which I
calculate during Render(). In the Cocoa view I set an NSTimer that
triggers every 50ms or so and collects the data from the AU via
GetProperty() e.g.:
// refresh meters
UInt32 dataSize = (num_meters * sizeof(float);
ComponentResult result = AudioUnitGetProperty(mAU,
kAudioUnitCustomProperty_RefreshMeters, kAudioUnitScope_Global, 0,
mPeakMeterAmps, &dataSize);
mPeakMeterAmps is C array into which the new meter values will be
copied. If I was doing an oscilloscope type thing I'd use the same
approach.
Probably best to read about properties in the AU docs. The FilterDemo
example also illustrates the technique.
Hope that helps,
Stephen
thanks,
George
_______________________________________________
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
_______________________________________________
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