Mercurial > hg > svcore
diff plugin/LADSPAPluginInstance.cpp @ 166:702fc936e6a6
* 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 | c30728d5625c |
children | 570794f6f6a7 |
line wrap: on
line diff
--- a/plugin/LADSPAPluginInstance.cpp Thu Sep 21 16:43:50 2006 +0000 +++ b/plugin/LADSPAPluginInstance.cpp Fri Sep 22 16:12:23 2006 +0000 @@ -24,6 +24,10 @@ #include "LADSPAPluginInstance.h" #include "LADSPAPluginFactory.h" +#ifdef HAVE_LRDF +#include "lrdf.h" +#endif // HAVE_LRDF + //#define DEBUG_LADSPA 1 @@ -122,6 +126,45 @@ pd.quantizeStep = q; } + bool haveLabels = false; + +#ifdef HAVE_LRDF + if (pd.isQuantized && pd.quantizeStep == 1.0) { + + lrdf_defaults *defaults = + lrdf_get_scale_values(m_descriptor->UniqueID, pn); + + if (defaults) { + if (defaults->count > 0) { + std::map<int, std::string> values; + int v = 0; + for (size_t i = 0; i < defaults->count; ++i) { + v = defaults->items[i].value; + values[v] = defaults->items[i].label; + } + for (size_t i = 0; i <= v; ++i) { + pd.valueNames.push_back(values[i]); + } + haveLabels = true; + } + lrdf_free_setting_values(defaults); + } + } +#endif + + if (haveLabels) { + pd.description = QString(pd.description.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()) + .replace(unitRE, "").toStdString(); + } + } + list.push_back(pd); }