Mac AVAudioUnitReverb Ignoring loadFactoryPreset()

I'm working on a cross platform iOS/Mac app using AVFoundation and AVAudioEngine. The problem that I'm running into is that AVAudioUnitReverb seems to be ignoring the loadFactoryPreset() method on the Mac, but works fine in iOS.


I've isolated my problem to the following minimal amount of sample code. Pasting this into an iOS Playground results in a definitely echo-y .plate reverb. In a Mac playground, I get a reverb effect, but not the one I intended. It seems to be stuck with the default .mediumRoom preset.


If you'd like to download the iOS and Mac playgrounds with the included audio file, I've uploaded them here: http://server.briantoth.com/ReverbPlayground.zip


I've tried searching for similar problems with no luck. I've tried it under 10.11, 10.12, and the latest 10.13 beta with the same results. I have to be missing something. Any suggestions would be appreciated. Thanks!



import AVFoundation

let sourceFile: AVAudioFile
let format: AVAudioFormat
let sourceFileURL = Bundle.main.url(forResource: "mixLoop", withExtension: "caf")!
sourceFile = try! AVAudioFile(forReading: sourceFileURL)
format = sourceFile.processingFormat

let engine = AVAudioEngine()
let player = AVAudioPlayerNode()
let reverb = AVAudioUnitReverb()

engine.attach(player)
engine.attach(reverb)

// set desired reverb parameters
reverb.loadFactoryPreset(.plate)
reverb.wetDryMix = 100

// make connections
engine.connect(player, to: reverb, format: format)
engine.connect(reverb, to: engine.mainMixerNode, format: format)

// schedule source file
player.scheduleFile(sourceFile, at: nil)

try! engine.start()
player.play()

sleep(20)