AKCallbackInstrument midiIn 和回调状态不起作用

AKCallbackInstrument midiIn and status on callback not working

我已经将 AudioKit 升级到 4.6.1,现在无法编译我的应用程序。出现的 2 个问题与 AKCallbackInstrument class.

有关

第一个:

callbackTrack?.setMIDIOutput(callbackInstrument.midiIn)Value of type 'AKCallbackInstrument' has no member 'midiIn' 相结合,因为 AKCallbackInstrument 继承自 AKMIDIInstrument

秒:

callbackInstrument.callback = { status, noteNumber, velocity in
    if(status == .noteOn){
        // ...
    }
}

这个注释:Ambiguous reference to member '==',这个问题我已经在 SO 上看到了,但没有任何帮助。

谢谢:)

这看起来是由于从 MIDIStatus 是一种类型更改为 MIDIStatus 是包含类型的对象。

public struct AKMIDIStatus {
    ...
    public var type: AKMIDIStatusType? {
        return AKMIDIStatusType(rawValue: Int(byte.highBit))
    }

所以,尝试将代码更改为 s

if status.type == .noteOn {
    //
}

因为我个人的问题很少,所以我会 post 在这里将对我有用的答案作为可接受的答案。

AKCallbackInstrument 更改为 AKMIDICallbackInstrument,API 应该会按预期工作。

* 请确保您使用的版本比 4.6.1 更新,因为在此版本中对 MIDI 组件进行了修复和更改。