/// <summary> /// Loads/reloads the MIDI output devices /// </summary> public static void LoadOutputDevices() { outputDevices = null; List <OutputDevice> devices = new List <OutputDevice>(); UInt32 numberOfDevices = Functions.midiOutGetNumDevs(); if (numberOfDevices > 0) { for (Int32 i = 0; i < numberOfDevices; i++) { MIDIOUTCAPS caps = new MIDIOUTCAPS(); if (Functions.midiOutGetDevCaps(i, ref caps, (UInt32)Marshal.SizeOf(caps)) == Constants.MMSYSERR_NOERROR) { devices.Add(new OutputDevice(i, caps)); } } } outputDevices = devices.AsReadOnly(); }
/// <summary> /// Creates a new MIDI output device instance. /// </summary> /// <param name="id">The device's ID.</param> /// <param name="caps">The device's capabilities.</param> internal OutputDevice(Int32 id, MIDIOUTCAPS caps) { ID = id; Name = caps.szPname; }
internal static extern UInt32 midiOutGetDevCaps(Int32 uDeviceID, ref MIDIOUTCAPS lpMidiOutCaps, UInt32 cbMidiOutCaps);