How to record audio played by the app

Hi all,


I would like to know if it's possible to record all audio played by my app, either played via AudioUnit, AVPlayer, AudioQueue or some other source (except system sounds / sounds from other apps). The thing is that some of the audio played by the app is generated by code that resides in a static library, the source of which is hard for me to access. Thus I would like to achieve this by intercepting the mixed down audio from all sources before it leaves the app.

I'm thinking in the way of setting up an AudioUnit and connecting it's input bus to the audio coming from the app, but I am not sure if this can work. I tried to setup a remoteIO audio unit, and getting the samples from the output callback sample buffers, but it does not work that way, only makes a very annoying noise, which is mixed with other app audio 🙂


Thanks in advance for all your thoughts!