Represents an asynchronous queue of delegates.
Inheritance: System.Threading.SynchronizationContext, IComponent, ISynchronizeInvoke
        /// <summary>
        /// Initializes a new instance of the InputDevice class with the 
        /// specified device ID.
        /// </summary>
        public InputDevice(int deviceID) : base(deviceID)
        {
            midiInProc = HandleMessage;

            delegateQueue = new DelegateQueue();
            int result = midiInOpen(out handle, deviceID, midiInProc, 0, CALLBACK_FUNCTION);
            
            System.Diagnostics.Debug.WriteLine("MidiIn handle:" + handle.ToInt64());

            if(result != MidiDeviceException.MMSYSERR_NOERROR)
            {
                throw new InputDeviceException(result);
            }
        }
        /// <summary>
        /// Initializes a new instance of the InputDevice class with the 
        /// specified device ID.
        /// </summary>
        public InputDevice(int deviceID) : base(deviceID)
        {
            midiInProc = HandleMessage;

            int result = NativeMethods.midiInOpen(out handle, deviceID, midiInProc, IntPtr.Zero, CALLBACK_FUNCTION);

            if(result == MidiDeviceException.MMSYSERR_NOERROR)
            {
                delegateQueue = new DelegateQueue();
            }
            else
            {
                throw new InputDeviceException(result);
            }
        }
        /// <summary>
        /// Initializes a new instance of the InputDevice class with the 
        /// specified device ID.
        /// </summary>
        public InputDevice(int deviceID, SynchronizationContext context)
            : base(deviceID)
        {
            this.context = context;
            midiInProc = HandleMessage;

            int result = midiInOpen(out handle, deviceID, midiInProc, 0, CALLBACK_FUNCTION);

            if (result == MidiDeviceException.MMSYSERR_NOERROR)
            {
                delegateQueue = new DelegateQueue();
            }
            else
            {
                throw new InputDeviceException(result);
            }
        }