Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the sender component with the Midi Out Port.
        /// </summary>
        /// <param name="port">The Midi Out Port.</param>
        public void Initialize(IMidiPort port)
        {
            Check.IfArgumentNull(port, "port");
            Check.IfArgumentNotOfType <MidiOutPort>(port, "port");

            port.StatusChanged += new EventHandler(MidiPort_StatusChanged);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes any references the receiver component has to/from the Midi Port.
        /// </summary>
        /// <param name="port">A Midi In Port. Must not be null.</param>
        public void Uninitialize(IMidiPort port)
        {
            Check.IfArgumentNull(port, "port");
            Check.IfArgumentNotOfType <MidiInPort>(port, "port");

            port.StatusChanged -= new EventHandler(MidiPort_StatusChanged);
            PortStatus          = MidiPortStatus.None;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Event handler for the port status changed event.
        /// </summary>
        /// <param name="sender">The originating midi port.</param>
        /// <param name="e">Not used.</param>
        private void MidiPort_StatusChanged(object sender, EventArgs e)
        {
            IMidiPort port = (IMidiPort)sender;

            if (port.HasStatus(MidiPortStatus.Closed | MidiPortStatus.Reset))
            {
                RunningStatus = 0;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Contract.
        /// </summary>
        /// <param name="port">Must not be null.</param>
        void IInitializeByMidiPort.Uninitialize(IMidiPort port)
        {
            Contract.Requires(port != null);

            throw new System.NotImplementedException();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Event handler when the port status changes.
        /// </summary>
        /// <param name="sender">The midi port.</param>
        /// <param name="e">Not used.</param>
        private void MidiPort_StatusChanged(object sender, EventArgs e)
        {
            IMidiPort port = (IMidiPort)sender;

            OnNewPortStatus(port.Status);
        }