UNOFFICIAL - A Swift framework for receiving and parsing UDP String MIDI messages from ETC's Response MIDI Gateway hardware.
For convenience, I've included a few public domain source files, Thanks and curiosity should rightfully be directed towards them:
CocoaAsyncSocket.
Swift-Netutils.
Inluded is a small demo app "Response Time" and can be downloaded here
Import responseMIDIKit into your project
import responseMIDIKit
Create Server
let server = MIDIServer()
server.interface = "en0"
server.port = 24601
server.terminator = .carriageReturnLineFeed
server.delegate = self
Conform to the MIDI Packet Destination Protocol
func take(timecodeMessage: MIDITimecodeMessage) {
print("\(timecodeMessage.timecode()) \(timecodeMessage.framerate())")
}
func take(showControlMessage: MIDIShowControlMessage) {
print(showControlMessage.message())
}
func take(voiceMessage: MIDIVoiceMessage) {
print(voiceMessage.message())
}
Start Listening
do {
try server.startListening()
} catch let error as NSError {
print(error.localizedDescription)
}