Why does loadFactoryPreset(preset: AVAudioUnitDistortionPreset)
affect the preGain
and wetDryMix
properties of AVAudioUnitDistortion
? This implementation seems inconsistent with loadFactoryPreset(preset: AVAudioUnitReverbPreset)
, which does not alter any properties when changing the preset.
Here's a playground I made to illustrate this point and graphs showing how the properties are altered for each preset.
import UIKit
import AVFoundation
let distortion = AVAudioUnitDistortion()
let reverb = AVAudioUnitReverb()
var i = 0
// Distortion
distortion.preGain = 6.0
distortion.wetDryMix = 6.0
while let preset = AVAudioUnitDistortionPreset(rawValue: i) {
distortion.loadFactoryPreset(AVAudioUnitDistortionPreset(rawValue: i)!)
distortion.wetDryMix
distortion.preGain
i++
}
// Reverb
reverb.wetDryMix = 100.0
i = 0
while let preset = AVAudioUnitReverbPreset(rawValue: i) {
reverb.loadFactoryPreset(AVAudioUnitReverbPreset(rawValue: i)!)
reverb.wetDryMix
i++
}
All of the distortion presets sound terrible with a 100% wetDryMix
, so I can't help wondering if this is a bug or if there's a good reason for this behavior.