     
     var inputPort = MIDIPortRef()
     
-    var destEndpointRef = MIDIEndpointRef()
+    var virtualSourceEndpointRef = MIDIEndpointRef()
+
+    var virtualDestinationEndpointRef = MIDIEndpointRef()
     
     var midiInputPortref = MIDIPortRef()
     

            print("parentType \(m.parentType)")
            showMIDIObjectType(m.parentType)
            
            break
            
        // A device, entity or endpoint was removed. Structure is MIDIObjectAddRemoveNotification.

            
            // this is the sequence's destination. Remember to set background mode in info.plist
            status = MIDIDestinationCreateWithBlock(midiClient,
                                                    "Swift3MIDI.VirtualDestination",
                                                    &virtualDestinationEndpointRef,
                                                    MIDIPassThru)
//                                                    readBlock)
            
            if status != noErr {
                print("error creating virtual destination: \(status)")
                checkError(status)
            } else {
                print("midi virtual destination created \(virtualDestinationEndpointRef)")
            }
            
            //use MIDIReceived to transmit MIDI messages from your virtual source to any clients connected to the virtual source
            status = MIDISourceCreate(midiClient,
                                      "Swift3MIDI.VirtualSource",
                                      &virtualSourceEndpointRef
            )
            if status != noErr {
                print("error creating virtual source: \(status)")
            } else {
                print("midi virtual source created \(virtualSourceEndpointRef)")
            }

            
            connectSourcesToInputPort()
            
            initGraph()
        }
        
    }
