public void StartMidi() { _inDevice = new MidiInputDevice(this.cmbMidi.SelectedIndex); _inDevice.MessageFilter = BuildFilter(); _inDevice.MessageReceived += new MidiMessageEventHandler(InDevice_MessageRecieved); _inDevice.Open(); _inDevice.Start(); }
private void InputsComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (null != _device) { _device.Close(); } _device = InputsComboBox.SelectedItem as MidiInputDevice; _device.Input += device_Input; _device.Open(); _device.Start(); }
private void MidiInComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { if (null != _inputDevice) { _inputDevice.Close(); } _inputDevice = MidiInComboBox.SelectedItem as MidiInputDevice; if (null != _inputDevice) { _inputDevice.Input += _inputDevice_Input; } _inputDevice.Open(); _inputDevice.Start(); }
private void StartDevice(int deviceID) { this.textBoxMsg.Clear(); _inDevice = new MidiInputDevice(deviceID); _inDevice.AutoPairController = this.checkBoxAutoPair.Checked; _inDevice.MessageFilter = BuildFilter(); _inDevice.MessageReceived += new MidiMessageEventHandler(InDevice_MessageReceived); if (_inDevice.Open()) { this.buttonStop.Enabled = true; this.buttonStart.Enabled = false; if (!_inDevice.Start()) { MessageBox.Show(this, "Midi device could not be started! Error " + _inDevice.LastErrorCode.ToString(), "Midi Error"); } } else { MessageBox.Show(this, "Midi device could not be opened! Error " + _inDevice.LastErrorCode.ToString(), "Midi Error"); } }