Title: AUv2: Property Listener Callback Lifetime During AudioComponentInstanceDispose
I’m developing a macOS Audio Unit v2 (AUv2) instrument in C++ and investigating the correct lifetime and synchronization requirements for property-listener callbacks.
I would appreciate clarification from Apple engineers or developers with direct AUv2 implementation experience.
Specifically:
- Does AudioComponentInstanceDispose guarantee that the Audio Unit’s Close operation has completed before the call returns?
- Does disposal guarantee that all property-listener callbacks registered through AudioUnitAddPropertyListener have finished executing before the instance and its associated callback data can be destroyed?
- What are the documented guarantees of AudioUnitRemovePropertyListenerWithUserData regarding callbacks that are currently executing or already queued?
- Is there a documented synchronization procedure that allows an AUv2 plug-in to safely release listener callback state during instance shutdown?
- Are there host-ordering requirements or documented assumptions that plug-in developers must follow when registering, removing, and destroying property listeners?
My implementation is designed to avoid use-after-free, concurrent access to destroyed objects, and unsafe callback-data reclamation.
I want to base the implementation on documented Apple API guarantees rather than assumptions about host behaviour.
If relevant, please point me to the authoritative documentation or recommended implementation pattern.
Environment: macOS 12 Monterey, Xcode 14.2, AUv2 instrument, C++.