代码之家  ›  专栏  ›  技术社区  ›  Dima Gimburg

AKCallbackInstrument Midin和回调状态不工作

  •  0
  • Dima Gimburg  · 技术社区  · 7 年前

    第一:

    callbackTrack?.setMIDIOutput(callbackInstrument.midiIn) 这就产生了 Value of type 'AKCallbackInstrument' has no member 'midiIn' AKMIDIInstrument

    第二:

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

    Ambiguous reference to member '==' ,这是我在电视上看到的,但没有任何帮助。

    0 回复  |  直到 7 年前
        1
  •  1
  •   Aurelius Prochazka    7 年前

    这似乎是由于从MIDIStatus作为类型更改为MIDIStatus作为包含类型的对象所致。

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

    所以,试着把你的代码改成s

    if status.type == .noteOn {
        //
    }
    
        2
  •  0
  •   Dima Gimburg    7 年前

    因为我个人很少有问题,所以我会把对我有效的答案贴在这里。

    AKCallbackInstrument 具有 AKMIDICallbackInstrument