AudioKit 5设置iOS上的音频格式

AudioKit 5设置iOS上的音频格式,ios,swift,audiokit,Ios,Swift,Audiokit,我试图通过设置修改默认的AudioKit采样率,但遇到了延迟节点参数属性包装器不再更新基础AVAudioUnit的AUParameters的问题。我在烹饪书项目《延迟》中复制了这个问题,只做了以下修改: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)

我试图通过设置修改默认的AudioKit采样率,但遇到了延迟节点参数属性包装器不再更新基础AVAudioUnit的AUParameters的问题。我在烹饪书项目《延迟》中复制了这个问题,只做了以下修改:

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    #if os(iOS)
    do {
        Settings.audioFormat = AVAudioFormat(standardFormatWithSampleRate: 48_000, channels: 2)!
        Settings.bufferLength = .short
        try AVAudioSession.sharedInstance().setPreferredIOBufferDuration(Settings.bufferLength.duration)
        try AVAudioSession.sharedInstance().setCategory(.playAndRecord,
                                                        options: [.defaultToSpeaker, .mixWithOthers])
        try AVAudioSession.sharedInstance().setActive(true)
    } catch let err {
        print(err)
    }
    #endif

    return true
}
对Cookbook项目的唯一修改是在AppDelegate中添加此行:

Settings.audioFormat = AVAudioFormat(standardFormatWithSampleRate: 48_000, channels: 2)!
经过一些调试后,我发现
Delay.time
Delay.feedback
不会更新,但
Delay.dryWetMix
会更新。我已经调试了属性包装器和NodeParameters,它们的引用似乎不再与
NodeParameter.avAudioUnit.auauauAudioUnit.parameterTree!中返回的AUParameter引用匹配!。所有参数

以下是Delay.time节点参数值设置程序中的一些日志:

我修改默认采样率的方法是否合适,还是遗漏了什么?