Mercurial > hg > sonic-visualiser
diff transform/TransformFactory.cpp @ 34:8ad306d8a568
* Pull transforms out of Layer menu (again) and into a separate Transforms
menu
* Add Recent Transforms submenu
* Add effects and generators to the transforms menu (not yet implemented)
as well as analysis plugins and data-from-effects (control output ports)
* Add a nice dictionary-volume-style alphabetic subdivision of plugin names
in plugins By Name menus
author | Chris Cannam |
---|---|
date | Fri, 22 Sep 2006 16:12:23 +0000 |
parents | 544ab25d2372 |
children | 06787742542a |
line wrap: on
line diff
--- a/transform/TransformFactory.cpp Thu Sep 21 16:43:50 2006 +0000 +++ b/transform/TransformFactory.cpp Fri Sep 22 16:12:23 2006 +0000 @@ -51,10 +51,16 @@ { if (m_transforms.empty()) populateTransforms(); - TransformList list; + std::set<TransformDesc> dset; for (TransformDescriptionMap::const_iterator i = m_transforms.begin(); i != m_transforms.end(); ++i) { - list.push_back(i->second); + dset.insert(i->second); + } + + TransformList list; + for (std::set<TransformDesc>::const_iterator i = dset.begin(); + i != dset.end(); ++i) { + list.push_back(*i); } return list; @@ -233,7 +239,7 @@ !plugin->getParameterDescriptors().empty()); transforms[transformName] = - TransformDesc(tr("Analysis Plugins"), + TransformDesc(tr("Analysis"), category, transformName, userDescription, @@ -251,7 +257,7 @@ std::vector<QString> plugs = RealTimePluginFactory::getAllPluginIdentifiers(); - QRegExp unitRE("[\\[\\(]([A-Za-z0-9/]+)[\\)\\]]$"); + static QRegExp unitRE("[\\[\\(]([A-Za-z0-9/]+)[\\)\\]]$"); for (size_t i = 0; i < plugs.size(); ++i) { @@ -273,57 +279,81 @@ continue; } - if (descriptor->controlOutputPortCount == 0 || - descriptor->audioInputPortCount == 0) continue; +//!!! if (descriptor->controlOutputPortCount == 0 || +// descriptor->audioInputPortCount == 0) continue; -// std::cout << "TransformFactory::populateRealTimePlugins: plugin " << pluginId.toStdString() << " has " << descriptor->controlOutputPortCount << " output ports" << std::endl; + std::cout << "TransformFactory::populateRealTimePlugins: plugin " << pluginId.toStdString() << " has " << descriptor->controlOutputPortCount << " control output ports, " << descriptor->audioOutputPortCount << " audio outputs, " << descriptor->audioInputPortCount << " audio inputs" << std::endl; QString pluginDescription = descriptor->name.c_str(); QString category = factory->getPluginCategory(pluginId); + bool configurable = (descriptor->parameterCount > 0); - for (size_t j = 0; j < descriptor->controlOutputPortCount; ++j) { + if (descriptor->audioInputPortCount > 0) { - QString transformName = QString("%1:%2").arg(pluginId).arg(j); - QString userDescription; - QString units; + for (size_t j = 0; j < descriptor->controlOutputPortCount; ++j) { - if (j < descriptor->controlOutputPortNames.size() && - descriptor->controlOutputPortNames[j] != "") { + QString transformName = QString("%1:%2").arg(pluginId).arg(j); + QString userDescription; + QString units; - QString portName = descriptor->controlOutputPortNames[j].c_str(); + if (j < descriptor->controlOutputPortNames.size() && + descriptor->controlOutputPortNames[j] != "") { - userDescription = tr("%1: %2") - .arg(pluginDescription) - .arg(portName); + QString portName = descriptor->controlOutputPortNames[j].c_str(); - if (unitRE.indexIn(portName) >= 0) { - units = unitRE.cap(1); + userDescription = tr("%1: %2") + .arg(pluginDescription) + .arg(portName); + + if (unitRE.indexIn(portName) >= 0) { + units = unitRE.cap(1); + } + + } else if (descriptor->controlOutputPortCount > 1) { + + userDescription = tr("%1: Output %2") + .arg(pluginDescription) + .arg(j + 1); + + } else { + + userDescription = pluginDescription; } - } else if (descriptor->controlOutputPortCount > 1) { - userDescription = tr("%1: Output %2") - .arg(pluginDescription) - .arg(j + 1); + transforms[transformName] = + TransformDesc(tr("Effects Measurements"), + category, + transformName, + userDescription, + userDescription, + descriptor->maker.c_str(), + units, + configurable); + } + } - } else { + if (!descriptor->isSynth || descriptor->audioInputPortCount > 0) { - userDescription = pluginDescription; + if (descriptor->audioOutputPortCount > 0) { + + QString transformName = QString("%1:A").arg(pluginId); + QString type = tr("Effects"); + if (descriptor->audioInputPortCount == 0) { + type = tr("Generators"); + } + + transforms[transformName] = + TransformDesc(type, + category, + transformName, + pluginDescription, + pluginDescription, + descriptor->maker.c_str(), + "", + configurable); } - - - bool configurable = (descriptor->parameterCount > 0); - - transforms[transformName] = - TransformDesc(tr("Other Plugins"), - category, - transformName, - userDescription, - userDescription, - descriptor->maker.c_str(), - units, - configurable); - } + } } } @@ -516,6 +546,7 @@ context, configurationXml, getTransformUnits(name), + output == "A" ? -1 : output.toInt()); } else { std::cerr << "TransformFactory::createTransform: Unknown transform \""