Пример #1
0
 /// <summary>
 ///     Internal Constructor, only called by the getter for the InstalledDevices property.
 /// </summary>
 /// <param name="deviceId">Position of this device in the list of all devices.</param>
 /// <param name="caps">Win32 Struct with device metadata</param>
 internal InputDevice(UIntPtr deviceId, MIDIINCAPS caps)
     : base(caps.szPname)
 {
     _deviceId = deviceId;
     _caps     = caps;
     _inputCallbackDelegate = InputCallback;
     _isOpen      = false;
     _clock       = null;
     _nrpnWatcher = new NrpnWatcher(this);
 }
Пример #2
0
        /// <summary>
        /// Opens the input device.
        /// </summary>
        /// <exception cref="InvalidOperationException">The device is already open.</exception>
        /// <exception cref="DeviceException">The device cannot be opened.</exception>
        /// <remarks>Note that Open() establishes a connection to the device, but no messages will
        /// be received until <see cref="StartReceiving()"/> is called.</remarks>
        public void Open()
        {
            lock (_lockObj)
            {
                CheckNotOpen();

                _inputCallbackDelegate = this.InputCallback;
                StartMessageProcessingThread();

                CheckReturnCode(Win32API.midiInOpen(out _handle, _deviceId, _inputCallbackDelegate, (UIntPtr)0));
                _isOpen = true;
            }
        }
Пример #3
0
 /// <summary>
 /// Private Constructor, only called by the getter for the InstalledDevices property.
 /// </summary>
 /// <param name="deviceId">Position of this device in the list of all devices.</param>
 /// <param name="caps">Win32 Struct with device metadata</param>
 private InputDevice(UIntPtr deviceId, Win32API.MIDIINCAPS caps)
     : base(caps.szPname)
 {
     this.deviceId = deviceId;
     this.caps = caps;
     this.inputCallbackDelegate = new Win32API.MidiInProc(this.InputCallback);
     this.isOpen = false;
     this.clock = null;
 }
Пример #4
0
 internal WindowsMidiDriver() : base()
 {
     _callback = new Win32API.MidiInProc(this.InputCallback);
 }