> > Hello folks > > I wrote an AUAudioUnit subclass, and I'm instantiating using the C API thus: > > AudioUnitInitialize(myAudioUnit)); > > where myAudioUnit is of type AudioUnit. Though it's backed up by an > instance of my custom AUAudioUnit subclass, the C code only sees it as an > AudioUnit. > > Elsewhere in my app, I need to call custom methods I've defined in the > AUAudioUnit subclass. But I'm stuck trying to find a way to cast an > AudioUnit to an AUAudioUnit. > > How can I otherwise convert an AudioUnit instance to an AUAudioUnit > instance?
You can’t directly do this. There is only one way to get an instance of both AudioUnit and AUAudionUnit that I’m aware of and that is to use a 3rd API, which is AVAudioUnit. AVAudioUnit has the following properties on it: @property(nonatomic, readonly) AudioUnit audioUnit; @property(nonatomic, readonly) AUAudioUnit *AUAudioUnit; (as part of AVAudioNode, which AVAudioUnit is a subclass). Instantiate with AVAudioUnit and then use the properties to get the appropriate type of audio unit. I hope this helps. — Dominic _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com This email sent to [email protected]
