     public override init() {
         super.init()
         print("howdy world, from AKMidi")
-        MIDINetworkSession.defaultSession().enabled = true
-        MIDINetworkSession.defaultSession().connectionPolicy = MIDINetworkConnectionPolicy.Anyone
+        #if os(iOS)
+            MIDINetworkSession.defaultSession().enabled = true
+            MIDINetworkSession.defaultSession().connectionPolicy = MIDINetworkConnectionPolicy.Anyone
+        #endif
     }
-    public func openMidiIn(){
+    public func openMidiIn(namedInput: String = ""){
         print("Opening Midi In")
         var result = OSStatus(noErr)
         result = MIDIClientCreateWithBlock(midiClientName, &midiClient, MyMIDINotifyBlock)

        }
        let sourceCount = MIDIGetNumberOfSources()
        print("SourceCount: \(sourceCount)")
        
        result = MIDIInputPortCreateWithBlock(midiClient, midiInName, &midiInPort, MyMIDIReadBlock)
        if result == OSStatus(noErr) {
            print("created midiInPort")
        } else {
            print("error creating midiInPort : \(result)")
        }
        for(var i = 0; i < sourceCount; ++i){
            let src = MIDIGetSource(i)
            var endpointName : Unmanaged<CFString>?
            endpointName = nil
            MIDIObjectGetStringProperty(src, kMIDIPropertyName, &endpointName)
            print("EndpointName \(endpointName!.takeRetainedValue())")
            MIDIPortConnectSource(midiInPort, src, nil)
        }
    }//end openMidiIn
    

public class AKMidi: AKOperation {
    public var midiClient = MIDIClientRef()
    public var midiInPort = MIDIPortRef()
    public var midiInPorts:[MIDIClientRef] = []
    var midiClientName:CFString = "Midi In Client"
    var midiInName:CFString = "Midi In Port"
    
