# HG changeset patch # User Chris Cannam # Date 1144255950 0 # Node ID 195ad6178ef8091184b1a7adb5bd305110e9f458 # Parent ad1fe715b480569f379503b91b0b6213c708c4b9 * Support latest changes to Vamp API (value names for parameters, FFT alignment, value -> bin terminology change) diff -r ad1fe715b480 -r 195ad6178ef8 widgets/PluginParameterBox.cpp --- a/widgets/PluginParameterBox.cpp Mon Apr 03 17:18:27 2006 +0000 +++ b/widgets/PluginParameterBox.cpp Wed Apr 05 16:52:30 2006 +0000 @@ -95,6 +95,8 @@ float qtz = 0.0; if (params[i].isQuantized) qtz = params[i].quantizeStep; + std::vector valueNames = params[i].valueNames; + // construct an integer range int imin = 0, imax = 100; @@ -116,8 +118,24 @@ rec.dial = 0; rec.spin = 0; rec.check = 0; + rec.combo = 0; - if (min == 0.0 && max == 1.0 && qtz == 1.0) { + if (params[i].isQuantized && !valueNames.empty()) { + + QComboBox *combobox = new QComboBox; + combobox->setObjectName(name); + for (unsigned int j = 0; j < valueNames.size(); ++j) { + combobox->addItem(valueNames[j].c_str()); + if (lrintf((value - min) / qtz) == j) { + combobox->setCurrentIndex(j); + } + } + connect(combobox, SIGNAL(activated(int)), + this, SLOT(dialChanged(int))); + m_layout->addWidget(combobox, i + offset, 1, 1, 2); + rec.combo = combobox; + + } else if (min == 0.0 && max == 1.0 && qtz == 1.0) { QCheckBox *checkbox = new QCheckBox; checkbox->setObjectName(name); @@ -135,8 +153,8 @@ dial->setMaximum(imax); dial->setPageStep(1); dial->setNotchesVisible((imax - imin) <= 12); - dial->setDefaultValue(int((deft - min) / qtz)); - dial->setValue(int((value - min) / qtz)); + dial->setDefaultValue(lrintf((deft - min) / qtz)); + dial->setValue(lrintf((value - min) / qtz)); dial->setFixedWidth(32); dial->setFixedHeight(32); connect(dial, SIGNAL(valueChanged(int)), @@ -293,9 +311,15 @@ } i->second.dial->blockSignals(true); - i->second.dial->setValue(int((value - min) / qtz)); + i->second.dial->setValue(lrintf((value - min) / qtz)); i->second.dial->blockSignals(false); } + + if (i->second.combo) { + i->second.combo->blockSignals(true); + i->second.combo->setCurrentIndex(value); + i->second.combo->blockSignals(false); + } } emit pluginConfigurationChanged(PluginXml(m_plugin).toXmlString()); diff -r ad1fe715b480 -r 195ad6178ef8 widgets/PluginParameterBox.h --- a/widgets/PluginParameterBox.h Mon Apr 03 17:18:27 2006 +0000 +++ b/widgets/PluginParameterBox.h Wed Apr 05 16:52:30 2006 +0000 @@ -25,6 +25,7 @@ class QDoubleSpinBox; class QCheckBox; class QGridLayout; +class QComboBox; class PluginParameterBox : public QFrame { @@ -55,6 +56,7 @@ AudioDial *dial; QDoubleSpinBox *spin; QCheckBox *check; + QComboBox *combo; Vamp::PluginBase::ParameterDescriptor param; };