I'm using latest macOS, Xcode, Swift and AudioKit versions...
I set up MIDIListener to print any messages received. The only message received is "receivedMIDISetupChange". Attempting to print any "noteOn" messages received. It works in a macOS project but not in an ios project. Please help!
import AudioKit
import UIKit
import CoreAudioKit
class ViewController: UIViewController, MIDIListener {
let midi = MIDI()
override func viewDidLoad() {
super.viewDidLoad()
midi.openInput()
midi.addListener(self)
}
func receivedMIDINoteOn(noteNumber: MIDINoteNumber, velocity: MIDIVelocity, channel: MIDIChannel, portID: MIDIUniqueID?, timeStamp: MIDITimeStamp?) {
print(noteNumber)
}
func receivedMIDINoteOff(noteNumber: MIDINoteNumber, velocity: MIDIVelocity, channel: MIDIChannel, portID: MIDIUniqueID?, timeStamp: MIDITimeStamp?) {
}
func receivedMIDIController(_ controller: MIDIByte, value: MIDIByte, channel: MIDIChannel, portID: MIDIUniqueID?, timeStamp: MIDITimeStamp?) {
print("receivedMIDIController")
}
func receivedMIDIAftertouch(noteNumber: MIDINoteNumber, pressure: MIDIByte, channel: MIDIChannel, portID: MIDIUniqueID?, timeStamp: MIDITimeStamp?) {
}
func receivedMIDIAftertouch(_ pressure: MIDIByte, channel: MIDIChannel, portID: MIDIUniqueID?, timeStamp: MIDITimeStamp?) {
}
func receivedMIDIPitchWheel(_ pitchWheelValue: MIDIWord, channel: MIDIChannel, portID: MIDIUniqueID?, timeStamp: MIDITimeStamp?) {
}
func receivedMIDIProgramChange(_ program: MIDIByte, channel: MIDIChannel, portID: MIDIUniqueID?, timeStamp: MIDITimeStamp?) {
print("receivedMIDIProgramChange")
}
func receivedMIDISystemCommand(_ data: [MIDIByte], portID: MIDIUniqueID?, timeStamp: MIDITimeStamp?) {
print("receivedMIDISystemCommand")
}
func receivedMIDISetupChange() {
print("receivedMIDISetupChange")
}
func receivedMIDIPropertyChange(propertyChangeInfo: MIDIObjectPropertyChangeNotification) {
print("receivedMIDIPropertyChange")
}
func receivedMIDINotification(notification: MIDINotification) {
print("receivedMIDINotification")
}
}