Hi,
we are working on an audio app in Unity which targets, among other platforms, iOS devices (and macOS later). For iOS, we are using the “Unity as a library”-approach, so we have a native app part which is written in Swift.
Everything works great, except for one feature we would really like to implement but can’t find out how.
We want to send the audio data generated with our app to another app (“inter-app audio”). To do so, we of course need access to that data (and then feed it into an AVAudioUnit in our native iOS app). But we can not find any information about where to grab that data. It is not clear at all to us how Unity sends the audio to the hardware/low level audio system.
Here is a little diagram which shows our use case:
So we have our native iOS app with all the Unity stuff as a framework. Unity sends the audio data directly to the system (down arrow). But we want to feed it to another iOS audio processing app (“Host Audio App”) which pulls data from an AVAudioUnit in our native app. The little dashed arrow basically is our problem area: how to get the audio data to the AVAudioUnit, ideally instead sending it to the system.
Any help or advice is appreciated!
Marc-André
PS. Because we are basically stuck right now, we are thinking about a very raw solution using a shared buffer (NativeArray) which will be written to on the Unity side and then read on the iOS side. But this seems kind of brittle, especially for timing reasons… So this is kind of a last resort ![]()
