コード例 #1
0
ファイル: DeviceManager.cs プロジェクト: X-Lars/MidiXL
        /// <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);
            }
        }
コード例 #2
0
ファイル: MidiOutputDevice.cs プロジェクト: X-Lars/MidiXL
        /// <summary>
        /// Disconnects the MIDI output device from a MIDI input or thru device.
        /// </summary>
        /// <param name="device">A <see cref="MidiInputDevice"/> or MIDI thru device to disconnect from.</param>
        /// <exception cref="MidiOutputDeviceException">Raises <see cref="API.Result.MULTIMEDIA_SYSTEM_ERROR_INVALID_HANDLE"/>.</exception>
        public void Disconnect(MidiInputDevice device)
        {
            InvalidateResult(API.DisconnectMidiDevices(device._Handle, _Handle));

            _Connections.Remove(device._Handle);
        }
コード例 #3
0
ファイル: MidiOutputDevice.cs プロジェクト: X-Lars/MidiXL
        /// <summary>
        /// Connects the MIDI output device to a MIDI input or thru device.
        /// Received <see cref="API.MidiInputMessage"/>s are sent through to the connected MIDI output or thru device.
        /// </summary>
        /// <param name="device">A <see cref="MidiInputDevice"/> or MIDI thru device to connect to.</param>
        /// <exception cref="MidiOutputDeviceException">Raises <see cref="API.Result.MULTIMEDIA_SYSTEM_ERROR_INVALID_HANDLE"/>.</exception>
        /// <exception cref="MidiOutputDeviceException">Raises <see cref="API.Result.MIDI_ERROR_NOT_READY"/>.</exception>
        /// <remarks><i>For MIDI thru devices, a handle must be obtained by a calling the <see cref="API.OpenMidiOutputDevice"/> method.</i></remarks>
        public void Connect(MidiInputDevice device)
        {
            InvalidateResult(API.ConnectMidiDevices(device._Handle, _Handle));

            _Connections.Add(device._Handle);
        }