I am experiencing an issue with AudioUnitRender() on the iPhone. I have an AUGraph with containing a 3DMixer with mono 44.1 kHz PCM inputs and stereo output. This feeds into the AURIO unit. When I directly connect the 3DMixer to the AURIO unit using AUGraphConnectNodeInput(), everything runs perfectly. However, I don't want to use the node connection. I want to use a callback in the AURIO unit which renders the 3DMixer. When I attempt to do this, I am unable to successfully render the 3DMixer using AudioUnitRender() inside the AURIO callback. I get a -50 error from the AudioUnitRender command. The callback is very simple:
static OSStatus rioCallback(void *inRefCon, AudioUnitRenderActionFlags*ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32inNumberFrames, AudioBufferList *ioData) {
RSplayer *player = (RSplayer *)inRefCon;
OSStatus err = 0;
err = AudioUnitRender(player.masterMixer, ioActionFlags, inTimeStamp,
inBusNumber, inNumberFrames, ioData);
return err;
}
Is there a flag I should be setting other than what is supplied by the callback input? I feel the issue may be something to do with mono inputs to the 3DMixer or a general peculiarity with rendering the 3DMixer. I was able to find a work around to this issue by inserting a MultiChannelMixer between the 3DMixer and the AURIO unit. Then I directly connect the3DMixer output to the MultiChannelMixer input. I am then able to successfully render the MultiChannelMixer using a similar version of this callback (replacing the audio unit that gets rendered obviously).
Can anyone offer insight into this issue? Is it possible to render the 3DMixer here without the buffer MultiChannelMixer? Is there an additional setting or flag that I need to apply? I appreciate all help.
Regards,
Robb