comparison plugin/PluginInstance.cpp @ 57:7439f1696314

* Add editing for auralisation plugin parameters and programs * Rename and reorganise the sample plugin sample set
author Chris Cannam
date Thu, 23 Mar 2006 15:49:41 +0000
parents 2157fa46c1e7
children
comparison
equal deleted inserted replaced
56:2157fa46c1e7 57:7439f1696314
89 for (ParameterList::const_iterator i = parameters.begin(); 89 for (ParameterList::const_iterator i = parameters.begin();
90 i != parameters.end(); ++i) { 90 i != parameters.end(); ++i) {
91 QString name = QString("param-%1") 91 QString name = QString("param-%1")
92 .arg(stripInvalidParameterNameCharacters 92 .arg(stripInvalidParameterNameCharacters
93 (QString(i->name.c_str()))); 93 (QString(i->name.c_str())));
94 if (attrs.value(name) == "") {
95 std::cerr << "PluginInstance::setParameters: no parameter \"" << i->name << "\" (attribute \"" << name.toStdString() << "\")" << std::endl;
96 continue;
97 }
94 bool ok; 98 bool ok;
95 float value = attrs.value(name).trimmed().toFloat(&ok); 99 float value = attrs.value(name).trimmed().toFloat(&ok);
96 if (ok) { 100 if (ok) {
97 setParameter(i->name, value); 101 setParameter(i->name, value);
98 } else { 102 } else {
117 std::cerr << "Input ends." << std::endl; 121 std::cerr << "Input ends." << std::endl;
118 return; 122 return;
119 } 123 }
120 124
121 QDomElement pluginElt = doc.firstChildElement("plugin"); 125 QDomElement pluginElt = doc.firstChildElement("plugin");
122
123 if (pluginElt.isNull()) {
124 std::cerr << "pluginElt is null" << std::endl;
125 pluginElt = doc.documentElement();
126 if (pluginElt.isNull()) {
127 std::cerr << "pluginElt is still null" << std::endl;
128 }
129 }
130
131 QDomNamedNodeMap attrNodes = pluginElt.attributes(); 126 QDomNamedNodeMap attrNodes = pluginElt.attributes();
132 QXmlAttributes attrs; 127 QXmlAttributes attrs;
133 128
134 for (int i = 0; i < attrNodes.length(); ++i) { 129 for (int i = 0; i < attrNodes.length(); ++i) {
135 QDomAttr attr = attrNodes.item(i).toAttr(); 130 QDomAttr attr = attrNodes.item(i).toAttr();