public bool Configure() { var dialog = ConfigureDialog.Show(ChannelCount, Baudrate, COMport, MidiDeviceID); if (dialog.Connected) { SetNumberOfChannels(dialog.NumberOfChannels); // Open the serial interface OpenSerialInput(dialog.COMPort, dialog.BaudRate, dialog.NumberOfChannels); // open the midi device OpenMidiOutput(dialog.MidiDeviceID); } return(dialog.Connected); }
public static ConfigureDialog Show(int channelCount, int baudrate, string COMname = null, int midiDeviceID = -1) { var dialog = new ConfigureDialog(); dialog.textBox1.Text = channelCount.ToString(); dialog.textBox2.Text = baudrate.ToString(); if (COMname != null && dialog.comboBox1.Items.Contains(COMname)) dialog.comboBox1.SelectedItem = COMname; if (midiDeviceID != -1) { var name = AudioLib.PortMidi.Pm_GetDeviceInfo(midiDeviceID).name; if (dialog.comboBox2.Items.Contains(name)) dialog.comboBox2.SelectedItem = name; } dialog.ShowDialog(); return dialog; }
public static ConfigureDialog Show(int channelCount, int baudrate, string COMname = null, int midiDeviceID = -1) { var dialog = new ConfigureDialog(); dialog.textBox1.Text = channelCount.ToString(); dialog.textBox2.Text = baudrate.ToString(); if (COMname != null && dialog.comboBox1.Items.Contains(COMname)) { dialog.comboBox1.SelectedItem = COMname; } if (midiDeviceID != -1) { var name = AudioLib.PortMidi.Pm_GetDeviceInfo(midiDeviceID).name; if (dialog.comboBox2.Items.Contains(name)) { dialog.comboBox2.SelectedItem = name; } } dialog.ShowDialog(); return(dialog); }