public void SelectEffectWithComponentDescription(AudioComponentDescription?componentDescription, Action completionHandler) { if (isPlaying) { player.Pause(); } if (effect != null) { engine.DisconnectNodeInput(effect); engine.DisconnectNodeInput(engine.MainMixerNode); engine.Connect(player, engine.MainMixerNode, file.ProcessingFormat); engine.DetachNode(effect); effect = null; AudioUnit = null; PresetList = new AUAudioUnitPreset[0]; } if (componentDescription.HasValue) { AVAudioUnit.FromComponentDescription(componentDescription.Value, AudioComponentInstantiationOptions.OutOfProcess, (avAudioUnitEffect, AVError) => { if (AVError != null || avAudioUnitEffect == null) { Console.WriteLine("SelectEffectWithComponentDescription error!"); return; } effect = avAudioUnitEffect; engine.AttachNode(avAudioUnitEffect); engine.DisconnectNodeInput(engine.MainMixerNode); engine.Connect(player, avAudioUnitEffect, file.ProcessingFormat); engine.Connect(avAudioUnitEffect, engine.MainMixerNode, file.ProcessingFormat); AudioUnit = avAudioUnitEffect.AUAudioUnit; PresetList = avAudioUnitEffect.AUAudioUnit.FactoryPresets ?? new AUAudioUnitPreset[0]; Done(completionHandler); }); } else { Done(completionHandler); } }