Example #1
0
        /// <summary>
        /// Loads/reloads the MIDI input devices
        /// </summary>
        public static void LoadInputDevices()
        {
            inputDevices = null;
            List <InputDevice> devices           = new List <InputDevice>();
            UInt32             numberOfInDevices = Functions.midiInGetNumDevs();

            if (numberOfInDevices > 0)
            {
                for (Int32 i = 0; i < numberOfInDevices; i++)
                {
                    MIDIINCAPS caps = new MIDIINCAPS();
                    if (Functions.midiInGetDevCaps(i, ref caps, (UInt32)Marshal.SizeOf(caps)) == Constants.MMSYSERR_NOERROR)
                    {
                        devices.Add(new InputDevice(i, caps));
                    }
                }
            }
            inputDevices = devices.AsReadOnly();
        }
Example #2
0
 /// <summary>
 /// Creates a new MIDI input device instance.
 /// </summary>
 /// <param name="id">The device's ID.</param>
 /// <param name="caps">The device's capabilities.</param>
 internal InputDevice(Int32 id, MIDIINCAPS caps)
 {
     ID   = id;
     Name = caps.szPname;
 }
Example #3
0
 internal static extern UInt32 midiInGetDevCaps(Int32 uDeviceID, ref MIDIINCAPS lpMidiInCaps, UInt32 cbMidiInCaps);