Ejemplo n.º 1
0
        /// <summary>
        /// Private method for constructing the array of MidiOutputDevices by calling the Win32 api.
        /// </summary>
        /// <returns></returns>
        private static OutputDevice[] MakeDeviceList()
        {
            uint outDevs = Win32API.midiOutGetNumDevs();

            OutputDevice[] result = new OutputDevice[outDevs];
            for (uint deviceId = 0; deviceId < outDevs; deviceId++)
            {
                Win32API.MIDIOUTCAPS caps = new Win32API.MIDIOUTCAPS();
                Win32API.midiOutGetDevCaps((UIntPtr)deviceId, out caps);
                result[deviceId] = new OutputDevice((UIntPtr)deviceId, caps);
            }
            return(result);
        }
Ejemplo n.º 2
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>
 internal OutputDevice(UIntPtr deviceId, Win32API.MIDIOUTCAPS caps)
     : base(caps.szPname)
 {
     _deviceId = deviceId;
     _isOpen   = false;
 }