Mercurial > hg > svcore
changeset 239:71f869dac40b
* Further fixes for Vamp API change, and update to support API versioning
* Add plugin, output and parameter descriptions to GUI
* Avoid squished panner in heads-up-display on pane when time-value or note
layer is on top
author | Chris Cannam |
---|---|
date | Tue, 27 Feb 2007 12:51:38 +0000 |
parents | 76635085e2d9 |
children | 8133ae938704 |
files | data/model/WaveFileModel.h plugin/DSSIPluginInstance.cpp plugin/DSSIPluginInstance.h plugin/FeatureExtractionPluginFactory.cpp plugin/LADSPAPluginInstance.cpp plugin/LADSPAPluginInstance.h plugin/PluginXml.cpp plugin/RealTimePluginInstance.cpp plugin/RealTimePluginInstance.h |
diffstat | 9 files changed, 58 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/data/model/WaveFileModel.h Mon Feb 26 20:08:51 2007 +0000 +++ b/data/model/WaveFileModel.h Tue Feb 27 12:51:38 2007 +0000 @@ -73,6 +73,11 @@ virtual QString toXmlString(QString indent = "", QString extraAttributes = "") const; +signals: + void modelChanged(); + void modelChanged(size_t startFrame, size_t endFrame); + void completionChanged(); + protected slots: void fillTimerTimedOut(); void cacheFilled();
--- a/plugin/DSSIPluginInstance.cpp Mon Feb 26 20:08:51 2007 +0000 +++ b/plugin/DSSIPluginInstance.cpp Tue Feb 27 12:51:38 2007 +0000 @@ -98,15 +98,21 @@ } std::string +DSSIPluginInstance::getIdentifier() const +{ + return m_descriptor->LADSPA_Plugin->Label; +} + +std::string DSSIPluginInstance::getName() const { - return m_descriptor->LADSPA_Plugin->Label; + return m_descriptor->LADSPA_Plugin->Name; } std::string DSSIPluginInstance::getDescription() const { - return m_descriptor->LADSPA_Plugin->Name; + return ""; } std::string @@ -138,8 +144,9 @@ ParameterDescriptor pd; unsigned int pn = m_controlPortsIn[i].first; - pd.name = m_descriptor->LADSPA_Plugin->PortNames[pn]; - pd.description = pd.name; + pd.identifier = m_descriptor->LADSPA_Plugin->PortNames[pn]; + pd.name = pd.identifier; + pd.description = ""; pd.minValue = f->getPortMinimum(m_descriptor->LADSPA_Plugin, pn); pd.maxValue = f->getPortMaximum(m_descriptor->LADSPA_Plugin, pn); pd.defaultValue = f->getPortDefault(m_descriptor->LADSPA_Plugin, pn); @@ -159,13 +166,13 @@ } float -DSSIPluginInstance::getParameter(std::string name) const +DSSIPluginInstance::getParameter(std::string id) const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getParameter(" << name << ")" << std::endl; + std::cerr << "DSSIPluginInstance::getParameter(" << id << ")" << std::endl; #endif for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { - if (name == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { + if (id == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { #ifdef DEBUG_DSSI std::cerr << "Matches port " << i << std::endl; #endif @@ -181,14 +188,14 @@ } void -DSSIPluginInstance::setParameter(std::string name, float value) +DSSIPluginInstance::setParameter(std::string id, float value) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::setParameter(" << name << ", " << value << ")" << std::endl; + std::cerr << "DSSIPluginInstance::setParameter(" << id << ", " << value << ")" << std::endl; #endif for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { - if (name == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { + if (id == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { setParameterValue(i, value); break; }
--- a/plugin/DSSIPluginInstance.h Mon Feb 26 20:08:51 2007 +0000 +++ b/plugin/DSSIPluginInstance.h Tue Feb 27 12:51:38 2007 +0000 @@ -47,6 +47,7 @@ virtual QString getPluginIdentifier() const { return m_identifier; } int getPosition() const { return m_position; } + virtual std::string getIdentifier() const; virtual std::string getName() const; virtual std::string getDescription() const; virtual std::string getMaker() const;
--- a/plugin/FeatureExtractionPluginFactory.cpp Mon Feb 26 20:08:51 2007 +0000 +++ b/plugin/FeatureExtractionPluginFactory.cpp Tue Feb 27 12:51:38 2007 +0000 @@ -121,7 +121,7 @@ const VampPluginDescriptor *descriptor = 0; int index = 0; - while ((descriptor = fn(index))) { + while ((descriptor = fn(VAMP_API_VERSION, index))) { QString id = PluginIdentifier::createIdentifier ("vamp", soname, descriptor->identifier); rv.push_back(id); @@ -232,7 +232,7 @@ goto done; } - while ((descriptor = fn(index))) { + while ((descriptor = fn(VAMP_API_VERSION, index))) { if (label == descriptor->identifier) break; ++index; }
--- a/plugin/LADSPAPluginInstance.cpp Mon Feb 26 20:08:51 2007 +0000 +++ b/plugin/LADSPAPluginInstance.cpp Tue Feb 27 12:51:38 2007 +0000 @@ -81,15 +81,21 @@ } std::string +LADSPAPluginInstance::getIdentifier() const +{ + return m_descriptor->Label; +} + +std::string LADSPAPluginInstance::getName() const { - return m_descriptor->Label; + return m_descriptor->Name; } std::string LADSPAPluginInstance::getDescription() const { - return m_descriptor->Name; + return ""; } std::string @@ -121,8 +127,9 @@ ParameterDescriptor pd; unsigned int pn = m_controlPortsIn[i].first; - pd.name = m_descriptor->PortNames[pn]; - pd.description = pd.name; + pd.identifier = m_descriptor->PortNames[pn]; + pd.name = pd.identifier; + pd.description = ""; pd.minValue = f->getPortMinimum(m_descriptor, pn); pd.maxValue = f->getPortMaximum(m_descriptor, pn); pd.defaultValue = f->getPortDefault(m_descriptor, pn); @@ -162,14 +169,14 @@ #endif if (haveLabels) { - pd.description = QString(pd.description.c_str()) + pd.name = QString(pd.name.c_str()) .replace(QRegExp("\\([^\\(\\)]+=[^\\(\\)]+\\)$"), "") .toStdString(); } else { static QRegExp unitRE("[\\[\\(]([A-Za-z0-9/]+)[\\)\\]]$"); if (unitRE.indexIn(pd.name.c_str()) >= 0) { pd.unit = unitRE.cap(1).toStdString(); - pd.description = QString(pd.description.c_str()) + pd.name = QString(pd.name.c_str()) .replace(unitRE, "").toStdString(); } } @@ -181,10 +188,10 @@ } float -LADSPAPluginInstance::getParameter(std::string name) const +LADSPAPluginInstance::getParameter(std::string id) const { for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { - if (name == m_descriptor->PortNames[m_controlPortsIn[i].first]) { + if (id == m_descriptor->PortNames[m_controlPortsIn[i].first]) { return getParameterValue(i); } } @@ -193,10 +200,12 @@ } void -LADSPAPluginInstance::setParameter(std::string name, float value) +LADSPAPluginInstance::setParameter(std::string id, float value) { for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { - if (name == m_descriptor->PortNames[m_controlPortsIn[i].first]) { + if (id == m_descriptor->PortNames[m_controlPortsIn[i].first]) { + std::cerr << "LADSPAPluginInstance::setParameter: Found id " + << id << " at control port " << i << std::endl; setParameterValue(i, value); break; }
--- a/plugin/LADSPAPluginInstance.h Mon Feb 26 20:08:51 2007 +0000 +++ b/plugin/LADSPAPluginInstance.h Tue Feb 27 12:51:38 2007 +0000 @@ -43,6 +43,7 @@ virtual QString getPluginIdentifier() const { return m_identifier; } int getPosition() const { return m_position; } + virtual std::string getIdentifier() const; virtual std::string getName() const; virtual std::string getDescription() const; virtual std::string getMaker() const;
--- a/plugin/PluginXml.cpp Mon Feb 26 20:08:51 2007 +0000 +++ b/plugin/PluginXml.cpp Tue Feb 27 12:51:38 2007 +0000 @@ -59,7 +59,8 @@ QString s; s += indent; - s += QString("<plugin name=\"%1\" description=\"%2\" maker=\"%3\" version=\"%4\" copyright=\"%5\" %6 ") + s += QString("<plugin identifier=\"%1\" name=\"%2\" description=\"%3\" maker=\"%4\" version=\"%5\" copyright=\"%6\" %7 ") + .arg(encodeEntities(QString(m_plugin->getIdentifier().c_str()))) .arg(encodeEntities(QString(m_plugin->getName().c_str()))) .arg(encodeEntities(QString(m_plugin->getDescription().c_str()))) .arg(encodeEntities(QString(m_plugin->getMaker().c_str()))) @@ -83,8 +84,8 @@ // << m_plugin->getParameter(i->name) << std::endl; s += QString("param-%1=\"%2\" ") - .arg(stripInvalidParameterNameCharacters(QString(i->name.c_str()))) - .arg(m_plugin->getParameter(i->name)); + .arg(stripInvalidParameterNameCharacters(QString(i->identifier.c_str()))) + .arg(m_plugin->getParameter(i->identifier)); } RealTimePluginInstance *rtpi = @@ -124,6 +125,7 @@ void PluginXml::setParameters(const QXmlAttributes &attrs) { + CHECK_ATTRIBUTE(identifier, m_plugin->getIdentifier); CHECK_ATTRIBUTE(name, m_plugin->getName); CHECK_ATTRIBUTE(description, m_plugin->getDescription); CHECK_ATTRIBUTE(maker, m_plugin->getMaker); @@ -166,21 +168,23 @@ for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); i != parameters.end(); ++i) { - QString name = QString("param-%1") + QString pname = QString("param-%1") .arg(stripInvalidParameterNameCharacters - (QString(i->name.c_str()))); + (QString(i->identifier.c_str()))); - if (attrs.value(name) == "") { + if (attrs.value(pname) == "") { // std::cerr << "PluginXml::setParameters: no parameter \"" << i->name << "\" (attribute \"" << name.toStdString() << "\")" << std::endl; continue; } bool ok; - float value = attrs.value(name).trimmed().toFloat(&ok); + float value = attrs.value(pname).trimmed().toFloat(&ok); if (ok) { - m_plugin->setParameter(i->name, value); + std::cerr << "PluginXml::setParameters: setting parameter \"" + << i->identifier << "\" to value " << value << std::endl; + m_plugin->setParameter(i->identifier, value); } else { - std::cerr << "WARNING: PluginXml::setParameters: Invalid value \"" << attrs.value(name).toStdString() << "\" for parameter \"" << i->name << "\" (attribute \"" << name.toStdString() << "\")" << std::endl; + std::cerr << "WARNING: PluginXml::setParameters: Invalid value \"" << attrs.value(pname).toStdString() << "\" for parameter \"" << i->identifier << "\" (attribute \"" << pname.toStdString() << "\")" << std::endl; } } }
--- a/plugin/RealTimePluginInstance.cpp Mon Feb 26 20:08:51 2007 +0000 +++ b/plugin/RealTimePluginInstance.cpp Tue Feb 27 12:51:38 2007 +0000 @@ -37,12 +37,3 @@ } } -std::string -RealTimePluginInstance::getIdentifier() const -{ - QString plid = getPluginIdentifier(); - QString type, soname, label; - PluginIdentifier::parseIdentifier(plid, type, soname, label); - return label.toStdString(); -} -
--- a/plugin/RealTimePluginInstance.h Mon Feb 26 20:08:51 2007 +0000 +++ b/plugin/RealTimePluginInstance.h Tue Feb 27 12:51:38 2007 +0000 @@ -82,7 +82,6 @@ virtual bool isOK() const = 0; virtual QString getPluginIdentifier() const = 0; - virtual std::string getIdentifier() const; /** * Run for one block, starting at the given time. The start time