summaryrefslogtreecommitdiff
path: root/muse2/muse/widgets
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2012-11-12 04:49:31 +0000
committerTim E. Real <termtech@rogers.com>2012-11-12 04:49:31 +0000
commitbe1005a6031861b91e1a2df33f62e1c5a0a2aeb6 (patch)
tree89152909549c7dd624f4748f394c3adbcbf65b86 /muse2/muse/widgets
parent31f618e5461553bd7836677f944acfa233e5ae3c (diff)
Finished Aftertouch controllers
Feature: Piano KB / drum list show coloured dots when per-pitch controllers exist / have data.
Diffstat (limited to 'muse2/muse/widgets')
-rw-r--r--muse2/muse/widgets/arrangercolumns.cpp26
-rw-r--r--muse2/muse/widgets/arrangercolumnsbase.ui40
-rw-r--r--muse2/muse/widgets/midi_audio_control.cpp269
-rw-r--r--muse2/muse/widgets/midi_audio_control_base.ui46
4 files changed, 181 insertions, 200 deletions
diff --git a/muse2/muse/widgets/arrangercolumns.cpp b/muse2/muse/widgets/arrangercolumns.cpp
index 08a9580e..9e8137e6 100644
--- a/muse2/muse/widgets/arrangercolumns.cpp
+++ b/muse2/muse/widgets/arrangercolumns.cpp
@@ -32,6 +32,18 @@ ArrangerColumns::ArrangerColumns(QWidget* parent) : QDialog(parent)
ignoreSomethingChanged=true;
setupUi(this);
+
+ ctrlType->addItem(tr("Control7"), MusECore::MidiController::Controller7);
+ ctrlType->addItem(tr("Control14"), MusECore::MidiController::Controller14);
+ ctrlType->addItem(tr("RPN"), MusECore::MidiController::RPN);
+ ctrlType->addItem(tr("NPRN"), MusECore::MidiController::NRPN);
+ ctrlType->addItem(tr("RPN14"), MusECore::MidiController::RPN14);
+ ctrlType->addItem(tr("NRPN14"), MusECore::MidiController::NRPN14);
+ ctrlType->addItem(tr("Pitch"), MusECore::MidiController::Pitch);
+ ctrlType->addItem(tr("Program"), MusECore::MidiController::Program);
+ //ctrlType->addItem(tr("PolyAftertouch"), MusECore::MidiController::PolyAftertouch); // Not supported yet. Need a way to select pitch.
+ ctrlType->addItem(tr("Aftertouch"), MusECore::MidiController::Aftertouch);
+ ctrlType->setCurrentIndex(0);
initList();
@@ -58,7 +70,9 @@ ArrangerColumns::ArrangerColumns(QWidget* parent) : QDialog(parent)
void ArrangerColumns::ctrlTypeChanged(int idx)
{
- MusECore::MidiController::ControllerType t = (MusECore::MidiController::ControllerType)idx;
+ if(idx == -1)
+ return;
+ MusECore::MidiController::ControllerType t = (MusECore::MidiController::ControllerType)ctrlType->itemData(idx).toInt();
switch (t)
{
@@ -90,17 +104,17 @@ void ArrangerColumns::somethingChanged()
if (ignoreSomethingChanged) return;
int row=listWidget->currentRow();
- if (row!=-1)
+ if (row!=-1 && ctrlType->currentIndex() != -1)
{
+ MusECore::MidiController::ControllerType t = (MusECore::MidiController::ControllerType)ctrlType->itemData(ctrlType->currentIndex()).toInt();
int hnum = spinBoxHCtrlNo->value();
int lnum = spinBoxLCtrlNo->value();
- MusECore::MidiController::ControllerType t = (MusECore::MidiController::ControllerType)ctrlType->currentIndex();
int ctrl_number = MusECore::MidiController::genNum(t, hnum, lnum);
Arranger::new_custom_columns[row].name=nameEdit->text();
Arranger::new_custom_columns[row].ctrl=ctrl_number;
Arranger::new_custom_columns[row].affected_pos=(affectBeginButton->isChecked() ? Arranger::custom_col_t::AFFECT_BEGIN : Arranger::custom_col_t::AFFECT_CPOS);
-
+
listWidget->currentItem()->setText(getListEntryString(row));
}
}
@@ -134,7 +148,9 @@ void ArrangerColumns::itemSelected(int i)
nameEdit->setText(Arranger::new_custom_columns[i].name);
int num=Arranger::new_custom_columns[i].ctrl;
- ctrlType->setCurrentIndex(MusECore::midiControllerType(num));
+ int idx = ctrlType->findData(MusECore::midiControllerType(num));
+ if(idx != -1)
+ ctrlType->setCurrentIndex(idx);
if (spinBoxHCtrlNo->isEnabled())
spinBoxHCtrlNo->setValue((num & 0xFF00)>>8);
else
diff --git a/muse2/muse/widgets/arrangercolumnsbase.ui b/muse2/muse/widgets/arrangercolumnsbase.ui
index eda9e923..8568f9f5 100644
--- a/muse2/muse/widgets/arrangercolumnsbase.ui
+++ b/muse2/muse/widgets/arrangercolumnsbase.ui
@@ -69,46 +69,6 @@
<property name="whatsThis">
<string>Midi controller type</string>
</property>
- <item>
- <property name="text">
- <string>Control7</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Control14</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>RPN</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>NRPN</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>RPN14</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>NRPN14</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Pitch</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Program</string>
- </property>
- </item>
</widget>
</item>
</layout>
diff --git a/muse2/muse/widgets/midi_audio_control.cpp b/muse2/muse/widgets/midi_audio_control.cpp
index 17d724ac..7e2d5091 100644
--- a/muse2/muse/widgets/midi_audio_control.cpp
+++ b/muse2/muse/widgets/midi_audio_control.cpp
@@ -45,6 +45,18 @@ MidiAudioControl::MidiAudioControl(int port, int chan, int ctrl, QWidget* parent
{
setupUi(this);
+ controlTypeComboBox->addItem(tr("Control7"), MusECore::MidiController::Controller7);
+ controlTypeComboBox->addItem(tr("Control14"), MusECore::MidiController::Controller14);
+ controlTypeComboBox->addItem(tr("RPN"), MusECore::MidiController::RPN);
+ controlTypeComboBox->addItem(tr("NPRN"), MusECore::MidiController::NRPN);
+ controlTypeComboBox->addItem(tr("RPN14"), MusECore::MidiController::RPN14);
+ controlTypeComboBox->addItem(tr("NRPN14"), MusECore::MidiController::NRPN14);
+ controlTypeComboBox->addItem(tr("Pitch"), MusECore::MidiController::Pitch);
+ controlTypeComboBox->addItem(tr("Program"), MusECore::MidiController::Program);
+ //controlTypeComboBox->addItem(tr("PolyAftertouch"), MusECore::MidiController::PolyAftertouch); // Not supported yet. Need a way to select pitch.
+ controlTypeComboBox->addItem(tr("Aftertouch"), MusECore::MidiController::Aftertouch);
+ controlTypeComboBox->setCurrentIndex(0);
+
_port = port;
_chan = chan;
_ctrl = ctrl;
@@ -89,59 +101,71 @@ void MidiAudioControl::heartbeat()
if(MusEGlobal::midiLearnCtrl != -1)
{
MusECore::MidiController::ControllerType type = MusECore::midiControllerType(MusEGlobal::midiLearnCtrl);
- if(type < controlTypeComboBox->count() && type != controlTypeComboBox->currentIndex())
+ int idx = controlTypeComboBox->findData(type);
+ if(idx != -1 && idx != controlTypeComboBox->currentIndex())
{
controlTypeComboBox->blockSignals(true);
- controlTypeComboBox->setCurrentIndex(type);
+ controlTypeComboBox->setCurrentIndex(idx);
controlTypeComboBox->blockSignals(false);
}
int hv = (MusEGlobal::midiLearnCtrl >> 8) & 0xff;
int lv = MusEGlobal::midiLearnCtrl & 0xff;
- if(type == MusECore::MidiController::Program || type == MusECore::MidiController::Pitch)
- {
- ctrlHiSpinBox->setEnabled(false);
- ctrlLoSpinBox->setEnabled(false);
- ctrlHiSpinBox->blockSignals(true);
- ctrlLoSpinBox->blockSignals(true);
- ctrlHiSpinBox->setValue(0);
- ctrlLoSpinBox->setValue(0);
- ctrlHiSpinBox->blockSignals(false);
- ctrlLoSpinBox->blockSignals(false);
- }
- else if(type == MusECore::MidiController::Controller7)
- {
- ctrlHiSpinBox->setEnabled(false);
- ctrlLoSpinBox->setEnabled(true);
- ctrlHiSpinBox->blockSignals(true);
- ctrlHiSpinBox->setValue(0);
- ctrlHiSpinBox->blockSignals(false);
-
- if(lv != ctrlLoSpinBox->value())
- {
- ctrlLoSpinBox->blockSignals(true);
- ctrlLoSpinBox->setValue(lv);
- ctrlLoSpinBox->blockSignals(false);
- }
- }
- else
+ switch(type)
{
- ctrlHiSpinBox->setEnabled(true);
- ctrlLoSpinBox->setEnabled(true);
- if(hv != ctrlHiSpinBox->value())
- {
+ case MusECore::MidiController::Program:
+ case MusECore::MidiController::Pitch:
+ case MusECore::MidiController::PolyAftertouch: // Unsupported yet. Need a way to select pitch.
+ case MusECore::MidiController::Aftertouch:
+ ctrlHiSpinBox->setEnabled(false);
+ ctrlLoSpinBox->setEnabled(false);
ctrlHiSpinBox->blockSignals(true);
- ctrlHiSpinBox->setValue(hv);
- ctrlHiSpinBox->blockSignals(false);
- }
- if(lv != ctrlLoSpinBox->value())
- {
ctrlLoSpinBox->blockSignals(true);
- ctrlLoSpinBox->setValue(lv);
+ ctrlHiSpinBox->setValue(0);
+ ctrlLoSpinBox->setValue(0);
+ ctrlHiSpinBox->blockSignals(false);
ctrlLoSpinBox->blockSignals(false);
- }
- }
+ break;
+ case MusECore::MidiController::Controller7:
+ ctrlHiSpinBox->setEnabled(false);
+ ctrlLoSpinBox->setEnabled(true);
+
+ ctrlHiSpinBox->blockSignals(true);
+ ctrlHiSpinBox->setValue(0);
+ ctrlHiSpinBox->blockSignals(false);
+
+ if(lv != ctrlLoSpinBox->value())
+ {
+ ctrlLoSpinBox->blockSignals(true);
+ ctrlLoSpinBox->setValue(lv);
+ ctrlLoSpinBox->blockSignals(false);
+ }
+ break;
+ case MusECore::MidiController::Controller14:
+ case MusECore::MidiController::RPN:
+ case MusECore::MidiController::RPN14:
+ case MusECore::MidiController::NRPN:
+ case MusECore::MidiController::NRPN14:
+ ctrlHiSpinBox->setEnabled(true);
+ ctrlLoSpinBox->setEnabled(true);
+ if(hv != ctrlHiSpinBox->value())
+ {
+ ctrlHiSpinBox->blockSignals(true);
+ ctrlHiSpinBox->setValue(hv);
+ ctrlHiSpinBox->blockSignals(false);
+ }
+ if(lv != ctrlLoSpinBox->value())
+ {
+ ctrlLoSpinBox->blockSignals(true);
+ ctrlLoSpinBox->setValue(lv);
+ ctrlLoSpinBox->blockSignals(false);
+ }
+ break;
+ default:
+ printf("FIXME: MidiAudioControl::heartbeat: Unknown control type: %d\n", type);
+ break;
+ }
_ctrl = MusECore::midiCtrlTerms2Number(type, (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value());
}
@@ -184,46 +208,55 @@ void MidiAudioControl::chanChanged()
void MidiAudioControl::updateCtrlBoxes()
{
- int idx = controlTypeComboBox->currentIndex();
- if(idx == -1)
+ if(controlTypeComboBox->currentIndex() == -1)
return;
-
- if(idx == MusECore::MidiController::Program || idx == MusECore::MidiController::Pitch)
- {
- ctrlHiSpinBox->setEnabled(false);
- ctrlLoSpinBox->setEnabled(false);
- ctrlHiSpinBox->blockSignals(true);
- ctrlLoSpinBox->blockSignals(true);
- ctrlHiSpinBox->setValue(0);
- ctrlLoSpinBox->setValue(0);
- ctrlHiSpinBox->blockSignals(false);
- ctrlLoSpinBox->blockSignals(false);
- }
- else if(idx == MusECore::MidiController::Controller7)
- {
- ctrlHiSpinBox->setEnabled(false);
- ctrlLoSpinBox->setEnabled(true);
+ MusECore::MidiController::ControllerType t = (MusECore::MidiController::ControllerType)controlTypeComboBox->itemData(controlTypeComboBox->currentIndex()).toInt();
- ctrlHiSpinBox->blockSignals(true);
- ctrlHiSpinBox->setValue(0);
- ctrlHiSpinBox->blockSignals(false);
- }
- else
+ switch(t)
{
- ctrlHiSpinBox->setEnabled(true);
- ctrlLoSpinBox->setEnabled(true);
- }
+ case MusECore::MidiController::Program:
+ case MusECore::MidiController::Pitch:
+ case MusECore::MidiController::PolyAftertouch: // Unsupported yet. Need a way to select pitch.
+ case MusECore::MidiController::Aftertouch:
+ ctrlHiSpinBox->setEnabled(false);
+ ctrlLoSpinBox->setEnabled(false);
+ ctrlHiSpinBox->blockSignals(true);
+ ctrlLoSpinBox->blockSignals(true);
+ ctrlHiSpinBox->setValue(0);
+ ctrlLoSpinBox->setValue(0);
+ ctrlHiSpinBox->blockSignals(false);
+ ctrlLoSpinBox->blockSignals(false);
+ break;
+ case MusECore::MidiController::Controller7:
+ ctrlHiSpinBox->setEnabled(false);
+ ctrlLoSpinBox->setEnabled(true);
+ ctrlHiSpinBox->blockSignals(true);
+ ctrlHiSpinBox->setValue(0);
+ ctrlHiSpinBox->blockSignals(false);
+ break;
+ case MusECore::MidiController::Controller14:
+ case MusECore::MidiController::RPN:
+ case MusECore::MidiController::RPN14:
+ case MusECore::MidiController::NRPN:
+ case MusECore::MidiController::NRPN14:
+ ctrlHiSpinBox->setEnabled(true);
+ ctrlLoSpinBox->setEnabled(true);
+ break;
+ default:
+ printf("FIXME: MidiAudioControl::updateCtrlBoxes: Unknown control type: %d\n", t);
+ break;
+ }
}
void MidiAudioControl::ctrlTypeChanged(int idx)
{
if(idx == -1)
return;
-
+
updateCtrlBoxes();
_ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value();
- _ctrl = MusECore::midiCtrlTerms2Number(MusECore::MidiController::ControllerType(idx), _ctrl);
+ _ctrl = MusECore::midiCtrlTerms2Number((MusECore::MidiController::ControllerType)controlTypeComboBox->itemData(idx).toInt(), _ctrl);
resetLearn();
}
@@ -233,7 +266,7 @@ void MidiAudioControl::ctrlHChanged()
if(controlTypeComboBox->currentIndex() == -1)
return;
_ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value();
- _ctrl = MusECore::midiCtrlTerms2Number(MusECore::MidiController::ControllerType(controlTypeComboBox->currentIndex()), _ctrl);
+ _ctrl = MusECore::midiCtrlTerms2Number((MusECore::MidiController::ControllerType)controlTypeComboBox->itemData(controlTypeComboBox->currentIndex()).toInt(), _ctrl);
resetLearn();
}
@@ -243,7 +276,7 @@ void MidiAudioControl::ctrlLChanged()
if(controlTypeComboBox->currentIndex() == -1)
return;
_ctrl = (ctrlHiSpinBox->value() << 8) + ctrlLoSpinBox->value();
- _ctrl = MusECore::midiCtrlTerms2Number(MusECore::MidiController::ControllerType(controlTypeComboBox->currentIndex()), _ctrl);
+ _ctrl = MusECore::midiCtrlTerms2Number((MusECore::MidiController::ControllerType)controlTypeComboBox->itemData(controlTypeComboBox->currentIndex()).toInt(), _ctrl);
resetLearn();
}
@@ -282,59 +315,71 @@ void MidiAudioControl::update()
channelSpinBox->blockSignals(false);
int type = MusECore::midiControllerType(_ctrl);
- if(type < controlTypeComboBox->count())
+ int idx = controlTypeComboBox->findData(type);
+ if(idx != -1 && idx != controlTypeComboBox->currentIndex())
{
controlTypeComboBox->blockSignals(true);
- controlTypeComboBox->setCurrentIndex(type);
+ controlTypeComboBox->setCurrentIndex(idx);
controlTypeComboBox->blockSignals(false);
}
int hv = (_ctrl >> 8) & 0xff;
int lv = _ctrl & 0xff;
- if(type == MusECore::MidiController::Program || type == MusECore::MidiController::Pitch)
- {
- ctrlHiSpinBox->setEnabled(false);
- ctrlLoSpinBox->setEnabled(false);
- ctrlHiSpinBox->blockSignals(true);
- ctrlLoSpinBox->blockSignals(true);
- ctrlHiSpinBox->setValue(0);
- ctrlLoSpinBox->setValue(0);
- ctrlHiSpinBox->blockSignals(false);
- ctrlLoSpinBox->blockSignals(false);
- }
- else if(type == MusECore::MidiController::Controller7)
- {
- ctrlHiSpinBox->setEnabled(false);
- ctrlLoSpinBox->setEnabled(true);
- ctrlHiSpinBox->blockSignals(true);
- ctrlHiSpinBox->setValue(0);
- ctrlHiSpinBox->blockSignals(false);
-
- if(lv != ctrlLoSpinBox->value())
- {
- ctrlLoSpinBox->blockSignals(true);
- ctrlLoSpinBox->setValue(lv);
- ctrlLoSpinBox->blockSignals(false);
- }
- }
- else
+ switch(type)
{
- ctrlHiSpinBox->setEnabled(true);
- ctrlLoSpinBox->setEnabled(true);
- if(hv != ctrlHiSpinBox->value())
- {
+ case MusECore::MidiController::Program:
+ case MusECore::MidiController::Pitch:
+ case MusECore::MidiController::PolyAftertouch: // Unsupported yet. Need a way to select pitch.
+ case MusECore::MidiController::Aftertouch:
+ ctrlHiSpinBox->setEnabled(false);
+ ctrlLoSpinBox->setEnabled(false);
ctrlHiSpinBox->blockSignals(true);
- ctrlHiSpinBox->setValue(hv);
- ctrlHiSpinBox->blockSignals(false);
- }
- if(lv != ctrlLoSpinBox->value())
- {
ctrlLoSpinBox->blockSignals(true);
- ctrlLoSpinBox->setValue(lv);
+ ctrlHiSpinBox->setValue(0);
+ ctrlLoSpinBox->setValue(0);
+ ctrlHiSpinBox->blockSignals(false);
ctrlLoSpinBox->blockSignals(false);
- }
+ break;
+ case MusECore::MidiController::Controller7:
+ ctrlHiSpinBox->setEnabled(false);
+ ctrlLoSpinBox->setEnabled(true);
+
+ ctrlHiSpinBox->blockSignals(true);
+ ctrlHiSpinBox->setValue(0);
+ ctrlHiSpinBox->blockSignals(false);
+
+ if(lv != ctrlLoSpinBox->value())
+ {
+ ctrlLoSpinBox->blockSignals(true);
+ ctrlLoSpinBox->setValue(lv);
+ ctrlLoSpinBox->blockSignals(false);
+ }
+ break;
+ case MusECore::MidiController::Controller14:
+ case MusECore::MidiController::RPN:
+ case MusECore::MidiController::RPN14:
+ case MusECore::MidiController::NRPN:
+ case MusECore::MidiController::NRPN14:
+ ctrlHiSpinBox->setEnabled(true);
+ ctrlLoSpinBox->setEnabled(true);
+ if(hv != ctrlHiSpinBox->value())
+ {
+ ctrlHiSpinBox->blockSignals(true);
+ ctrlHiSpinBox->setValue(hv);
+ ctrlHiSpinBox->blockSignals(false);
+ }
+ if(lv != ctrlLoSpinBox->value())
+ {
+ ctrlLoSpinBox->blockSignals(true);
+ ctrlLoSpinBox->setValue(lv);
+ ctrlLoSpinBox->blockSignals(false);
+ }
+ break;
+ default:
+ printf("FIXME: MidiAudioControl::updateCtrlBoxes: Unknown control type: %d\n", type);
+ break;
}
}
-}
+} // namespace MusEGui
diff --git a/muse2/muse/widgets/midi_audio_control_base.ui b/muse2/muse/widgets/midi_audio_control_base.ui
index 2e341121..11ecc590 100644
--- a/muse2/muse/widgets/midi_audio_control_base.ui
+++ b/muse2/muse/widgets/midi_audio_control_base.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>341</width>
- <height>148</height>
+ <width>367</width>
+ <height>156</height>
</rect>
</property>
<property name="windowTitle">
@@ -80,46 +80,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <item>
- <property name="text">
- <string>Control7</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Control14</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>RPN</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>NRPN</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>RPN14</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>NRPN14</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Pitch</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Program</string>
- </property>
- </item>
</widget>
</item>
<item>
@@ -225,7 +185,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Learn</string>
+ <string>&amp;Learn</string>
</property>
<property name="checkable">
<bool>true</bool>