I noticed another difference between using a single AU directly and within a graph.
I tried to assign two separate callbacks (a recording one and a render one) to the AU, but this only works without a graph. Where I use
AudioUnitSetProperty(myOutputUnit,
kAudioOutputUnitProperty_SetInputCallback,
kAudioUnitScope_Global,
InputBus,
&callbackDescriptor,
sizeof(callbackDescriptor));
// and
callbackDescriptor.inputProc = RenderCallback;
callbackDescriptor.inputProcRefCon = this;
AudioUnitSetProperty(myOutputUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Global,
OutputBus,
&callbackDescriptor,
sizeof(callbackDescriptor));
// where InputBus = 1, OutputBus = 0.
The above works fine once I call AudioOutputUnitStart(myOutputUnit); The callbacks start working right away.
However, with a graph, I tried
callbackDescriptor.inputProc = RecordingCallback;
callbackDescriptor.inputProcRefCon = this;
AUGraphSetNodeInputCallback(myGraph, myOutputNode, InputBus, &callbackDescriptor );
callbackDescriptor.inputProc = RenderCallback;
callbackDescriptor.inputProcRefCon = this;
AUGraphSetNodeInputCallback(myGraph, myOutputNode, OutputBus, &callbackDescriptor );
and also tried
callbackDescriptor.inputProc = RecordingCallback;
callbackDescriptor.inputProcRefCon = this;
AudioUnitSetProperty(myOutputUnit,
kAudioOutputUnitProperty_SetInputCallback,
kAudioUnitScope_Global,
InputBus,
&callbackDescriptor,
sizeof(callbackDescriptor));
callbackDescriptor.inputProc = RenderCallback;
callbackDescriptor.inputProcRefCon = this;
AUGraphSetNodeInputCallback(myGraph, myOutputNode, OutputBus, &callbackDescriptor );
// myOutputNode was where I place myOutputUnit in the graph.
Neither graph attempts worked after I called AUGraphStart(myGraph), i.e., my RecordingCallback was never called.
Am I doing wrong or is this expected?
Thanks,
Beinan