Example #1
0
 /// <summary>
 /// Creates a new <see cref="MidiDevice"/> initialized from the specified <see cref="API.MidiInputDeviceCapabilities"/>.
 /// </summary>
 /// <param name="deviceID">An <see cref="int"/> representing the ID of the device.</param>
 /// <param name="capabilities">An <see cref="API.MidiInputDeviceCapabilities"/> containing the MIDI device's capabilities.</param>
 internal protected MidiDevice(int deviceID, API.MidiInputDeviceCapabilities capabilities)
 {
     this.ID     = deviceID;
     this.Name   = capabilities.DeviceName;
     this.Type   = API.MidiDeviceType.MIDI_DEVICETYPE_MIDI_PORT;
     this.Handle = IntPtr.Zero;
 }
Example #2
0
        /// <summary>
        /// Initializes the internal list of installed MIDI input devices.
        /// </summary>
        /// <exception cref="MidiInputDeviceException">Raises error #2: MULTIMEDIA_SYSTEM_ERROR_BAD_DEVICE_ID, the specified device ID is out of range.</exception>
        /// <exception cref="MidiInputDeviceException">Raises error #6: MULTIMEDIA_SYSTEM_ERROR_NO_DRIVER, the driver is not installed.</exception>
        /// <exception cref="MidiInputDeviceException">Raises error #7: MULTIMEDIA_SYSTEM_ERROR_NO_MEM, the system is unable to allocate or lock memory.</exception>
        /// <exception cref="MidiInputDeviceException">Raises error #11: MULTIMEDIA_SYSTEM_ERROR_INVALID_PARAMETER, the specified pointer or structure is invalid.</exception>
        private static void InitializeMidiInputDeviceList()
        {
            _MidiInputDevices = new MidiInputDevice[API.MidiInputDeviceCount()];

            for (int deviceID = 0; deviceID < _MidiInputDevices.Length; deviceID++)
            {
                API.MidiInputDeviceCapabilities capabilities = new API.MidiInputDeviceCapabilities();

                MidiInputDevice.InvalidateResult(API.GetMidiInputDeviceCapabilities(deviceID, ref capabilities));

                _MidiInputDevices[deviceID] = new MidiInputDevice(deviceID, capabilities);
            }
        }
Example #3
0
 /// <summary>
 /// Private contstructor to create and initialize a new <see cref="MidiInputDevice"/>, only invoked by the <see cref="InitializeDeviceList"/> method.
 /// </summary>
 /// <param name="deviceID">An <see cref="int"/> representing the unique indexed <see cref="MidiInputDevice"/>'s ID.</param>
 /// <param name="capabilities">An <see cref="API.MidiInputDeviceCapabilities"/> structure to store the <see cref="MidiInputDevice"/>'s capabilities.</param>
 internal MidiInputDevice(int deviceID, API.MidiInputDeviceCapabilities capabilities) : base(deviceID, capabilities)
 {
     _Capabilities = capabilities;
     _Callback     = Callback;
 }