diff plugin/FeatureExtractionPluginFactory.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
line wrap: on
line diff
--- a/plugin/FeatureExtractionPluginFactory.cpp	Thu May 12 17:31:24 2011 +0100
+++ b/plugin/FeatureExtractionPluginFactory.cpp	Mon May 16 17:19:09 2011 +0100
@@ -58,8 +58,7 @@
 {
     if (pluginType == "vamp") {
 	if (!_nativeInstance) {
-//	    std::cerr << "FeatureExtractionPluginFactory::instance(" << pluginType.toStdString()
-//		      << "): creating new FeatureExtractionPluginFactory" << std::endl;
+//	    DEBUG << "FeatureExtractionPluginFactory::instance(" << pluginType//		      << "): creating new FeatureExtractionPluginFactory" << endl;
 	    _nativeInstance = new FeatureExtractionPluginFactory();
 	}
 	return _nativeInstance;
@@ -118,7 +117,7 @@
     for (std::vector<QString>::iterator i = path.begin(); i != path.end(); ++i) {
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-        std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: scanning directory " << i->toStdString() << std::endl;
+        DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: scanning directory " << i-<< endl;
 #endif
 
 	QDir pluginDir(*i, PLUGIN_GLOB,
@@ -130,7 +129,7 @@
             QString soname = pluginDir.filePath(pluginDir[j]);
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-            std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: trying potential library " << soname << std::endl;
+            DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: trying potential library " << soname << endl;
 #endif
 
             void *libraryHandle = DLOPEN(soname, RTLD_LAZY | RTLD_LOCAL);
@@ -141,7 +140,7 @@
             }
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-            std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: It's a library all right, checking for descriptor" << std::endl;
+            DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: It's a library all right, checking for descriptor" << endl;
 #endif
 
             VampGetPluginDescriptorFunction fn = (VampGetPluginDescriptorFunction)
@@ -156,7 +155,7 @@
             }
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-            std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Vamp descriptor found" << std::endl;
+            DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: Vamp descriptor found" << endl;
 #endif
 
             const VampPluginDescriptor *descriptor = 0;
@@ -174,7 +173,7 @@
                               << descriptor->identifier << "\" at indices "
                               << known[descriptor->identifier] << " and "
                               << index << std::endl;
-                    std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Avoiding this library (obsolete API?)" << std::endl;
+                    DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: Avoiding this library (obsolete API?)" << endl;
                     ok = false;
                     break;
                 } else {
@@ -194,7 +193,7 @@
                         ("vamp", soname, descriptor->identifier);
                     rv.push_back(id);
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-                    std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Found plugin id " << id << " at index " << index << std::endl;
+                    DEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: Found plugin id " << id << " at index " << index << endl;
 #endif
                     ++index;
                 }
@@ -217,9 +216,9 @@
     QString file = "";
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-    std::cerr << "FeatureExtractionPluginFactory::findPluginFile(\""
+    DEBUG << "FeatureExtractionPluginFactory::findPluginFile(\""
               << soname << "\", \"" << inDir << "\")"
-              << std::endl;
+              << endl;
 #endif
 
     if (inDir != "") {
@@ -234,8 +233,8 @@
         if (QFileInfo(file).exists() && QFileInfo(file).isFile()) {
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-            std::cerr << "FeatureExtractionPluginFactory::findPluginFile: "
-                      << "found trivially at " << file << std::endl;
+            DEBUG << "FeatureExtractionPluginFactory::findPluginFile: "
+                      << "found trivially at " << file << endl;
 #endif
 
             return file;
@@ -246,8 +245,8 @@
             if (QFileInfo(file).baseName() == QFileInfo(soname).baseName()) {
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-                std::cerr << "FeatureExtractionPluginFactory::findPluginFile: "
-                          << "found \"" << soname << "\" at " << file << std::endl;
+                DEBUG << "FeatureExtractionPluginFactory::findPluginFile: "
+                          << "found \"" << soname << "\" at " << file << endl;
 #endif
 
                 return file;
@@ -255,8 +254,8 @@
         }
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-        std::cerr << "FeatureExtractionPluginFactory::findPluginFile (with dir): "
-                  << "not found" << std::endl;
+        DEBUG << "FeatureExtractionPluginFactory::findPluginFile (with dir): "
+                  << "not found" << endl;
 #endif
 
         return "";
@@ -267,8 +266,8 @@
 
         if (fi.isAbsolute() && fi.exists() && fi.isFile()) {
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-            std::cerr << "FeatureExtractionPluginFactory::findPluginFile: "
-                      << "found trivially at " << soname << std::endl;
+            DEBUG << "FeatureExtractionPluginFactory::findPluginFile: "
+                      << "found trivially at " << soname << endl;
 #endif
             return soname;
         }
@@ -288,8 +287,8 @@
         }
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-        std::cerr << "FeatureExtractionPluginFactory::findPluginFile: "
-                  << "not found" << std::endl;
+        DEBUG << "FeatureExtractionPluginFactory::findPluginFile: "
+                  << "not found" << endl;
 #endif
 
         return "";
@@ -311,7 +310,7 @@
     QString type, soname, label;
     PluginIdentifier::parseIdentifier(identifier, type, soname, label);
     if (type != "vamp") {
-	std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Wrong factory for plugin type " << type << std::endl;
+	DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: Wrong factory for plugin type " << type << endl;
 	return 0;
     }
 
@@ -323,7 +322,7 @@
     } else if (found != soname) {
 
 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
-        std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Given library name was " << soname << ", found at " << found << std::endl;
+        DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: Given library name was " << soname << ", found at " << found << endl;
         std::cerr << soname << " -> " << found << std::endl;
 #endif
 
@@ -342,7 +341,7 @@
         DLSYM(libraryHandle, "vampGetPluginDescriptor");
     
     if (!fn) {
-        std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: No descriptor function in " << soname << std::endl;
+        DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: No descriptor function in " << soname << endl;
         goto done;
     }
 
@@ -363,7 +362,7 @@
         rv = new PluginDeletionNotifyAdapter(plugin, this);
     }
 
-//    std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Constructed Vamp plugin, rv is " << rv << std::endl;
+//    DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: Constructed Vamp plugin, rv is " << rv << endl;
 
     //!!! need to dlclose() when plugins from a given library are unloaded
 
@@ -374,7 +373,7 @@
         }
     }
 
-//    std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Instantiated plugin " << label << " from library " << soname << ": descriptor " << descriptor << ", rv "<< rv << ", label " << rv->getName() << ", outputs " << rv->getOutputDescriptors().size() << std::endl;
+//    DEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: Instantiated plugin " << label << " from library " << soname << ": descriptor " << descriptor << ", rv "<< rv << ", label " << rv->getName() << ", outputs " << rv->getOutputDescriptors().size() << endl;
     
     return rv;
 }
@@ -384,7 +383,7 @@
 {
     void *handle = m_handleMap[plugin];
     if (handle) {
-//        std::cerr << "unloading library " << handle << " for plugin " << plugin << std::endl;
+//        DEBUG << "unloading library " << handle << " for plugin " << plugin << endl;
         DLCLOSE(handle);
     }
     m_handleMap.erase(plugin);
@@ -416,12 +415,12 @@
 
 	QDir dir(path[i], "*.cat");
 
-//	std::cerr << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i] << " has " << dir.count() << " .cat files" << std::endl;
+//	DEBUG << "LADSPAPluginFactory::generateFallbackCategories: directory " << path[i] << " has " << dir.count() << " .cat files" << endl;
 	for (unsigned int j = 0; j < dir.count(); ++j) {
 
 	    QFile file(path[i] + "/" + dir[j]);
 
-//	    std::cerr << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i].toStdString() + "/" + dir[j].toStdString()) << std::endl;
+//	    DEBUG << "LADSPAPluginFactory::generateFallbackCategories: about to open " << (path[i]+ "/" + dir[j]) << endl;
 
 	    if (file.open(QIODevice::ReadOnly)) {
 //		    std::cerr << "...opened" << std::endl;