             UInt32(sizeof(AUSamplerInstrumentData.self)))
         checkError(status)
     }
+    
+    
+    // The following are not used here. But useful.
+    
+    
+    //The system assigns unique IDs to all objects
+    func getUniqueID(_ endpoint:MIDIEndpointRef) -> (OSStatus, MIDIUniqueID) {
+        var id = MIDIUniqueID(0)
+        let s = MIDIObjectGetIntegerProperty(endpoint, kMIDIPropertyUniqueID, &id)
+        if s != noErr {
+            print("error getting unique id \(s)")
+        }
+        return (s,id)
+    }
+    
+    func setUniqueID(_ endpoint:MIDIEndpointRef, id:MIDIUniqueID) -> OSStatus {
+        let s = MIDIObjectSetIntegerProperty(endpoint, kMIDIPropertyUniqueID, id)
+        if s != noErr {
+            print("error getting unique id \(s)")
+        }
+        return s
+    }
+    
+    
+    func getDeviceName(_ endpoint:MIDIEndpointRef) -> String? {
+        var cfs: Unmanaged<CFString>?
+        let status = MIDIObjectGetStringProperty(endpoint, kMIDIPropertyName, &cfs)
+        if status != noErr {
+            print("error getting unique id \(status)")
+            checkError(status)
+        }
+        
+        if let s = cfs {
+            return s.takeRetainedValue() as String
+        }
+        
+        return nil
+    }
+    
+    func allExternalDeviceProps() {
+        
+        let n = MIDIGetNumberOfExternalDevices()
+        for i in 0 ..< n {
+            let midiDevice = MIDIGetExternalDevice(i)
+            var unmanagedProperties: Unmanaged<CFPropertyList>?
+            let status = MIDIObjectGetProperties(midiDevice, &unmanagedProperties, true)
+            checkError(status)
+            
+            if let midiProperties: CFPropertyList = unmanagedProperties?.takeUnretainedValue() {
+                if let midiDictionary = midiProperties as? NSDictionary {
+                    print("Midi properties: \(index) \n \(midiDictionary)")
+                }
+            } else {
+                print("Couldn't load properties for \(index)")
+            }
+        }
+        
+    }
+    func allDeviceProps() {
+        
+        
+        let n = MIDIGetNumberOfDevices()
+        for i in 0 ..< n {
+            let midiDevice = MIDIGetDevice(i)
+            var unmanagedProperties: Unmanaged<CFPropertyList>?
+            let status = MIDIObjectGetProperties(midiDevice, &unmanagedProperties, true)
+            checkError(status)
+            
+            if let midiProperties: CFPropertyList = unmanagedProperties?.takeUnretainedValue() {
+                if let midiDictionary = midiProperties as? NSDictionary {
+                    print("Midi properties: \(index) \n \(midiDictionary)")
+                }
+            } else {
+                print("Couldn't load properties for \(index)")
+            }
+        }
+        
+    }
+    
+    func deviceProps() {
+        let midiDevice = MIDIGetDevice(0)
+        var unmanagedProperties: Unmanaged<CFPropertyList>?
+        let status = MIDIObjectGetProperties(midiDevice, &unmanagedProperties, true)
+        checkError(status)
+        
+        if let midiProperties: CFPropertyList = unmanagedProperties?.takeUnretainedValue() {
+            if let midiDictionary = midiProperties as? NSDictionary {
+                print("Midi properties: \(index) \n \(midiDictionary)")
+            }
+        } else {
+            print("Couldn't load properties for \(index)")
+        }
+        
+    }
+    
+    
+    // MIDIManager.sharedInstance.deviceProp("name")
+    func deviceProp(_ propName:String) -> String? {
+        
+        let midiDevice = MIDIGetDevice(0)
+        var unmanagedProperties: Unmanaged<CFPropertyList>?
+        let status = MIDIObjectGetProperties(midiDevice, &unmanagedProperties, true)
+        checkError(status)
+        
+        if let midiProperties: CFPropertyList = unmanagedProperties?.takeUnretainedValue() {
+            if let midiDictionary = midiProperties as? NSDictionary {
+                print("Midi properties: \(index) \n \(midiDictionary)")
+                return midiDictionary[propName] as? String
+            }
+        } else {
+            print("Couldn't load properties for \(index)")
+        }
+        return nil
+    }
+    
+    
+    func destProps() {
+        
+        let numberOfDestinations  = MIDIGetNumberOfDestinations()
+        if (numberOfDestinations > 0)   {
+            let endpoint = MIDIGetDestination(0)
+            var entity = MIDIEntityRef(0)
+            MIDIEndpointGetEntity(endpoint, &entity)
+            var unmanagedProperties: Unmanaged<CFPropertyList>?
+            let status = MIDIObjectGetProperties(entity, &unmanagedProperties, true)
+            checkError(status)
+            
+            if let midiProperties: CFPropertyList = unmanagedProperties?.takeUnretainedValue() {
+                if let midiDictionary = midiProperties as? NSDictionary {
+                    print("Midi properties: \(index) \n \(midiDictionary)")
+                }
+            } else {
+                print("Couldn't load properties for \(index)")
+            }
+        }
+        
+    }
+    func allDestinationProps() {
+        
+        let numberOfDestinations  = MIDIGetNumberOfDestinations()
+        for i in 0 ..< numberOfDestinations {
+            let endpoint = MIDIGetDestination(i)
+            var entity = MIDIEntityRef(0)
+            MIDIEndpointGetEntity(endpoint, &entity)
+            var unmanagedProperties: Unmanaged<CFPropertyList>?
+            let status = MIDIObjectGetProperties(entity, &unmanagedProperties, true)
+            checkError(status)
+            
+            if let midiProperties: CFPropertyList = unmanagedProperties?.takeUnretainedValue() {
+                if let midiDictionary = midiProperties as? NSDictionary {
+                    print("Midi properties: \(index) \n \(midiDictionary)\n")
+                }
+            } else {
+                print("Couldn't load properties for \(index)")
+            }
+        }
+    }
+    
+    
+    func propertyValue(_ endpoint:MIDIEndpointRef, propName:String) -> String? {
+        var entity = MIDIEntityRef(0)
+        MIDIEndpointGetEntity(endpoint, &entity)
+        var unmanagedProperties: Unmanaged<CFPropertyList>?
+        let status = MIDIObjectGetProperties(entity, &unmanagedProperties, true)
+        checkError(status)
+        
+        if let midiProperties: CFPropertyList = unmanagedProperties?.takeUnretainedValue() {
+            if let midiDictionary = midiProperties as? NSDictionary {
+                print("Midi properties: \(index) \n \(midiDictionary)")
+                return midiDictionary[propName] as? String
+            }
+        } else {
+            print("Couldn't load properties for \(index)")
+        }
+        
+        return nil
+    }
+
     
     
     

            print("destinationEndpoint \(session.destinationEndpoint())")
            print("networkName \(session.networkName)")
            print("localName \(session.localName)")
            
        }
    }
    

    
    var inputPort = MIDIPortRef()
    
    var virtualSourceEndpointRef = MIDIEndpointRef()

    var virtualDestinationEndpointRef = MIDIEndpointRef()
    
    var midiInputPortref = MIDIPortRef()
    
