Mercurial > hg > svcore
diff plugin/LADSPAPluginFactory.cpp @ 1429:48e9f538e6e9
Untabify
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2018 18:02:22 +0000 |
parents | 75aefcc9f07d |
children | 91bb68146dfc |
line wrap: on
line diff
--- a/plugin/LADSPAPluginFactory.cpp Thu Mar 01 14:43:40 2018 +0000 +++ b/plugin/LADSPAPluginFactory.cpp Thu Mar 01 18:02:22 2018 +0000 @@ -51,9 +51,9 @@ LADSPAPluginFactory::~LADSPAPluginFactory() { for (std::set<RealTimePluginInstance *>::iterator i = m_instances.begin(); - i != m_instances.end(); ++i) { - (*i)->setFactory(0); - delete *i; + i != m_instances.end(); ++i) { + (*i)->setFactory(0); + delete *i; } m_instances.clear(); unloadUnusedLibraries(); @@ -75,62 +75,62 @@ Profiler profiler("LADSPAPluginFactory::enumeratePlugins"); for (std::vector<QString>::iterator i = m_identifiers.begin(); - i != m_identifiers.end(); ++i) { + i != m_identifiers.end(); ++i) { - const LADSPA_Descriptor *descriptor = getLADSPADescriptor(*i); + const LADSPA_Descriptor *descriptor = getLADSPADescriptor(*i); - if (!descriptor) { - cerr << "WARNING: LADSPAPluginFactory::enumeratePlugins: couldn't get descriptor for identifier " << *i << endl; - continue; - } - - list.push_back(*i); - list.push_back(descriptor->Name); - list.push_back(QString("%1").arg(descriptor->UniqueID)); - list.push_back(descriptor->Label); - list.push_back(descriptor->Maker); - list.push_back(descriptor->Copyright); - list.push_back("false"); // is synth - list.push_back("false"); // is grouped + if (!descriptor) { + cerr << "WARNING: LADSPAPluginFactory::enumeratePlugins: couldn't get descriptor for identifier " << *i << endl; + continue; + } + + list.push_back(*i); + list.push_back(descriptor->Name); + list.push_back(QString("%1").arg(descriptor->UniqueID)); + list.push_back(descriptor->Label); + list.push_back(descriptor->Maker); + list.push_back(descriptor->Copyright); + list.push_back("false"); // is synth + list.push_back("false"); // is grouped - if (m_taxonomy.find(*i) != m_taxonomy.end() && m_taxonomy[*i] != "") { -// cerr << "LADSPAPluginFactory: cat for " << *i << " found in taxonomy as " << m_taxonomy[descriptor->UniqueID] << endl; - list.push_back(m_taxonomy[*i]); - } else { - list.push_back(""); -// cerr << "LADSPAPluginFactory: cat for " << *i << " not found (despite having " << m_fallbackCategories.size() << " fallbacks)" << endl; - - } + if (m_taxonomy.find(*i) != m_taxonomy.end() && m_taxonomy[*i] != "") { +// cerr << "LADSPAPluginFactory: cat for " << *i << " found in taxonomy as " << m_taxonomy[descriptor->UniqueID] << endl; + list.push_back(m_taxonomy[*i]); + } else { + list.push_back(""); +// cerr << "LADSPAPluginFactory: cat for " << *i << " not found (despite having " << m_fallbackCategories.size() << " fallbacks)" << endl; + + } - list.push_back(QString("%1").arg(descriptor->PortCount)); + list.push_back(QString("%1").arg(descriptor->PortCount)); - for (int p = 0; p < (int)descriptor->PortCount; ++p) { + for (int p = 0; p < (int)descriptor->PortCount; ++p) { - int type = 0; - if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[p])) { - type |= PortType::Control; - } else { - type |= PortType::Audio; - } - if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[p])) { - type |= PortType::Input; - } else { - type |= PortType::Output; - } + int type = 0; + if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[p])) { + type |= PortType::Control; + } else { + type |= PortType::Audio; + } + if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[p])) { + type |= PortType::Input; + } else { + type |= PortType::Output; + } - list.push_back(QString("%1").arg(p)); - list.push_back(descriptor->PortNames[p]); - list.push_back(QString("%1").arg(type)); - list.push_back(QString("%1").arg(getPortDisplayHint(descriptor, p))); - list.push_back(QString("%1").arg(getPortMinimum(descriptor, p))); - list.push_back(QString("%1").arg(getPortMaximum(descriptor, p))); - list.push_back(QString("%1").arg(getPortDefault(descriptor, p))); - } + list.push_back(QString("%1").arg(p)); + list.push_back(descriptor->PortNames[p]); + list.push_back(QString("%1").arg(type)); + list.push_back(QString("%1").arg(getPortDisplayHint(descriptor, p))); + list.push_back(QString("%1").arg(getPortMinimum(descriptor, p))); + list.push_back(QString("%1").arg(getPortMaximum(descriptor, p))); + list.push_back(QString("%1").arg(getPortDefault(descriptor, p))); + } } unloadUnusedLibraries(); } - + const RealTimePluginDescriptor * LADSPAPluginFactory::getPluginDescriptor(QString identifier) const { @@ -148,20 +148,20 @@ LADSPAPluginFactory::getPortMinimum(const LADSPA_Descriptor *descriptor, int port) { LADSPA_PortRangeHintDescriptor d = - descriptor->PortRangeHints[port].HintDescriptor; + descriptor->PortRangeHints[port].HintDescriptor; float minimum = 0.f; - + if (LADSPA_IS_HINT_BOUNDED_BELOW(d)) { - float lb = descriptor->PortRangeHints[port].LowerBound; - minimum = lb; + float lb = descriptor->PortRangeHints[port].LowerBound; + minimum = lb; } else if (LADSPA_IS_HINT_BOUNDED_ABOVE(d)) { - float ub = descriptor->PortRangeHints[port].UpperBound; - minimum = std::min(0.f, ub - 1.f); + float ub = descriptor->PortRangeHints[port].UpperBound; + minimum = std::min(0.f, ub - 1.f); } if (LADSPA_IS_HINT_SAMPLE_RATE(d)) { - minimum = float(minimum * m_sampleRate); + minimum = float(minimum * m_sampleRate); } if (LADSPA_IS_HINT_LOGARITHMIC(d)) { @@ -175,20 +175,20 @@ LADSPAPluginFactory::getPortMaximum(const LADSPA_Descriptor *descriptor, int port) { LADSPA_PortRangeHintDescriptor d = - descriptor->PortRangeHints[port].HintDescriptor; + descriptor->PortRangeHints[port].HintDescriptor; float maximum = 1.f; if (LADSPA_IS_HINT_BOUNDED_ABOVE(d)) { - float ub = descriptor->PortRangeHints[port].UpperBound; - maximum = ub; + float ub = descriptor->PortRangeHints[port].UpperBound; + maximum = ub; } else { - float lb = descriptor->PortRangeHints[port].LowerBound; - maximum = lb + 1.f; + float lb = descriptor->PortRangeHints[port].LowerBound; + maximum = lb + 1.f; } if (LADSPA_IS_HINT_SAMPLE_RATE(d)) { - maximum = float(maximum * m_sampleRate); + maximum = float(maximum * m_sampleRate); } return maximum; @@ -202,19 +202,19 @@ float deft; if (m_portDefaults.find(descriptor->UniqueID) != - m_portDefaults.end()) { - if (m_portDefaults[descriptor->UniqueID].find(port) != - m_portDefaults[descriptor->UniqueID].end()) { + m_portDefaults.end()) { + if (m_portDefaults[descriptor->UniqueID].find(port) != + m_portDefaults[descriptor->UniqueID].end()) { - deft = m_portDefaults[descriptor->UniqueID][port]; - if (deft < minimum) deft = minimum; - if (deft > maximum) deft = maximum; - return deft; - } + deft = m_portDefaults[descriptor->UniqueID][port]; + if (deft < minimum) deft = minimum; + if (deft > maximum) deft = maximum; + return deft; + } } LADSPA_PortRangeHintDescriptor d = - descriptor->PortRangeHints[port].HintDescriptor; + descriptor->PortRangeHints[port].HintDescriptor; bool logarithmic = LADSPA_IS_HINT_LOGARITHMIC(d); @@ -230,61 +230,61 @@ // SVDEBUG << "LADSPAPluginFactory::getPortDefault: hint = " << d << endl; if (!LADSPA_IS_HINT_HAS_DEFAULT(d)) { - - deft = minimum; - + + deft = minimum; + } else if (LADSPA_IS_HINT_DEFAULT_MINIMUM(d)) { - - deft = minimum; - + + deft = minimum; + } else if (LADSPA_IS_HINT_DEFAULT_LOW(d)) { - - if (logarithmic) { - deft = powf(10, logmin * 0.75f + logmax * 0.25f); - } else { - deft = minimum * 0.75f + maximum * 0.25f; - } - + + if (logarithmic) { + deft = powf(10, logmin * 0.75f + logmax * 0.25f); + } else { + deft = minimum * 0.75f + maximum * 0.25f; + } + } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(d)) { - - if (logarithmic) { - deft = powf(10, logmin * 0.5f + logmax * 0.5f); - } else { - deft = minimum * 0.5f + maximum * 0.5f; - } - + + if (logarithmic) { + deft = powf(10, logmin * 0.5f + logmax * 0.5f); + } else { + deft = minimum * 0.5f + maximum * 0.5f; + } + } else if (LADSPA_IS_HINT_DEFAULT_HIGH(d)) { - - if (logarithmic) { - deft = powf(10, logmin * 0.25f + logmax * 0.75f); - } else { - deft = minimum * 0.25f + maximum * 0.75f; - } - + + if (logarithmic) { + deft = powf(10, logmin * 0.25f + logmax * 0.75f); + } else { + deft = minimum * 0.25f + maximum * 0.75f; + } + } else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(d)) { - - deft = maximum; - + + deft = maximum; + } else if (LADSPA_IS_HINT_DEFAULT_0(d)) { - - deft = 0.0; - + + deft = 0.0; + } else if (LADSPA_IS_HINT_DEFAULT_1(d)) { - - deft = 1.0; - + + deft = 1.0; + } else if (LADSPA_IS_HINT_DEFAULT_100(d)) { - - deft = 100.0; - + + deft = 100.0; + } else if (LADSPA_IS_HINT_DEFAULT_440(d)) { - -// deft = 440.0; + +// deft = 440.0; deft = (float)Preferences::getInstance()->getTuningFrequency(); - + } else { - - deft = minimum; + + deft = minimum; } //!!! No -- the min and max have already been multiplied by the rate, @@ -292,7 +292,7 @@ //doesn't want to be multiplied by the rate either // if (LADSPA_IS_HINT_SAMPLE_RATE(d)) { -// deft *= m_sampleRate; +// deft *= m_sampleRate; // } return deft; @@ -316,7 +316,7 @@ LADSPAPluginFactory::getPortDisplayHint(const LADSPA_Descriptor *descriptor, int port) { LADSPA_PortRangeHintDescriptor d = - descriptor->PortRangeHints[port].HintDescriptor; + descriptor->PortRangeHints[port].HintDescriptor; int hint = PortHint::NoHint; if (LADSPA_IS_HINT_TOGGLED(d)) hint |= PortHint::Toggled; @@ -329,11 +329,11 @@ RealTimePluginInstance * LADSPAPluginFactory::instantiatePlugin(QString identifier, - int instrument, - int position, - sv_samplerate_t sampleRate, - int blockSize, - int channels) + int instrument, + int position, + sv_samplerate_t sampleRate, + int blockSize, + int channels) { Profiler profiler("LADSPAPluginFactory::instantiatePlugin"); @@ -341,19 +341,19 @@ if (descriptor) { - LADSPAPluginInstance *instance = - new LADSPAPluginInstance - (this, instrument, identifier, position, sampleRate, blockSize, channels, - descriptor); + LADSPAPluginInstance *instance = + new LADSPAPluginInstance + (this, instrument, identifier, position, sampleRate, blockSize, channels, + descriptor); - m_instances.insert(instance); + m_instances.insert(instance); #ifdef DEBUG_LADSPA_PLUGIN_FACTORY SVDEBUG << "LADSPAPluginFactory::instantiatePlugin(" << identifier << ": now have " << m_instances.size() << " instances" << endl; #endif - return instance; + return instance; } return 0; @@ -361,14 +361,14 @@ void LADSPAPluginFactory::releasePlugin(RealTimePluginInstance *instance, - QString identifier) + QString identifier) { Profiler profiler("LADSPAPluginFactory::releasePlugin"); if (m_instances.find(instance) == m_instances.end()) { - cerr << "WARNING: LADSPAPluginFactory::releasePlugin: Not one of mine!" - << endl; - return; + cerr << "WARNING: LADSPAPluginFactory::releasePlugin: Not one of mine!" + << endl; + return; } QString type, soname, label; @@ -379,16 +379,16 @@ bool stillInUse = false; for (std::set<RealTimePluginInstance *>::iterator ii = m_instances.begin(); - ii != m_instances.end(); ++ii) { - QString itype, isoname, ilabel; - PluginIdentifier::parseIdentifier((*ii)->getPluginIdentifier(), itype, isoname, ilabel); - if (isoname == soname) { + ii != m_instances.end(); ++ii) { + QString itype, isoname, ilabel; + PluginIdentifier::parseIdentifier((*ii)->getPluginIdentifier(), itype, isoname, ilabel); + if (isoname == soname) { #ifdef DEBUG_LADSPA_PLUGIN_FACTORY - SVDEBUG << "LADSPAPluginFactory::releasePlugin: dll " << soname << " is still in use for plugin " << ilabel << endl; + SVDEBUG << "LADSPAPluginFactory::releasePlugin: dll " << soname << " is still in use for plugin " << ilabel << endl; #endif - stillInUse = true; - break; - } + stillInUse = true; + break; + } } if (!stillInUse) { @@ -413,29 +413,29 @@ PluginIdentifier::parseIdentifier(identifier, type, soname, label); if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { - loadLibrary(soname); - if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { - cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: loadLibrary failed for " << soname << endl; - return 0; - } + loadLibrary(soname); + if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { + cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: loadLibrary failed for " << soname << endl; + return 0; + } } void *libraryHandle = m_libraryHandles[soname]; LADSPA_Descriptor_Function fn = (LADSPA_Descriptor_Function) - DLSYM(libraryHandle, "ladspa_descriptor"); + DLSYM(libraryHandle, "ladspa_descriptor"); if (!fn) { - cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No descriptor function in library " << soname << endl; - return 0; + cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No descriptor function in library " << soname << endl; + return 0; } const LADSPA_Descriptor *descriptor = 0; int index = 0; while ((descriptor = fn(index))) { - if (descriptor->Label == label) return descriptor; - ++index; + if (descriptor->Label == label) return descriptor; + ++index; } cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No such plugin as " << label << " in library " << soname << endl; @@ -465,7 +465,7 @@ QString base = QFileInfo(soName).baseName(); for (std::vector<QString>::iterator i = pathList.begin(); - i != pathList.end(); ++i) { + i != pathList.end(); ++i) { #ifdef DEBUG_LADSPA_PLUGIN_FACTORY SVDEBUG << "Looking at: " << (*i) << endl; @@ -486,7 +486,7 @@ } } - for (unsigned int j = 0; j < dir.count(); ++j) { + for (unsigned int j = 0; j < dir.count(); ++j) { QString file = dir.filePath(dir[j]); if (QFileInfo(file).baseName() == base) { #ifdef DEBUG_LADSPA_PLUGIN_FACTORY @@ -509,9 +509,9 @@ { LibraryHandleMap::iterator li = m_libraryHandles.find(soName); if (li != m_libraryHandles.end()) { -// SVDEBUG << "unloading " << soname << endl; - DLCLOSE(m_libraryHandles[soName]); - m_libraryHandles.erase(li); +// SVDEBUG << "unloading " << soname << endl; + DLCLOSE(m_libraryHandles[soName]); + m_libraryHandles.erase(li); } } @@ -521,26 +521,26 @@ std::vector<QString> toUnload; for (LibraryHandleMap::iterator i = m_libraryHandles.begin(); - i != m_libraryHandles.end(); ++i) { + i != m_libraryHandles.end(); ++i) { - bool stillInUse = false; + bool stillInUse = false; - for (std::set<RealTimePluginInstance *>::iterator ii = m_instances.begin(); - ii != m_instances.end(); ++ii) { + for (std::set<RealTimePluginInstance *>::iterator ii = m_instances.begin(); + ii != m_instances.end(); ++ii) { - QString itype, isoname, ilabel; - PluginIdentifier::parseIdentifier((*ii)->getPluginIdentifier(), itype, isoname, ilabel); - if (isoname == i->first) { - stillInUse = true; - break; - } - } + QString itype, isoname, ilabel; + PluginIdentifier::parseIdentifier((*ii)->getPluginIdentifier(), itype, isoname, ilabel); + if (isoname == i->first) { + stillInUse = true; + break; + } + } - if (!stillInUse) toUnload.push_back(i->first); + if (!stillInUse) toUnload.push_back(i->first); } for (std::vector<QString>::iterator i = toUnload.begin(); - i != toUnload.end(); ++i) { + i != toUnload.end(); ++i) { if (*i != PluginIdentifier::BUILTIN_PLUGIN_SONAME) { unloadLibrary(*i); } @@ -569,8 +569,8 @@ path = DEFAULT_LADSPA_PATH; - char *home = getenv("HOME"); - if (home) { + char *home = getenv("HOME"); + if (home) { std::string::size_type f; while ((f = path.find("$HOME")) != std::string::npos && f < path.length()) { @@ -594,8 +594,8 @@ std::string::size_type index = 0, newindex = 0; while ((newindex = path.find(PATH_SEPARATOR, index)) < path.size()) { - pathList.push_back(path.substr(index, newindex - index).c_str()); - index = newindex + 1; + pathList.push_back(path.substr(index, newindex - index).c_str()); + index = newindex + 1; } pathList.push_back(path.substr(index).c_str()); @@ -616,8 +616,8 @@ lrdfPaths.push_back("/usr/share/ladspa/rdf"); for (std::vector<QString>::iterator i = pathList.begin(); - i != pathList.end(); ++i) { - lrdfPaths.push_back(*i + "/rdf"); + i != pathList.end(); ++i) { + lrdfPaths.push_back(*i + "/rdf"); } baseUri = LADSPA_BASE; @@ -636,10 +636,10 @@ std::vector<QString> pathList = getPluginPath(); // SVDEBUG << "LADSPAPluginFactory::discoverPlugins - " -// << "discovering plugins; path is "; +// << "discovering plugins; path is "; // for (std::vector<QString>::iterator i = pathList.begin(); -// i != pathList.end(); ++i) { -// SVDEBUG << "[" << i-<< "] "; +// i != pathList.end(); ++i) { +// SVDEBUG << "[" << i-<< "] "; // } // SVDEBUG << endl; @@ -652,17 +652,17 @@ bool haveSomething = false; for (size_t i = 0; i < lrdfPaths.size(); ++i) { - QDir dir(lrdfPaths[i], "*.rdf;*.rdfs"); - for (unsigned int j = 0; j < dir.count(); ++j) { - if (!lrdf_read_file(QString("file:" + lrdfPaths[i] + "/" + dir[j]).toStdString().c_str())) { -// cerr << "LADSPAPluginFactory: read RDF file " << (lrdfPaths[i] + "/" + dir[j]) << endl; - haveSomething = true; - } - } + QDir dir(lrdfPaths[i], "*.rdf;*.rdfs"); + for (unsigned int j = 0; j < dir.count(); ++j) { + if (!lrdf_read_file(QString("file:" + lrdfPaths[i] + "/" + dir[j]).toStdString().c_str())) { +// cerr << "LADSPAPluginFactory: read RDF file " << (lrdfPaths[i] + "/" + dir[j]) << endl; + haveSomething = true; + } + } } if (haveSomething) { - generateTaxonomy(baseUri + "Plugin", ""); + generateTaxonomy(baseUri + "Plugin", ""); } #endif // HAVE_LRDF @@ -688,11 +688,11 @@ } LADSPA_Descriptor_Function fn = (LADSPA_Descriptor_Function) - DLSYM(libraryHandle, "ladspa_descriptor"); + DLSYM(libraryHandle, "ladspa_descriptor"); if (!fn) { - cerr << "WARNING: LADSPAPluginFactory::discoverPlugins: No descriptor function in " << soname << endl; - return; + cerr << "WARNING: LADSPAPluginFactory::discoverPlugins: No descriptor function in " << soname << endl; + return; } const LADSPA_Descriptor *descriptor = 0; @@ -712,67 +712,67 @@ rtd->audioOutputPortCount = 0; rtd->controlOutputPortCount = 0; - QString identifier = PluginIdentifier::createIdentifier - ("ladspa", soname, descriptor->Label); + QString identifier = PluginIdentifier::createIdentifier + ("ladspa", soname, descriptor->Label); #ifdef HAVE_LRDF - char *def_uri = 0; - lrdf_defaults *defs = 0; - + char *def_uri = 0; + lrdf_defaults *defs = 0; + if (m_lrdfTaxonomy[descriptor->UniqueID] != "") { m_taxonomy[identifier] = m_lrdfTaxonomy[descriptor->UniqueID]; // cerr << "set id \"" << identifier << "\" to cat \"" << m_taxonomy[identifier] << "\" from LRDF" << endl; // cout << identifier << "::" << m_taxonomy[identifier] << endl; } - QString category = m_taxonomy[identifier]; - - if (category == "") { - std::string name = rtd->name; - if (name.length() > 4 && - name.substr(name.length() - 4) == " VST") { - category = "VST effects"; - m_taxonomy[identifier] = category; - } - } - + QString category = m_taxonomy[identifier]; + + if (category == "") { + std::string name = rtd->name; + if (name.length() > 4 && + name.substr(name.length() - 4) == " VST") { + category = "VST effects"; + m_taxonomy[identifier] = category; + } + } + rtd->category = category.toStdString(); -// cerr << "Plugin id is " << descriptor->UniqueID -// << ", category is \"" << (category ? category : QString("(none)")) -// << "\", name is " << descriptor->Name -// << ", label is " << descriptor->Label -// << endl; - - def_uri = lrdf_get_default_uri(descriptor->UniqueID); - if (def_uri) { - defs = lrdf_get_setting_values(def_uri); - } +// cerr << "Plugin id is " << descriptor->UniqueID +// << ", category is \"" << (category ? category : QString("(none)")) +// << "\", name is " << descriptor->Name +// << ", label is " << descriptor->Label +// << endl; + + def_uri = lrdf_get_default_uri(descriptor->UniqueID); + if (def_uri) { + defs = lrdf_get_setting_values(def_uri); + } - unsigned int controlPortNumber = 1; - - for (int i = 0; i < (int)descriptor->PortCount; i++) { - - if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i])) { - - if (def_uri && defs) { - - for (unsigned int j = 0; j < defs->count; j++) { - if (defs->items[j].pid == controlPortNumber) { -// cerr << "Default for this port (" << defs->items[j].pid << ", " << defs->items[j].label << ") is " << defs->items[j].value << "; applying this to port number " << i << " with name " << descriptor->PortNames[i] << endl; - m_portDefaults[descriptor->UniqueID][i] = - defs->items[j].value; - } - } - } - - ++controlPortNumber; - } - } + unsigned int controlPortNumber = 1; + + for (int i = 0; i < (int)descriptor->PortCount; i++) { + + if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i])) { + + if (def_uri && defs) { + + for (unsigned int j = 0; j < defs->count; j++) { + if (defs->items[j].pid == controlPortNumber) { +// cerr << "Default for this port (" << defs->items[j].pid << ", " << defs->items[j].label << ") is " << defs->items[j].value << "; applying this to port number " << i << " with name " << descriptor->PortNames[i] << endl; + m_portDefaults[descriptor->UniqueID][i] = + defs->items[j].value; + } + } + } + + ++controlPortNumber; + } + } #endif // HAVE_LRDF - for (int i = 0; i < (int)descriptor->PortCount; i++) { - if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i])) { + for (int i = 0; i < (int)descriptor->PortCount; i++) { + if (LADSPA_IS_PORT_CONTROL(descriptor->PortDescriptors[i])) { if (LADSPA_IS_PORT_INPUT(descriptor->PortDescriptors[i])) { ++rtd->parameterCount; } else { @@ -792,11 +792,11 @@ } } - m_identifiers.push_back(identifier); + m_identifiers.push_back(identifier); m_rtDescriptors[identifier] = rtd; - ++index; + ++index; } if (DLCLOSE(libraryHandle) != 0) { @@ -812,44 +812,44 @@ std::vector<QString> path; for (size_t i = 0; i < pluginPath.size(); ++i) { - if (pluginPath[i].contains("/lib/")) { - QString p(pluginPath[i]); + if (pluginPath[i].contains("/lib/")) { + QString p(pluginPath[i]); path.push_back(p); - p.replace("/lib/", "/share/"); - path.push_back(p); -// SVDEBUG << "LADSPAPluginFactory::generateFallbackCategories: path element " << p << endl; - } - path.push_back(pluginPath[i]); -// SVDEBUG << "LADSPAPluginFactory::generateFallbackCategories: path element " << pluginPath[i] << endl; + p.replace("/lib/", "/share/"); + path.push_back(p); +// SVDEBUG << "LADSPAPluginFactory::generateFallbackCategories: path element " << p << endl; + } + path.push_back(pluginPath[i]); +// SVDEBUG << "LADSPAPluginFactory::generateFallbackCategories: path element " << pluginPath[i] << endl; } for (size_t i = 0; i < path.size(); ++i) { - QDir dir(path[i], "*.cat"); + QDir dir(path[i], "*.cat"); -// SVDEBUG << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i] << " has " << dir.count() << " .cat files" << endl; - for (unsigned int j = 0; j < dir.count(); ++j) { +// SVDEBUG << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i] << " has " << dir.count() << " .cat files" << endl; + for (unsigned int j = 0; j < dir.count(); ++j) { - QFile file(path[i] + "/" + dir[j]); + QFile file(path[i] + "/" + dir[j]); -// SVDEBUG << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i]+ "/" + dir[j]) << endl; +// SVDEBUG << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i]+ "/" + dir[j]) << endl; - if (file.open(QIODevice::ReadOnly)) { -// cerr << "...opened" << endl; - QTextStream stream(&file); - QString line; + if (file.open(QIODevice::ReadOnly)) { +// cerr << "...opened" << endl; + QTextStream stream(&file); + QString line; - while (!stream.atEnd()) { - line = stream.readLine(); -// cerr << "line is: \"" << line << "\"" << endl; - QString id = PluginIdentifier::canonicalise + while (!stream.atEnd()) { + line = stream.readLine(); +// cerr << "line is: \"" << line << "\"" << endl; + QString id = PluginIdentifier::canonicalise (line.section("::", 0, 0)); - QString cat = line.section("::", 1, 1); - m_taxonomy[id] = cat; -// cerr << "set id \"" << id << "\" to cat \"" << cat << "\"" << endl; - } - } - } + QString cat = line.section("::", 1, 1); + m_taxonomy[id] = cat; +// cerr << "set id \"" << id << "\" to cat \"" << cat << "\"" << endl; + } + } + } } } @@ -860,21 +860,21 @@ lrdf_uris *uris = lrdf_get_instances(uri.toStdString().c_str()); if (uris != NULL) { - for (unsigned int i = 0; i < uris->count; ++i) { - m_lrdfTaxonomy[lrdf_get_uid(uris->items[i])] = base; - } - lrdf_free_uris(uris); + for (unsigned int i = 0; i < uris->count; ++i) { + m_lrdfTaxonomy[lrdf_get_uid(uris->items[i])] = base; + } + lrdf_free_uris(uris); } uris = lrdf_get_subclasses(uri.toStdString().c_str()); if (uris != NULL) { - for (unsigned int i = 0; i < uris->count; ++i) { - char *label = lrdf_get_label(uris->items[i]); - generateTaxonomy(uris->items[i], - base + (base.length() > 0 ? " > " : "") + label); - } - lrdf_free_uris(uris); + for (unsigned int i = 0; i < uris->count; ++i) { + char *label = lrdf_get_label(uris->items[i]); + generateTaxonomy(uris->items[i], + base + (base.length() > 0 ? " > " : "") + label); + } + lrdf_free_uris(uris); } #else // avoid unused parameter