comparison plugin/LADSPAPluginInstance.cpp @ 239:71f869dac40b

* Further fixes for Vamp API change, and update to support API versioning * Add plugin, output and parameter descriptions to GUI * Avoid squished panner in heads-up-display on pane when time-value or note layer is on top
author Chris Cannam
date Tue, 27 Feb 2007 12:51:38 +0000
parents 91fdc752e540
children 2f7d27648806
comparison
equal deleted inserted replaced
238:76635085e2d9 239:71f869dac40b
79 activate(); 79 activate();
80 } 80 }
81 } 81 }
82 82
83 std::string 83 std::string
84 LADSPAPluginInstance::getIdentifier() const
85 {
86 return m_descriptor->Label;
87 }
88
89 std::string
84 LADSPAPluginInstance::getName() const 90 LADSPAPluginInstance::getName() const
85 { 91 {
86 return m_descriptor->Label; 92 return m_descriptor->Name;
87 } 93 }
88 94
89 std::string 95 std::string
90 LADSPAPluginInstance::getDescription() const 96 LADSPAPluginInstance::getDescription() const
91 { 97 {
92 return m_descriptor->Name; 98 return "";
93 } 99 }
94 100
95 std::string 101 std::string
96 LADSPAPluginInstance::getMaker() const 102 LADSPAPluginInstance::getMaker() const
97 { 103 {
119 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { 125 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
120 126
121 ParameterDescriptor pd; 127 ParameterDescriptor pd;
122 unsigned int pn = m_controlPortsIn[i].first; 128 unsigned int pn = m_controlPortsIn[i].first;
123 129
124 pd.name = m_descriptor->PortNames[pn]; 130 pd.identifier = m_descriptor->PortNames[pn];
125 pd.description = pd.name; 131 pd.name = pd.identifier;
132 pd.description = "";
126 pd.minValue = f->getPortMinimum(m_descriptor, pn); 133 pd.minValue = f->getPortMinimum(m_descriptor, pn);
127 pd.maxValue = f->getPortMaximum(m_descriptor, pn); 134 pd.maxValue = f->getPortMaximum(m_descriptor, pn);
128 pd.defaultValue = f->getPortDefault(m_descriptor, pn); 135 pd.defaultValue = f->getPortDefault(m_descriptor, pn);
129 136
130 float q = f->getPortQuantization(m_descriptor, pn); 137 float q = f->getPortQuantization(m_descriptor, pn);
160 } 167 }
161 } 168 }
162 #endif 169 #endif
163 170
164 if (haveLabels) { 171 if (haveLabels) {
165 pd.description = QString(pd.description.c_str()) 172 pd.name = QString(pd.name.c_str())
166 .replace(QRegExp("\\([^\\(\\)]+=[^\\(\\)]+\\)$"), "") 173 .replace(QRegExp("\\([^\\(\\)]+=[^\\(\\)]+\\)$"), "")
167 .toStdString(); 174 .toStdString();
168 } else { 175 } else {
169 static QRegExp unitRE("[\\[\\(]([A-Za-z0-9/]+)[\\)\\]]$"); 176 static QRegExp unitRE("[\\[\\(]([A-Za-z0-9/]+)[\\)\\]]$");
170 if (unitRE.indexIn(pd.name.c_str()) >= 0) { 177 if (unitRE.indexIn(pd.name.c_str()) >= 0) {
171 pd.unit = unitRE.cap(1).toStdString(); 178 pd.unit = unitRE.cap(1).toStdString();
172 pd.description = QString(pd.description.c_str()) 179 pd.name = QString(pd.name.c_str())
173 .replace(unitRE, "").toStdString(); 180 .replace(unitRE, "").toStdString();
174 } 181 }
175 } 182 }
176 183
177 list.push_back(pd); 184 list.push_back(pd);
179 186
180 return list; 187 return list;
181 } 188 }
182 189
183 float 190 float
184 LADSPAPluginInstance::getParameter(std::string name) const 191 LADSPAPluginInstance::getParameter(std::string id) const
185 { 192 {
186 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { 193 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
187 if (name == m_descriptor->PortNames[m_controlPortsIn[i].first]) { 194 if (id == m_descriptor->PortNames[m_controlPortsIn[i].first]) {
188 return getParameterValue(i); 195 return getParameterValue(i);
189 } 196 }
190 } 197 }
191 198
192 return 0.0; 199 return 0.0;
193 } 200 }
194 201
195 void 202 void
196 LADSPAPluginInstance::setParameter(std::string name, float value) 203 LADSPAPluginInstance::setParameter(std::string id, float value)
197 { 204 {
198 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { 205 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
199 if (name == m_descriptor->PortNames[m_controlPortsIn[i].first]) { 206 if (id == m_descriptor->PortNames[m_controlPortsIn[i].first]) {
207 std::cerr << "LADSPAPluginInstance::setParameter: Found id "
208 << id << " at control port " << i << std::endl;
200 setParameterValue(i, value); 209 setParameterValue(i, value);
201 break; 210 break;
202 } 211 }
203 } 212 }
204 } 213 }