Пример #1
0
 public void StopMidi()
 {
     if (_inDevice != null && _inDevice.IsStarted)
     {
         _inDevice.Stop();
         _inDevice.Close();
         _inDevice.MessageReceived -= new MidiMessageEventHandler(InDevice_MessageRecieved);
     }
 }
Пример #2
0
 private void StopDevice()
 {
     if (_inDevice != null && _inDevice.IsStarted)
     {
         _inDevice.Stop();
         _inDevice.Close();
         _inDevice.MessageReceived -= new MidiMessageEventHandler(InDevice_MessageReceived);
         this.buttonStop.Enabled    = false;
         this.buttonStart.Enabled   = true;
     }
 }
Пример #3
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);
            if (null != _inputDevice && _inputDevice.IsOpen)
            {
                // attempt to prevent any further
                // events from firing
                _inputDevice.Stop();
                _inputDevice.Reset();

                _inputDevice.Close();
                _inputDevice = null;
            }
            if (null != _outputDevice && _outputDevice.IsOpen)
            {
                _outputDevice.Close();
                _outputDevice = null;
            }
        }