I'm getting an occasional crash as my Audio Unit is being uninitialized. The stack trace shows that my UI thread invokes AudioUnitGetProperty() while com.apple.main-thread invokes AUEffectBase::Cleanup(). Inside my AudioUnitGetProperty() implementation, I query values from AUEffectBase's AUKernelBase instances. Meanwhile, AUEffectBase::Cleanup() is freeing these kernels. So, it seems that my approach is fundamentally flawed.
Now, I see that in the FilterDemo, AudioUnitGetProperty() is called in the UI's updateCurve function. The difference seems to be that updateCurve is called from within the Audio Unit event callback function. Is it this fact that makes AudioUnitGetProperty() thread-safe in this case (the "Audio Unit Programming Guide" says that the Audio Unit Event API is thread-safe)?
If the answer to that question is yes, then it seems I simply need to use Audio Unit events to get a thread-safe context from which to call AudioUnitGetProperty(). However, the property in question holds a meter level and needs to be updated many times per second. Is this an appropriate use of Audio Unit events or would a polling approach be better?
Speaking of polling, kAudioUnitParameterFlag_MeterReadOnly looks appealing. Should I simply set up a parameter with this flag and poll it from my UI thread with AudioUnitGetParameter()? Will I run into the same crash that I'm running into with AudioUnitGetProperty()?
Any clarifications would be appreciated. I apologize if this has been covered elsewhere. I have found some information through Google but am still struggling with these seemingly basic questions. I'm unable to get any response from the coreaudio-api list search...
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