Dima Gimburg
Dima Gimburg

Reputation: 1466

AKCallbackInstrument midiIn and status on callback not working

I have upgraded AudioKit to 4.6.1 and now cannot compile my application. 2 issues came up are connected to the AKCallbackInstrument class.

first:

callbackTrack?.setMIDIOutput(callbackInstrument.midiIn) which comes up with Value of type 'AKCallbackInstrument' has no member 'midiIn' which is wiered because AKCallbackInstrument inherits from AKMIDIInstrument

second:

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

this notes: Ambiguous reference to member '==' , this isuue I saw on SO already but nothing helped.

Thanks :)

Upvotes: 1

Views: 122

Answers (2)

Dima Gimburg
Dima Gimburg

Reputation: 1466

Because I got few questions personally I'll post here what worked for me as an accepted answer.

change AKCallbackInstrument with AKMIDICallbackInstrument and the API should work as expected.

* Please make sure you use a version that is newer than 4.6.1 as fixes and changes to MIDI components were made in this version release.

Upvotes: 0

Aurelius Prochazka
Aurelius Prochazka

Reputation: 4573

This looks like it is due to the change from MIDIStatus being a type to MIDIStatus being an object contain a type.

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

So, try just changing your code to s

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

Upvotes: 1

Related Questions