Got error from AudioUnitRender() function
<p>I want to implement the I/O with a Render Callback Function Pattern in the "Audio Unit Hosting Guide for iOS" document. I'm not sure how to implement the render callback function.</p>

<p>My parts of codes are listed below:</p>

<pre><code>- (void) configureAndInitializeAudioProcessingGraph {
...
NSLog (@"- Attach the input render callback and context to the input bus");

AURenderCallbackStruct inputCallbackStruct;
inputCallbackStruct.inputProc        = &amp;inputRenderCallback;
inputCallbackStruct.inputProcRefCon  = NULL;    //&amp;soundData;                   

result = AUGraphSetNodeInputCallback (
                                       processingGraph, 
                                       ioNode, 
                                       0,          //output element of I/O unit     
                                       &amp;inputCallbackStruct
                                       );
...
}


static OSStatus inputRenderCallback (
void                        *inRefCon,      
AudioUnitRenderActionFlags  *ioActionFlags,
const AudioTimeStamp        *inTimeStamp,
UInt32                      inBusNumber,   
UInt32                      inNumberFrames,
AudioBufferList             *ioData 
) 
{

DCIDBAudio *audio = (DCIDBAudio *)inRefCon;

OSStatus err = AudioUnitRender (
            audio.ioUnit, 
            ioActionFlags, 
            inTimeStamp, 
            1,            input element od I/O unit
            inNumberFrames, 
            ioData
            );

if (err)
{
    NSLog(@"AudioUnitRender() failed.");
    return err;
}

return noErr;

}
</code></pre>

<p>I always get the error "AudioUnitRender() failed." I just want to use AudioUnitRender() to get data from the output of the 1 element of the io unit and then put the data into the ioData buffer so that they cab be used by the 0 element of the io unit. </p>

<p>Could anybody point out what's wrong in my above codes? should I initialize the parameters:
inNumberFrames and ioData first?</p>

<p>Any comments and instructions will be highly appreciated.</p>

<p>Thanks,
Finspoo  </p>
