comparison plugin/LADSPAPluginInstance.cpp @ 689:573d45e9487b

Merge from debug-output branch
author Chris Cannam
date Tue, 14 Jun 2011 14:47:59 +0100
parents 06f13a3b9e9e
children 1424aa29ae95
comparison
equal deleted inserted replaced
688:be43b2fe68e8 689:573d45e9487b
205 LADSPAPluginInstance::setParameter(std::string id, float value) 205 LADSPAPluginInstance::setParameter(std::string id, float value)
206 { 206 {
207 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { 207 for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
208 if (id == m_descriptor->PortNames[m_controlPortsIn[i].first]) { 208 if (id == m_descriptor->PortNames[m_controlPortsIn[i].first]) {
209 #ifdef DEBUG_LADSPA 209 #ifdef DEBUG_LADSPA
210 std::cerr << "LADSPAPluginInstance::setParameter: Found id " 210 DEBUG << "LADSPAPluginInstance::setParameter: Found id "
211 << id << " at control port " << i << std::endl; 211 << id << " at control port " << i << endl;
212 #endif 212 #endif
213 setParameterValue(i, value); 213 setParameterValue(i, value);
214 break; 214 break;
215 } 215 }
216 } 216 }
218 218
219 void 219 void
220 LADSPAPluginInstance::init(int idealChannelCount) 220 LADSPAPluginInstance::init(int idealChannelCount)
221 { 221 {
222 #ifdef DEBUG_LADSPA 222 #ifdef DEBUG_LADSPA
223 std::cerr << "LADSPAPluginInstance::init(" << idealChannelCount << "): plugin has " 223 DEBUG << "LADSPAPluginInstance::init(" << idealChannelCount << "): plugin has "
224 << m_descriptor->PortCount << " ports" << std::endl; 224 << m_descriptor->PortCount << " ports" << endl;
225 #endif 225 #endif
226 226
227 // Discover ports numbers and identities 227 // Discover ports numbers and identities
228 // 228 //
229 for (unsigned long i = 0; i < m_descriptor->PortCount; ++i) { 229 for (unsigned long i = 0; i < m_descriptor->PortCount; ++i) {
230 230
231 if (LADSPA_IS_PORT_AUDIO(m_descriptor->PortDescriptors[i])) { 231 if (LADSPA_IS_PORT_AUDIO(m_descriptor->PortDescriptors[i])) {
232 232
233 if (LADSPA_IS_PORT_INPUT(m_descriptor->PortDescriptors[i])) { 233 if (LADSPA_IS_PORT_INPUT(m_descriptor->PortDescriptors[i])) {
234 #ifdef DEBUG_LADSPA 234 #ifdef DEBUG_LADSPA
235 std::cerr << "LADSPAPluginInstance::init: port " << i << " is audio in" << std::endl; 235 DEBUG << "LADSPAPluginInstance::init: port " << i << " is audio in" << endl;
236 #endif 236 #endif
237 m_audioPortsIn.push_back(i); 237 m_audioPortsIn.push_back(i);
238 } else { 238 } else {
239 #ifdef DEBUG_LADSPA 239 #ifdef DEBUG_LADSPA
240 std::cerr << "LADSPAPluginInstance::init: port " << i << " is audio out" << std::endl; 240 DEBUG << "LADSPAPluginInstance::init: port " << i << " is audio out" << endl;
241 #endif 241 #endif
242 m_audioPortsOut.push_back(i); 242 m_audioPortsOut.push_back(i);
243 } 243 }
244 244
245 } else if (LADSPA_IS_PORT_CONTROL(m_descriptor->PortDescriptors[i])) { 245 } else if (LADSPA_IS_PORT_CONTROL(m_descriptor->PortDescriptors[i])) {
246 246
247 if (LADSPA_IS_PORT_INPUT(m_descriptor->PortDescriptors[i])) { 247 if (LADSPA_IS_PORT_INPUT(m_descriptor->PortDescriptors[i])) {
248 248
249 #ifdef DEBUG_LADSPA 249 #ifdef DEBUG_LADSPA
250 std::cerr << "LADSPAPluginInstance::init: port " << i << " is control in" << std::endl; 250 DEBUG << "LADSPAPluginInstance::init: port " << i << " is control in" << endl;
251 #endif 251 #endif
252 LADSPA_Data *data = new LADSPA_Data(0.0); 252 LADSPA_Data *data = new LADSPA_Data(0.0);
253 m_controlPortsIn.push_back( 253 m_controlPortsIn.push_back(
254 std::pair<unsigned long, LADSPA_Data*>(i, data)); 254 std::pair<unsigned long, LADSPA_Data*>(i, data));
255 255
256 } else { 256 } else {
257 257
258 #ifdef DEBUG_LADSPA 258 #ifdef DEBUG_LADSPA
259 std::cerr << "LADSPAPluginInstance::init: port " << i << " is control out" << std::endl; 259 DEBUG << "LADSPAPluginInstance::init: port " << i << " is control out" << endl;
260 #endif 260 #endif
261 LADSPA_Data *data = new LADSPA_Data(0.0); 261 LADSPA_Data *data = new LADSPA_Data(0.0);
262 m_controlPortsOut.push_back( 262 m_controlPortsOut.push_back(
263 std::pair<unsigned long, LADSPA_Data*>(i, data)); 263 std::pair<unsigned long, LADSPA_Data*>(i, data));
264 if (!strcmp(m_descriptor->PortNames[i], "latency") || 264 if (!strcmp(m_descriptor->PortNames[i], "latency") ||
271 271
272 } 272 }
273 } 273 }
274 #ifdef DEBUG_LADSPA 274 #ifdef DEBUG_LADSPA
275 else 275 else
276 std::cerr << "LADSPAPluginInstance::init - " 276 DEBUG << "LADSPAPluginInstance::init - "
277 << "unrecognised port type" << std::endl; 277 << "unrecognised port type" << endl;
278 #endif 278 #endif
279 } 279 }
280 280
281 m_instanceCount = 1; 281 m_instanceCount = 1;
282 282
339 339
340 340
341 LADSPAPluginInstance::~LADSPAPluginInstance() 341 LADSPAPluginInstance::~LADSPAPluginInstance()
342 { 342 {
343 #ifdef DEBUG_LADSPA 343 #ifdef DEBUG_LADSPA
344 std::cerr << "LADSPAPluginInstance::~LADSPAPluginInstance" << std::endl; 344 DEBUG << "LADSPAPluginInstance::~LADSPAPluginInstance" << endl;
345 #endif 345 #endif
346 346
347 if (m_instanceHandles.size() != 0) { // "isOK()" 347 if (m_instanceHandles.size() != 0) { // "isOK()"
348 deactivate(); 348 deactivate();
349 } 349 }