Re: Coreaudio-api Digest, Vol 19, Issue 8
Re: Coreaudio-api Digest, Vol 19, Issue 8
- Subject: Re: Coreaudio-api Digest, Vol 19, Issue 8
- From: Dominic Feira via Coreaudio-api <email@hidden>
- Date: Wed, 13 Apr 2022 15:09:03 -0400
>
> 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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden