Is it possible to host an AU from inside another AU?

Im trying to figure out how to embed third party AUs in my AU, specifically MIDI Instruments. Hosting other AUs is trivial, what seems much more complex is to act as a Instrument passthrough. Any hint?

best

Accepted Reply

You can open another Audio Unit from within your Audio Unit. You can use the MIDI input and output blocks to pass MIDI events (scheduleMIDIEventBlock and midiOutputEventBlock https://developer.apple.com/documentation/audiotoolbox/auaudiounit).

Alternatively, you can use AVAudioEngine, which has support for MIDI event routing between Audio Unit nodes (see the connectMIDI method in AVAudioEngine.h).




Replies

You can open another Audio Unit from within your Audio Unit. You can use the MIDI input and output blocks to pass MIDI events (scheduleMIDIEventBlock and midiOutputEventBlock https://developer.apple.com/documentation/audiotoolbox/auaudiounit).

Alternatively, you can use AVAudioEngine, which has support for MIDI event routing between Audio Unit nodes (see the connectMIDI method in AVAudioEngine.h).




Hi, thanks for the reply.

Unfortunately the documentation of scheduleMIDIEventBlock and scheduleMIDIEventBlock is quite sparse and no concrete examples around.

I think the AVAudioEngine solution would fit better to my needs, since the my standalone app already uses this class and a Mixer as a multi-instrument, multi-effect rack. Where I get lost is how to implement the same infrastructure as an Audio Unit.
In createAudioUnit(with componentDescription: AudioComponentDescription) of AudioUnitViewController, passing the mixer AUAudioUnit doesn't seem enough and, second, what about the MIDI connection between the host app and the first input unit of the mixer?

I'd appreciate if someone could point me in the right direction.