diff --git a/ConfiguratorModelD/MainWindow.cpp b/ConfiguratorModelD/MainWindow.cpp index 129675c..955fbab 100644 --- a/ConfiguratorModelD/MainWindow.cpp +++ b/ConfiguratorModelD/MainWindow.cpp @@ -21,6 +21,10 @@ MainWindow::MainWindow(QWidget *parent) : { ui->setupUi(this); setUnifiedTitleAndToolBarOnMac( true ); + setWindowFlags( Qt::Window + | Qt::WindowMinimizeButtonHint + | Qt::WindowCloseButtonHint + | Qt::CustomizeWindowHint ); adjustSize(); m_midiOut = new QMidiOut( this ); @@ -39,7 +43,19 @@ MainWindow::~MainWindow() //Get Ports and write into combobox void MainWindow::getPorts( void ) { + bool portAvailable = true; ui->comboBoxPort->addItems( m_midiOut->getPorts() ); + + //Block GUI if no port available + if( ui->comboBoxPort->count() == 0 ) + { + portAvailable = false; + statusBar()->showMessage( tr( "No MIDI port found." ), 0 ); + } + ui->comboBoxPort->setEnabled( portAvailable ); + ui->labelPort->setEnabled( portAvailable ); + ui->groupBox->setEnabled( portAvailable ); + ui->actionSendAll->setEnabled( portAvailable ); } //Search the D and select it @@ -93,6 +109,10 @@ void MainWindow::on_actionSendAll_triggered() on_spinBoxPitchBend_editingFinished(); on_spinBoxTranspose_editingFinished(); on_comboBoxModCurve_activated(0); + on_spinBoxMidiZeroVolts_editingFinished(); + on_comboBoxMidiChannelSwitches_activated(0); + on_comboBoxPolyChainEnable_activated(0); + on_spinBoxPolyChainId_editingFinished(); } //MIDI channel @@ -149,6 +169,42 @@ void MainWindow::on_comboBoxModCurve_activated(int index) m_midiOut->closePort(); } +//MIDI Zero Volts +void MainWindow::on_spinBoxMidiZeroVolts_editingFinished() +{ + m_midiOut->openPort( ui->comboBoxPort->currentIndex() ); + std::vector message = buildMessage( 0x07, (unsigned char)(ui->spinBoxMidiZeroVolts->value()) ); + m_midiOut->sendRawMessage( message ); + m_midiOut->closePort(); +} + +//MIDI channel switches +void MainWindow::on_comboBoxMidiChannelSwitches_activated(int index) +{ + m_midiOut->openPort( ui->comboBoxPort->currentIndex() ); + std::vector message = buildMessage( 0x0A, (unsigned char)ui->comboBoxMidiChannelSwitches->currentIndex() ); + m_midiOut->sendRawMessage( message ); + m_midiOut->closePort(); +} + +//Poly chain enable +void MainWindow::on_comboBoxPolyChainEnable_activated(int index) +{ + m_midiOut->openPort( ui->comboBoxPort->currentIndex() ); + std::vector message = buildMessage( 0x08, (unsigned char)ui->comboBoxPolyChainEnable->currentIndex() ); + m_midiOut->sendRawMessage( message ); + m_midiOut->closePort(); +} + +//Poly chain ID +void MainWindow::on_spinBoxPolyChainId_editingFinished() +{ + m_midiOut->openPort( ui->comboBoxPort->currentIndex() ); + std::vector message = buildMessage( 0x09, (unsigned char)(ui->spinBoxPolyChainId->value()) ); + m_midiOut->sendRawMessage( message ); + m_midiOut->closePort(); +} + //Qt Box void MainWindow::on_actionAboutQt_triggered() { @@ -210,3 +266,15 @@ void MainWindow::on_spinBoxTranspose_valueChanged(int arg1) { on_spinBoxTranspose_editingFinished(); } + +//MIDI Zero Volts box changed - do the same like editing finished +void MainWindow::on_spinBoxMidiZeroVolts_valueChanged(int arg1) +{ + on_spinBoxMidiZeroVolts_editingFinished(); +} + +//Poly Chain ID box changed - do the same like editing finished +void MainWindow::on_spinBoxPolyChainId_valueChanged(int arg1) +{ + on_spinBoxPolyChainId_editingFinished(); +} diff --git a/ConfiguratorModelD/MainWindow.h b/ConfiguratorModelD/MainWindow.h index 4eccc21..22722d9 100644 --- a/ConfiguratorModelD/MainWindow.h +++ b/ConfiguratorModelD/MainWindow.h @@ -33,6 +33,10 @@ private slots: void on_spinBoxPitchBend_editingFinished(); void on_spinBoxTranspose_editingFinished(); void on_comboBoxModCurve_activated(int index); + void on_spinBoxMidiZeroVolts_editingFinished(); + void on_comboBoxMidiChannelSwitches_activated(int index); + void on_comboBoxPolyChainEnable_activated(int index); + void on_spinBoxPolyChainId_editingFinished(); void on_actionAboutQt_triggered(); void on_actionAboutConfiguratorModelD_triggered(); @@ -41,6 +45,8 @@ private slots: void on_spinBoxMidiChannel_valueChanged(int arg1); void on_spinBoxPitchBend_valueChanged(int arg1); void on_spinBoxTranspose_valueChanged(int arg1); + void on_spinBoxMidiZeroVolts_valueChanged(int arg1); + void on_spinBoxPolyChainId_valueChanged(int arg1); private: Ui::MainWindow *ui; diff --git a/ConfiguratorModelD/MainWindow.ui b/ConfiguratorModelD/MainWindow.ui index 6e9db56..f07aa82 100644 --- a/ConfiguratorModelD/MainWindow.ui +++ b/ConfiguratorModelD/MainWindow.ui @@ -6,70 +6,58 @@ 0 0 - 300 - 365 + 569 + 344 Configurator Model D - - - - - - - - 0 - 0 - - - - MIDI Port - - - - - - - - + Parameter - + - - - - - 0 - 0 - - + + + + + Off + + + + + On + + + + + + - MIDI Channel + Pitch Bend Semitones - - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - 1 - - 16 + 12 + + + 12 - + @@ -82,7 +70,39 @@ - + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + -12 + + + 12 + + + + + + + + Soft + + + + + Medium + + + + + Hard + + + + + @@ -101,7 +121,21 @@ - + + + + Transpose + + + + + + + Modulation Curve + + + + @@ -114,8 +148,58 @@ - - + + + + + 0 + 0 + + + + MIDI Channel + + + + + + + Qt::Vertical + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + 16 + + + + + + + Poly Chain + + + + + + + Poly Chain ID + + + + + + + Note: If you use SysEx instead of the recommended A-440 method to turn on the Poly Chain, then the Poly Chain Device ID of other units in the chain will not be set automatically. You have to use SysEx to set the Poly Chain ID of the rst MODEL D to Device ID=0, the second MODEL D to ID=1, the third MODEL D to ID=3 and so on. All MODEL D units must have the same MIDI channel. + Off @@ -128,68 +212,53 @@ - - - - Pitch Bend Semitones - - - - - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - 12 - - - 12 + 15 - - + + - Transpose + MIDI Note Zero Volts - - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - -12 - - 12 + 127 + + + 36 - - + + - Modulation Curve + MIDI Channel Switches - - - - - Soft - - + + - Medium + Enable - Hard + Disable @@ -199,6 +268,26 @@ + + + + + + + 0 + 0 + + + + MIDI Port + + + + + + + + @@ -206,7 +295,7 @@ 0 0 - 300 + 569 22