comparison plugin/LADSPAPluginFactory.cpp @ 687:06f13a3b9e9e debug-output

Convert many cerrs to DEBUGs
author Chris Cannam
date Mon, 16 May 2011 17:19:09 +0100
parents b4a8d8221eaf
children 1424aa29ae95
comparison
equal deleted inserted replaced
686:b4a8d8221eaf 687:06f13a3b9e9e
225 else logmin = log10f(minimum); 225 else logmin = log10f(minimum);
226 if (maximum < thresh) logmax = -10; 226 if (maximum < thresh) logmax = -10;
227 else logmax = log10f(maximum); 227 else logmax = log10f(maximum);
228 } 228 }
229 229
230 // std::cerr << "LADSPAPluginFactory::getPortDefault: hint = " << d << std::endl; 230 // DEBUG << "LADSPAPluginFactory::getPortDefault: hint = " << d << endl;
231 231
232 if (!LADSPA_IS_HINT_HAS_DEFAULT(d)) { 232 if (!LADSPA_IS_HINT_HAS_DEFAULT(d)) {
233 233
234 deft = minimum; 234 deft = minimum;
235 235
347 descriptor); 347 descriptor);
348 348
349 m_instances.insert(instance); 349 m_instances.insert(instance);
350 350
351 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY 351 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY
352 std::cerr << "LADSPAPluginFactory::instantiatePlugin(" 352 DEBUG << "LADSPAPluginFactory::instantiatePlugin("
353 << identifier << ": now have " << m_instances.size() << " instances" << std::endl; 353 << identifier << ": now have " << m_instances.size() << " instances" << endl;
354 #endif 354 #endif
355 355
356 return instance; 356 return instance;
357 } 357 }
358 358
382 ii != m_instances.end(); ++ii) { 382 ii != m_instances.end(); ++ii) {
383 QString itype, isoname, ilabel; 383 QString itype, isoname, ilabel;
384 PluginIdentifier::parseIdentifier((*ii)->getPluginIdentifier(), itype, isoname, ilabel); 384 PluginIdentifier::parseIdentifier((*ii)->getPluginIdentifier(), itype, isoname, ilabel);
385 if (isoname == soname) { 385 if (isoname == soname) {
386 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY 386 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY
387 std::cerr << "LADSPAPluginFactory::releasePlugin: dll " << soname << " is still in use for plugin " << ilabel << std::endl; 387 DEBUG << "LADSPAPluginFactory::releasePlugin: dll " << soname << " is still in use for plugin " << ilabel << endl;
388 #endif 388 #endif
389 stillInUse = true; 389 stillInUse = true;
390 break; 390 break;
391 } 391 }
392 } 392 }
393 393
394 if (!stillInUse) { 394 if (!stillInUse) {
395 if (soname != PluginIdentifier::BUILTIN_PLUGIN_SONAME) { 395 if (soname != PluginIdentifier::BUILTIN_PLUGIN_SONAME) {
396 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY 396 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY
397 std::cerr << "LADSPAPluginFactory::releasePlugin: dll " << soname << " no longer in use, unloading" << std::endl; 397 DEBUG << "LADSPAPluginFactory::releasePlugin: dll " << soname << " no longer in use, unloading" << endl;
398 #endif 398 #endif
399 unloadLibrary(soname); 399 unloadLibrary(soname);
400 } 400 }
401 } 401 }
402 402
403 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY 403 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY
404 std::cerr << "LADSPAPluginFactory::releasePlugin(" 404 DEBUG << "LADSPAPluginFactory::releasePlugin("
405 << identifier << ": now have " << m_instances.size() << " instances" << std::endl; 405 << identifier << ": now have " << m_instances.size() << " instances" << endl;
406 #endif 406 #endif
407 } 407 }
408 408
409 const LADSPA_Descriptor * 409 const LADSPA_Descriptor *
410 LADSPAPluginFactory::getLADSPADescriptor(QString identifier) 410 LADSPAPluginFactory::getLADSPADescriptor(QString identifier)
447 LADSPAPluginFactory::loadLibrary(QString soName) 447 LADSPAPluginFactory::loadLibrary(QString soName)
448 { 448 {
449 void *libraryHandle = DLOPEN(soName, RTLD_NOW); 449 void *libraryHandle = DLOPEN(soName, RTLD_NOW);
450 if (libraryHandle) { 450 if (libraryHandle) {
451 m_libraryHandles[soName] = libraryHandle; 451 m_libraryHandles[soName] = libraryHandle;
452 std::cerr << "LADSPAPluginFactory::loadLibrary: Loaded library \"" << soName << "\"" << std::endl; 452 DEBUG << "LADSPAPluginFactory::loadLibrary: Loaded library \"" << soName << "\"" << endl;
453 return; 453 return;
454 } 454 }
455 455
456 if (QFileInfo(soName).exists()) { 456 if (QFileInfo(soName).exists()) {
457 DLERROR(); 457 DLERROR();
466 466
467 for (std::vector<QString>::iterator i = pathList.begin(); 467 for (std::vector<QString>::iterator i = pathList.begin();
468 i != pathList.end(); ++i) { 468 i != pathList.end(); ++i) {
469 469
470 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY 470 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY
471 std::cerr << "Looking at: " << (*i) << std::endl; 471 DEBUG << "Looking at: " << (*i) << endl;
472 #endif 472 #endif
473 473
474 QDir dir(*i, PLUGIN_GLOB, 474 QDir dir(*i, PLUGIN_GLOB,
475 QDir::Name | QDir::IgnoreCase, 475 QDir::Name | QDir::IgnoreCase,
476 QDir::Files | QDir::Readable); 476 QDir::Files | QDir::Readable);
507 void 507 void
508 LADSPAPluginFactory::unloadLibrary(QString soName) 508 LADSPAPluginFactory::unloadLibrary(QString soName)
509 { 509 {
510 LibraryHandleMap::iterator li = m_libraryHandles.find(soName); 510 LibraryHandleMap::iterator li = m_libraryHandles.find(soName);
511 if (li != m_libraryHandles.end()) { 511 if (li != m_libraryHandles.end()) {
512 // std::cerr << "unloading " << soname << std::endl; 512 // DEBUG << "unloading " << soname << endl;
513 DLCLOSE(m_libraryHandles[soName]); 513 DLCLOSE(m_libraryHandles[soName]);
514 m_libraryHandles.erase(li); 514 m_libraryHandles.erase(li);
515 } 515 }
516 } 516 }
517 517
631 { 631 {
632 Profiler profiler("LADSPAPluginFactory::discoverPlugins"); 632 Profiler profiler("LADSPAPluginFactory::discoverPlugins");
633 633
634 std::vector<QString> pathList = getPluginPath(); 634 std::vector<QString> pathList = getPluginPath();
635 635
636 // std::cerr << "LADSPAPluginFactory::discoverPlugins - " 636 // DEBUG << "LADSPAPluginFactory::discoverPlugins - "
637 // << "discovering plugins; path is "; 637 // << "discovering plugins; path is ";
638 // for (std::vector<QString>::iterator i = pathList.begin(); 638 // for (std::vector<QString>::iterator i = pathList.begin();
639 // i != pathList.end(); ++i) { 639 // i != pathList.end(); ++i) {
640 // std::cerr << "[" << i->toStdString() << "] "; 640 // DEBUG << "[" << i-<< "] ";
641 // } 641 // }
642 // std::cerr << std::endl; 642 // DEBUG << endl;
643 643
644 #ifdef HAVE_LRDF 644 #ifdef HAVE_LRDF
645 // read the description files 645 // read the description files
646 // 646 //
647 QString baseUri; 647 QString baseUri;
816 if (pluginPath[i].contains("/lib/")) { 816 if (pluginPath[i].contains("/lib/")) {
817 QString p(pluginPath[i]); 817 QString p(pluginPath[i]);
818 path.push_back(p); 818 path.push_back(p);
819 p.replace("/lib/", "/share/"); 819 p.replace("/lib/", "/share/");
820 path.push_back(p); 820 path.push_back(p);
821 // std::cerr << "LADSPAPluginFactory::generateFallbackCategories: path element " << p << std::endl; 821 // DEBUG << "LADSPAPluginFactory::generateFallbackCategories: path element " << p << endl;
822 } 822 }
823 path.push_back(pluginPath[i]); 823 path.push_back(pluginPath[i]);
824 // std::cerr << "LADSPAPluginFactory::generateFallbackCategories: path element " << pluginPath[i] << std::endl; 824 // DEBUG << "LADSPAPluginFactory::generateFallbackCategories: path element " << pluginPath[i] << endl;
825 } 825 }
826 826
827 for (size_t i = 0; i < path.size(); ++i) { 827 for (size_t i = 0; i < path.size(); ++i) {
828 828
829 QDir dir(path[i], "*.cat"); 829 QDir dir(path[i], "*.cat");
830 830
831 // std::cerr << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i] << " has " << dir.count() << " .cat files" << std::endl; 831 // DEBUG << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i] << " has " << dir.count() << " .cat files" << endl;
832 for (unsigned int j = 0; j < dir.count(); ++j) { 832 for (unsigned int j = 0; j < dir.count(); ++j) {
833 833
834 QFile file(path[i] + "/" + dir[j]); 834 QFile file(path[i] + "/" + dir[j]);
835 835
836 // std::cerr << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i].toStdString() + "/" + dir[j].toStdString()) << std::endl; 836 // DEBUG << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i]+ "/" + dir[j]) << endl;
837 837
838 if (file.open(QIODevice::ReadOnly)) { 838 if (file.open(QIODevice::ReadOnly)) {
839 // std::cerr << "...opened" << std::endl; 839 // std::cerr << "...opened" << std::endl;
840 QTextStream stream(&file); 840 QTextStream stream(&file);
841 QString line; 841 QString line;