I'm trying to create a simple swift app that receives MIDI inputs, but I can't get the receivedMIDINoteOn() working. i.e. no received a note on was printed in the console.
I tried to debug and found that the inputports has one entry: "key = Int32 1263786875, value = UInt32 0".
What did I missed?
import Foundation
import AudioKit
import CoreMIDI
import Cocoa
class MIDIHardwareListener: MIDIListener {
let midi = AudioKit.MIDI()
init() {
midi.openInput()
midi.addListener(self)
availableInputs = MIDIHardwareListener.listInputs()
print("available inputs: \(availableInputs)") // this prints out: ["Roland Digital Piano"]
}
func receivedMIDINoteOn(noteNumber: MIDINoteNumber, velocity: MIDIVelocity, channel: MIDIChannel, portID: MIDIUniqueID?, offset: MIDITimeStamp) {
print("received a note on")
}
// ...other protocol required functions
}