Hi I'm newbie to AudioKit
I tried to follow the playground to write a simple midi listener https://github.com/AudioKit/AudioKit/blob/v5-master/Playgrounds/Playback.playground/Pages/MIDI%20Input.xcplaygroundpage/Contents.swift
However, when I created the "class MIDIReceiver: MIDIListener," I was not able to leave its inside empty, xcode asked me to override the funcs. "Type 'MIDIReceiver' does not conform to protocol 'MIDIListener'"
The screenshot is here https://i.stack.imgur.com/kUtBs.jpg
Do I really need to override them? Or how do I fill in those parameters of the funcs?
Thank you
--- Added Oct 21 ---
I think I got it...
Right now the methods are:
class MIDIReceiver: MIDIListener {
func receivedMIDINoteOn(noteNumber: MIDINoteNumber, velocity: MIDIVelocity, channel: MIDIChannel, portID: MIDIUniqueID?, offset: MIDITimeStamp) {
<#code#>
}
func receivedMIDINoteOff(noteNumber: MIDINoteNumber, velocity: MIDIVelocity, channel: MIDIChannel, portID: MIDIUniqueID?, offset: MIDITimeStamp) {
<#code#>
}
func receivedMIDIController(_ controller: MIDIByte, value: MIDIByte, channel: MIDIChannel, portID: MIDIUniqueID?, offset: MIDITimeStamp) {
<#code#>
}
func receivedMIDIAftertouch(noteNumber: MIDINoteNumber, pressure: MIDIByte, channel: MIDIChannel, portID: MIDIUniqueID?, offset: MIDITimeStamp) {
<#code#>
}
func receivedMIDIAftertouch(_ pressure: MIDIByte, channel: MIDIChannel, portID: MIDIUniqueID?, offset: MIDITimeStamp) {
<#code#>
}
func receivedMIDIPitchWheel(_ pitchWheelValue: MIDIWord, channel: MIDIChannel, portID: MIDIUniqueID?, offset: MIDITimeStamp) {
<#code#>
}
func receivedMIDIProgramChange(_ program: MIDIByte, channel: MIDIChannel, portID: MIDIUniqueID?, offset: MIDITimeStamp) {
<#code#>
}
func receivedMIDISystemCommand(_ data: [MIDIByte], portID: MIDIUniqueID?, offset: MIDITimeStamp) {
<#code#>
}
func receivedMIDISetupChange() {
<#code#>
}
func receivedMIDIPropertyChange(propertyChangeInfo: MIDIObjectPropertyChangeNotification) {
<#code#>
}
func receivedMIDINotification(notification: MIDINotification) {
<#code#>
}
}
Xcode says "Cannot find type "MIDITimeStamp", "MIDIUniqID" and "MIDINotification" in scope"
After I import CoreMIDI , there are no errors
Thank you
Just click the red circle thing and press "Fix" and it will add all the protocol methods for you. Then you can put code into the ones you need. All the protocol methods are required because when made things optional (or created an extension to the protocol that did default actions), the result was if we updated the protocol and developers neglected to update, they would lose their midi functionality. Now, if we change stuff, you have to keep up to date.