/// <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); }