Beispiel #1
0
 /// <summary>
 /// Private Constructor, only called by the getter for the InstalledDevices property.
 /// </summary>
 /// <param name="deviceId">Position of this device in the list of all devices.</param>
 /// <param name="caps">Win32 Struct with device metadata</param>
 private InputDevice(UIntPtr deviceId, Win32API.MIDIINCAPS caps)
     : base(caps.szPname)
 {
     this.deviceId = deviceId;
     this.caps     = caps;
     this.inputCallbackDelegate = new Win32API.MidiInProc(this.InputCallback);
     this.isOpen = false;
     this.clock  = null;
 }
Beispiel #2
0
        /// <summary>
        /// Private method for constructing the array of MidiInputDevices by calling the Win32 api.
        /// </summary>
        /// <returns></returns>
        private static InputDevice[] MakeDeviceList()
        {
            uint inDevs = Win32API.midiInGetNumDevs();

            InputDevice[] result = new InputDevice[inDevs];
            for (uint deviceId = 0; deviceId < inDevs; deviceId++)
            {
                Win32API.MIDIINCAPS caps = new Win32API.MIDIINCAPS();
                Win32API.midiInGetDevCaps((UIntPtr)deviceId, out caps);
                result[deviceId] = new InputDevice((UIntPtr)deviceId, caps);
            }
            return(result);
        }