I want to implement a Audio Unit pattern,I/O Pass Through.My code below
OSStatus result = noErr;
result = NewAUGraph(&audioGraph);
if (noErr != result) {[self printErrorMessage: @"NewAUGraph" withStatus: result]; return;}
// 2.add AUNode
AUNode inputNode;
AUNode outputNode;
// client format audio goes into the mixer
clientFromat.SetCanonical(1, true);
clientFromat.mSampleRate = kGraphSampleRate;
clientFromat.Print();
CAComponentDescription input_desc(kAudioUnitType_Output,kAudioUnitSubType_RemoteIO,kAudioUnitManufacturer_Apple);
CAComponentDescription output_desc(kAudioUnitType_Output,kAudioUnitSubType_RemoteIO,kAudioUnitManufacturer_Apple);
result = AUGraphAddNode(audioGraph, &input_desc, &inputNode);
if (noErr != result) {[self printErrorMessage: @"AUGraphNewNode failed for Mixer unit" withStatus: result]; return;}
result = AUGraphAddNode(audioGraph, &output_desc, &outputNode); // this line crash
if (noErr != result) {[self printErrorMessage: @"AUGraphNewNode failed for Mixer unit" withStatus: result]; return;}
result = AUGraphAddNode(audioGraph, &output_desc, &outputNode); this line crashed.Why? How to sends incoming audio directly to the output hardware without render call function ?