Looks like bypass property for AVAudioUnitReverb works incorrectly.
If AVAudioUnitReverb.bypass is set to true - it's switch off whole graph and no sound produced from the engine's output node.
It is incorrect behaviour, since it should switch off only AVAudioUnitReverb node and ignoring it during playback.
bypass property of other AVAudioUnitEffect (e.g. AVAudioUnitDelay, AVAudioUnitDistortion) works correctly and switch off only effect node.
Example graph:
AVAudioPlayerNode -> AVAudioUnitReverb -> engine.mainMixerNode
so in this example if AVAudioUnitReverb.bypass is set to true - it will switch off all sound and nothing will be produced from engine's output. But according to documentation is should switch only AVAudioUnitReverb effect, so engine's output would be whatever is scheduled to play on AVAudioPlayerNode.
Example code:
let engine = AVAudioEngine()
let player = AVAudioPlayerNode()
let reverb = AVAudioUnitReverb()
var file: AVAudioFile // load some sound file
let format = file.processingFormat
engine.attach(player)
engine.attach(reverb)
engine.connect(player, to: reverb, format: format)
engine.connect(reverb, to: engine.mainMixerNode, format: format)
engine.prepare()
engine.start()
reverb.bypass = false // if set to true - no sound will be produced at all
reverb.wetDryMix = 100
reverb.loadFactoryPreset(AVAudioUnitReverbPreset.largeHall2)
player.scheduleFile(file, at: nil)
player.play()
I am not understand why it's behave like this and I don't know how to debug it or fix it. Also I can't find any related information regarding this issue.
Any help would be appreciated.
Thanks!