Mercurial > hg > svgui
changeset 207:a5b3c9f580c1
* Fixes for new Vamp API changes -- I think plugin parameters are not being
set correctly yet though
author | Chris Cannam |
---|---|
date | Mon, 26 Feb 2007 20:08:51 +0000 |
parents | 305c129a2c4f |
children | 8495187c13ce |
files | widgets/PluginParameterBox.cpp widgets/PluginParameterBox.h widgets/PluginParameterDialog.cpp |
diffstat | 3 files changed, 40 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/widgets/PluginParameterBox.cpp Mon Feb 26 16:32:12 2007 +0000 +++ b/widgets/PluginParameterBox.cpp Mon Feb 26 20:08:51 2007 +0000 @@ -87,14 +87,14 @@ for (size_t i = 0; i < params.size(); ++i) { + QString identifier = params[i].identifier.c_str(); QString name = params[i].name.c_str(); - QString description = params[i].description.c_str(); QString unit = params[i].unit.c_str(); float min = params[i].minValue; float max = params[i].maxValue; float deft = params[i].defaultValue; - float value = m_plugin->getParameter(params[i].name); + float value = m_plugin->getParameter(params[i].identifier); float qtz = 0.0; if (params[i].isQuantized) qtz = params[i].quantizeStep; @@ -114,7 +114,7 @@ //!!! would be nice to ensure the default value corresponds to // an integer! - QLabel *label = new QLabel(description); + QLabel *label = new QLabel(name); m_layout->addWidget(label, i + offset, 0); ParamRec rec; @@ -127,7 +127,7 @@ if (params[i].isQuantized && !valueNames.empty()) { QComboBox *combobox = new QComboBox; - combobox->setObjectName(name); + combobox->setObjectName(identifier); for (unsigned int j = 0; j < valueNames.size(); ++j) { combobox->addItem(valueNames[j].c_str()); if (lrintf((value - min) / qtz) == j) { @@ -142,7 +142,7 @@ } else if (min == 0.0 && max == 1.0 && qtz == 1.0) { QCheckBox *checkbox = new QCheckBox; - checkbox->setObjectName(name); + checkbox->setObjectName(identifier); checkbox->setCheckState(value == 0.0 ? Qt::Unchecked : Qt::Checked); connect(checkbox, SIGNAL(stateChanged(int)), this, SLOT(checkBoxChanged(int))); @@ -152,7 +152,7 @@ } else { AudioDial *dial = new AudioDial; - dial->setObjectName(description); + dial->setObjectName(name); dial->setMinimum(imin); dial->setMaximum(imax); dial->setPageStep(1); @@ -169,7 +169,7 @@ m_layout->addWidget(dial, i + offset, 1); QDoubleSpinBox *spinbox = new QDoubleSpinBox; - spinbox->setObjectName(name); + spinbox->setObjectName(identifier); spinbox->setMinimum(min); spinbox->setMaximum(max); spinbox->setSuffix(QString(" %1").arg(unit)); @@ -183,8 +183,8 @@ rec.spin = spinbox; } - m_params[name] = rec; - m_descriptionMap[description] = name; + m_params[identifier] = rec; + m_nameMap[name] = identifier; } } @@ -192,19 +192,19 @@ PluginParameterBox::dialChanged(int ival) { QObject *obj = sender(); - QString name = obj->objectName(); + QString identifier = obj->objectName(); - if (m_params.find(name) == m_params.end() && - m_descriptionMap.find(name) != m_descriptionMap.end()) { - name = m_descriptionMap[name]; + if (m_params.find(identifier) == m_params.end() && + m_nameMap.find(identifier) != m_nameMap.end()) { + identifier = m_nameMap[identifier]; } - if (m_params.find(name) == m_params.end()) { - std::cerr << "WARNING: PluginParameterBox::dialChanged: Unknown parameter \"" << name.toStdString() << "\"" << std::endl; + if (m_params.find(identifier) == m_params.end()) { + std::cerr << "WARNING: PluginParameterBox::dialChanged: Unknown parameter \"" << identifier.toStdString() << "\"" << std::endl; return; } - Vamp::PluginBase::ParameterDescriptor params = m_params[name].param; + Vamp::PluginBase::ParameterDescriptor params = m_params[identifier].param; float min = params.minValue; float max = params.maxValue; @@ -233,14 +233,14 @@ newValue = min + ival * qtz; } - QDoubleSpinBox *spin = m_params[name].spin; + QDoubleSpinBox *spin = m_params[identifier].spin; if (spin) { spin->blockSignals(true); spin->setValue(newValue); spin->blockSignals(false); } - m_plugin->setParameter(name.toStdString(), newValue); + m_plugin->setParameter(identifier.toStdString(), newValue); emit pluginConfigurationChanged(PluginXml(m_plugin).toXmlString()); } @@ -249,22 +249,22 @@ PluginParameterBox::checkBoxChanged(int state) { QObject *obj = sender(); - QString name = obj->objectName(); + QString identifier = obj->objectName(); - if (m_params.find(name) == m_params.end() && - m_descriptionMap.find(name) != m_descriptionMap.end()) { - name = m_descriptionMap[name]; + if (m_params.find(identifier) == m_params.end() && + m_nameMap.find(identifier) != m_nameMap.end()) { + identifier = m_nameMap[identifier]; } - if (m_params.find(name) == m_params.end()) { - std::cerr << "WARNING: PluginParameterBox::checkBoxChanged: Unknown parameter \"" << name.toStdString() << "\"" << std::endl; + if (m_params.find(identifier) == m_params.end()) { + std::cerr << "WARNING: PluginParameterBox::checkBoxChanged: Unknown parameter \"" << identifier.toStdString() << "\"" << std::endl; return; } - Vamp::PluginBase::ParameterDescriptor params = m_params[name].param; + Vamp::PluginBase::ParameterDescriptor params = m_params[identifier].param; - if (state) m_plugin->setParameter(name.toStdString(), 1.0); - else m_plugin->setParameter(name.toStdString(), 0.0); + if (state) m_plugin->setParameter(identifier.toStdString(), 1.0); + else m_plugin->setParameter(identifier.toStdString(), 0.0); emit pluginConfigurationChanged(PluginXml(m_plugin).toXmlString()); } @@ -273,19 +273,19 @@ PluginParameterBox::spinBoxChanged(double value) { QObject *obj = sender(); - QString name = obj->objectName(); + QString identifier = obj->objectName(); - if (m_params.find(name) == m_params.end() && - m_descriptionMap.find(name) != m_descriptionMap.end()) { - name = m_descriptionMap[name]; + if (m_params.find(identifier) == m_params.end() && + m_nameMap.find(identifier) != m_nameMap.end()) { + identifier = m_nameMap[identifier]; } - if (m_params.find(name) == m_params.end()) { - std::cerr << "WARNING: PluginParameterBox::spinBoxChanged: Unknown parameter \"" << name.toStdString() << "\"" << std::endl; + if (m_params.find(identifier) == m_params.end()) { + std::cerr << "WARNING: PluginParameterBox::spinBoxChanged: Unknown parameter \"" << identifier.toStdString() << "\"" << std::endl; return; } - Vamp::PluginBase::ParameterDescriptor params = m_params[name].param; + Vamp::PluginBase::ParameterDescriptor params = m_params[identifier].param; float min = params.minValue; float max = params.maxValue; @@ -308,14 +308,14 @@ int ival = (value - min) / qtz; - AudioDial *dial = m_params[name].dial; + AudioDial *dial = m_params[identifier].dial; if (dial) { dial->blockSignals(true); dial->setValue(ival); dial->blockSignals(false); } - m_plugin->setParameter(name.toStdString(), value); + m_plugin->setParameter(identifier.toStdString(), value); emit pluginConfigurationChanged(PluginXml(m_plugin).toXmlString()); } @@ -329,7 +329,7 @@ i != m_params.end(); ++i) { Vamp::PluginBase::ParameterDescriptor ¶m = i->second.param; - float value = m_plugin->getParameter(param.name); + float value = m_plugin->getParameter(param.identifier); if (i->second.spin) { i->second.spin->blockSignals(true);
--- a/widgets/PluginParameterBox.h Mon Feb 26 16:32:12 2007 +0000 +++ b/widgets/PluginParameterBox.h Mon Feb 26 20:08:51 2007 +0000 @@ -61,7 +61,7 @@ }; std::map<QString, ParamRec> m_params; - std::map<QString, QString> m_descriptionMap; + std::map<QString, QString> m_nameMap; }; #endif
--- a/widgets/PluginParameterDialog.cpp Mon Feb 26 16:32:12 2007 +0000 +++ b/widgets/PluginParameterDialog.cpp Mon Feb 26 20:08:51 2007 +0000 @@ -60,7 +60,7 @@ QFont font(pluginBox->font()); font.setBold(true); - QLabel *nameLabel = new QLabel(plugin->getDescription().c_str()); + QLabel *nameLabel = new QLabel(plugin->getName().c_str()); nameLabel->setWordWrap(true); nameLabel->setFont(font); @@ -300,7 +300,7 @@ int increment = 1024; if (fePlugin) { size = fePlugin->getPreferredBlockSize(); - std::cerr << "Feature extraction plugin \"" << fePlugin->getDescription() << "\" reports preferred block size as " << size << std::endl; + std::cerr << "Feature extraction plugin \"" << fePlugin->getName() << "\" reports preferred block size as " << size << std::endl; if (size == 0) size = 1024; increment = fePlugin->getPreferredStepSize(); if (increment == 0) {