I get an Error -50 in AudioUnitRender call. My Audio Unit is simply a RemoteIO unit getting samples from the mic. What is the meaning of error -50?
let status = AudioUnitRender(controller.audioUnit!, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, listPtr)
if noErr != status {
print("Error \(status)");
fatalError("Render status \(status)")
// return status;
}
-50 (
kAudio_ParamError
) means one of the parameters you passed is wrong.A common error with
AudioUnitRender
is to pass anAudioBufferList
with the wrong number ofmNumberBuffers
(you may be recording non-interleaved stereo) or theAudioBuffer
s themselves may be the wrong size or have the wrong number of channels.I encounter this problem whenever I forget that the simulator and device remote audio units have different default stream formats and don't explicitly set them via
I think the simulator defaults to interleaved integer and the device defaults to non interleaved float, although maybe that's just my configuration.
From the
AudioUnitRender
header file:By passing null
mData
(point (2)) can save you an unnecessary copy, but you still need to know the format "topology", which is justmNumberBuffers
(probably 1 or 2).