Search code examples
ioscore-audioavaudiosessionavaudioengine

AVAudioEngine correct way to disconnect nodes


I am confused by disconnect API of AVAudioEngine. I have the following code:

 engine.connect(engine.inputNode, to: engine.mainMixerNode, format: nil)

I now need to disconnect these two nodes. What is the corresponding statement to disconnect them?


Solution

  • Either

    engine.disconnectNodeInput(engine.mainMixerNode)

    or

    engine.disconnectNodeOutput(engine.inputNode)

    should break the connection been inputNode and mainMixerNode.