comparison 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
comparison
equal deleted inserted replaced
165:5ae5885d6ce3 166:702fc936e6a6
21 #include <iostream> 21 #include <iostream>
22 #include <cassert> 22 #include <cassert>
23 23
24 #include "LADSPAPluginInstance.h" 24 #include "LADSPAPluginInstance.h"
25 #include "LADSPAPluginFactory.h" 25 #include "LADSPAPluginFactory.h"
26
27 #ifdef HAVE_LRDF
28 #include "lrdf.h"
29 #endif // HAVE_LRDF
26 30
27 //#define DEBUG_LADSPA 1 31 //#define DEBUG_LADSPA 1
28 32
29 33
30 LADSPAPluginInstance::LADSPAPluginInstance(RealTimePluginFactory *factory, 34 LADSPAPluginInstance::LADSPAPluginInstance(RealTimePluginFactory *factory,
120 } else { 124 } else {
121 pd.isQuantized = true; 125 pd.isQuantized = true;
122 pd.quantizeStep = q; 126 pd.quantizeStep = q;
123 } 127 }
124 128
129 bool haveLabels = false;
130
131 #ifdef HAVE_LRDF
132 if (pd.isQuantized && pd.quantizeStep == 1.0) {
133
134 lrdf_defaults *defaults =
135 lrdf_get_scale_values(m_descriptor->UniqueID, pn);
136
137 if (defaults) {
138 if (defaults->count > 0) {
139 std::map<int, std::string> values;
140 int v = 0;
141 for (size_t i = 0; i < defaults->count; ++i) {
142 v = defaults->items[i].value;
143 values[v] = defaults->items[i].label;
144 }
145 for (size_t i = 0; i <= v; ++i) {
146 pd.valueNames.push_back(values[i]);
147 }
148 haveLabels = true;
149 }
150 lrdf_free_setting_values(defaults);
151 }
152 }
153 #endif
154
155 if (haveLabels) {
156 pd.description = QString(pd.description.c_str())
157 .replace(QRegExp("\\([^\\(\\)]+=[^\\(\\)]+\\)$"), "")
158 .toStdString();
159 } else {
160 static QRegExp unitRE("[\\[\\(]([A-Za-z0-9/]+)[\\)\\]]$");
161 if (unitRE.indexIn(pd.name.c_str()) >= 0) {
162 pd.unit = unitRE.cap(1).toStdString();
163 pd.description = QString(pd.description.c_str())
164 .replace(unitRE, "").toStdString();
165 }
166 }
167
125 list.push_back(pd); 168 list.push_back(pd);
126 } 169 }
127 170
128 return list; 171 return list;
129 } 172 }