/// <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 OutputDevice(UIntPtr deviceId, Win32API.MIDIOUTCAPS caps) : base(caps.szPname) { this.deviceId = deviceId; this.caps = caps; this.isOpen = false; }
/// <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); }
/// <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; }