Inter App Audio technology : make effect node and instrument node independent
<p>I am writing an HOST application that uses <strong>Core Audio's</strong> new iOS 7 <strong>Inter App Audio technology</strong>. I have managed to get the instruments apps and effects app with the help of  <a href="https://developer.apple.com/library/content/samplecode/InterAppAudioSuite/Introduction/Intro.html" rel="noreferrer">Inter-App Audio Examples</a> .</p>
<p>The issue is that the <strong>effect node</strong> is <strong>dependent</strong> upon the instrument node. I want to <strong>make effect node and instrument node independent</strong>.</p>
<p>Here i my Try.</p>
<pre><code>if (desc.componentType == kAudioUnitType_RemoteEffect) {
//            if ([self isRemoteInstrumentConnected]) {
                if (!_engineStarted)                                    // Check if session is active
                    [self checkStartOrStopEngine];
                
                if ([self isGraphStarted])                              // Check if graph is running and or is created, if so, stop it
                    [self checkStartStopGraph];
                
                if ([self checkGraphInitialized ])                      // Check if graph has been inititialized if so, uninitialize it.
                    Check(AUGraphUninitialize(hostGraph));
                
                Check (AUGraphAddNode (hostGraph, &amp;desc, &amp;effectNode)); // Add remote instrument

                //Disconnect previous chain
               // Check(AUGraphDisconnectNodeInput(hostGraph, mixerNode, remoteBus));
                
                //Connect the effect node to the mixer on the remoteBus
                Check(AUGraphConnectNodeInput (hostGraph, effectNode, 0, mixerNode, remoteBus));
                
                //Connect the remote instrument node to the effect node on bus 0
                Check(AUGraphConnectNodeInput (hostGraph, instrumentNode, 0, effectNode, 0));
                
                //Grab audio units from the graph
                Check(AUGraphNodeInfo(hostGraph, effectNode, 0, &amp;effect));
                currentUnit = &amp;effect;
            }

if (currentUnit) {
            Check (AudioUnitSetProperty (*currentUnit,                  // Set stereo format
                                         kAudioUnitProperty_StreamFormat,
                                         kAudioUnitScope_Output,
                                         playerBus,
                                         &amp;stereoStreamFormat,
                                         sizeof (stereoStreamFormat)));
            UInt32 maxFrames = 4096;
            Check(AudioUnitSetProperty(*currentUnit,
                                       kAudioUnitProperty_MaximumFramesPerSlice,
                                       kAudioUnitScope_Global, playerBus,
                                       &amp;maxFrames,
                                       sizeof(maxFrames)));
            
            [self addAudioUnitPropertyListeners:*currentUnit];          // Add property listeners to audio unit
            Check(AUGraphInitialize (hostGraph));                       // Initialize the graph

            [self checkStartStopGraph];                                 //Start the graph
        }
        
        [_connectedNodes addObject:rau];
</code></pre>
<p>but my Application Crashes on this Line --</p>
<pre><code>Check(AUGraphInitialize (hostGraph));
</code></pre>
<p>And the Error i got ,</p>
<blockquote>
<p>ConnectAudioUnit failed with error</p>
<p>-10860 Initialize failed with error</p>
<p>-10860 error -10860 from AUGraphInitialize (hostGraph)</p>
</blockquote>
<hr />
<p>Note :- I have also Attached screenshot of code portion for better understand.</p>
<p><a href="https://i.stack.imgur.com/1Ivxx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1Ivxx.png" alt="enter image description here" /></a></p>
<p><strong>Edit 1 :-</strong></p>
<pre><code>- (void)createGraph {
    // 1
    NewAUGraph(&amp;hostGraph);

    // 2
    AudioComponentDescription iOUnitDescription;
    iOUnitDescription.componentType =
    kAudioUnitType_Output;
    iOUnitDescription.componentSubType =
    kAudioUnitSubType_RemoteIO;
    iOUnitDescription.componentManufacturer =
    kAudioUnitManufacturer_Apple;
    iOUnitDescription.componentFlags = 0;
    iOUnitDescription.componentFlagsMask = 0;
    AUGraphAddNode(hostGraph, &amp;iOUnitDescription, &amp;outNode);

    // 3
    AUGraphOpen(hostGraph);

    // 4
    Check(AUGraphNodeInfo(hostGraph, outNode, 0, &amp;outputUnit));
    // 5
    AudioStreamBasicDescription format;
    format.mChannelsPerFrame = 2;
    format.mSampleRate =
    [[AVAudioSession sharedInstance] sampleRate];
    format.mFormatID = kAudioFormatLinearPCM;
    format.mFormatFlags =
    kAudioFormatFlagsNativeFloatPacked |
    kAudioFormatFlagIsNonInterleaved;
    format.mBytesPerFrame = sizeof(Float32);
    format.mBytesPerPacket = sizeof(Float32);
    format.mBitsPerChannel = 32;
    format.mFramesPerPacket = 1;

    AudioUnitSetProperty(mixerUnit,
                         kAudioUnitProperty_StreamFormat,
                         kAudioUnitScope_Output,
                         1,
                         &amp;format,
                         sizeof(format));

    AudioUnitSetProperty(mixerUnit,
                         kAudioUnitProperty_StreamFormat,
                         kAudioUnitScope_Input,
                         0,
                         &amp;format,
                         sizeof(format));
    CAShow(hostGraph);
}
</code></pre>