4. Call AudioUnitRender to work AUGraph flow. (Can't use AUGraphStart() because it did not happen nothing)
OSStatus rst = noErr;
int FRAMES = 512;
// render settings
AudioTimeStamp timestamp;
timestamp.mSampleTime = 0;
timestamp.mFlags = kAudioTimeStampSampleTimeValid;
AudioBufferList bufferList;
bufferList.mNumberBuffers = 1;
bufferList.mBuffers[0].mNumberChannels = 1;
bufferList.mBuffers[0].mDataByteSize = FRAMES * 1 * sizeof (float);
while (1) { // only for Test
AudioUnitRenderActionFlags flags = 0;
result = AudioUnitRender(mOutput,
&flags,
×tamp,
0,
FRAMES,
&bufferList);
if (result) { printf("AURender result %d X %4.4s\n", result, result, (char*)&result); return; }
}
......
But unfortunately I received -50 error from AudioUnitRender function.
From here, my questions start.
1. Is my approach is correct to write a file from AUGraph?
2. If it is not, is there best way to get a result?
3. Can you give me a hint with sample code?