I am using realtime audio rendering with Audio Unit RemoteIO
and I need to do sample rate conversions to ensure that my rendering is the same sample rate as hardware specification. Eg. in iPhone 12 sample rate is 48khz but in iPhone 8 its 44.1khz.
To do this sample rate conversion I am using AudioConverterFillComplexBuffer
method. However there is a catch. In order to ensure I do not get any underruns I would like to check AudioConverterFillComplexBuffer
methods source code to see whether memory allocations are made with new
keyword. It is a requirement that since mem alloc is blocking it should never be used inside a remote io callback.
Is there a way to access AudioConverterFillComplexBuffer
function from AudioToolBox
's source code? In xcode I can only see the header.
The implementation is private to Apple but both AudioConverterFillComplexBuffer
and the C++ side of AudioConverter
are used directly by IOProcs so there should be no problem calling that function from a real time context.
Here is a screenshot from the render block of an AVAudioSourceNode
: