Exemple #1
0
 void onClosed(object sender, FormClosedEventArgs e)
 {
     mahPort.shutdown();
     pthrough.Join();
     DeregisterOurDevice();
     lock (inLock)
     {
         if (inPort.IsOpen)
         {
             inPort.Stop();
             inPort.Close();
         }
     }
     lock (outLock)
     {
         if (outPort.IsOpen)
         {
             outPort.Close();
         }
     }
     trayIcon.Icon = null;
     trayIcon.Dispose();
     if (config_changed == true)
     {
         config.Save(ConfigurationSaveMode.Full);
     }
 }
Exemple #2
0
        public void Start(int inPortId, int outPortId, MidiNoteMapIndex index)
        {
            _index = index;

            try
            {
                byte channel = (byte)((InChannel - 1) & 0x0F);
                _inNoteOn  = (byte)(NoteOn | channel);
                _inNoteOff = (byte)(NoteOff | channel);

                channel     = (byte)((OutChannel - 1) & 0x0F);
                _outNoteOn  = (byte)(NoteOn | channel);
                _outNoteOff = (byte)(NoteOff | channel);

                _diagnosticsReceiver.Reset();

                _outPort.Open(outPortId);

                _inPort.Open(inPortId);
                _inPort.Start();
            }
            catch
            {
                if (_outPort.HasStatus(MidiPortStatus.Open))
                {
                    _outPort.Close();
                }

                if (_inPort.HasStatus(MidiPortStatus.Open))
                {
                    _inPort.Close();
                }

                throw;
            }
            sendTest();
        }
Exemple #3
0
 public void Stop()
 {
     _inPort.Stop();
     _inPort.Close();
 }
Exemple #4
0
 public void Dispose()
 {
     port.Stop();
     port.Close();
 }