close
The Wayback Machine - https://web.archive.org/web/20200428190739/https://gist.github.com/analogcode/27b327d3ca71187ddc47715b19a50977
Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
IAA MIDI in Swift
// in ViewDidLoad in ParentViewController.Swift
// IAA MIDI
var callbackStruct = AudioOutputUnitMIDICallbacks(
userData: nil,
MIDIEventProc: {
(first, status, data1, data2, offset) in
AudioKit.midi.sendMessage([MIDIByte(status), MIDIByte(data1), MIDIByte(data2)])},
MIDISysExProc: {
(firstPointer, secondPinter, anotherInt32) in
print("Not handling sysex")}
)
let connectIAAMDI = AudioUnitSetProperty(AudioKit.engine.outputNode.audioUnit!,
kAudioOutputUnitProperty_MIDICallbacks,
kAudioUnitScope_Global,
0,
&callbackStruct,
UInt32(MemoryLayout<AudioOutputUnitMIDICallbacks>.size))
if connectIAAMDI != 0 {
AKLog("Something bad happened")
}
// Setup AudioBus MIDI Input
setupAudioBusInput()
startObservingInterAppAudioConnections()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.