diff host/host.cpp @ 1:4342352b8ef3

* run more than one plugin, etc
author cannam
date Fri, 20 Oct 2006 15:31:00 +0000
parents a6020bf991cd
children 86914ea77b7b
line wrap: on
line diff
--- a/host/host.cpp	Thu Oct 19 16:53:48 2006 +0000
+++ b/host/host.cpp	Fri Oct 20 15:31:00 2006 +0000
@@ -13,6 +13,7 @@
 #include "Processor.h"
 
 #include <cmath>
+#include <cassert>
 
 #include <QApplication>
 #include <QFont>
@@ -24,6 +25,8 @@
 using std::string;
 using std::vector;
 
+static bool loadPlugin(Processor &processor, QString id);
+
 
 int main(int argc, char **argv)
 {
@@ -48,15 +51,30 @@
     }
 
     Processor processor(target);
-    processor.start();
 
-//    int n = processor.addPlugin("vamp:vamp-aubio:aubiotempo");
-    int n = processor.addPlugin("vamp:vamp-example-plugins:percussiononsets");
-//    int n = processor.addPlugin("vamp:vamp-example-plugins:spectralcentroid");
-    std::cerr << "Plugin loaded successfully (number: " << n << ")" << std::endl;
+    int count = 0;
+    if (loadPlugin(processor, "vamp:vamp-aubio:aubiotempo")) ++count;
+    if (loadPlugin(processor, "vamp:vamp-example-plugins:percussiononsets")) ++count;
+    if (loadPlugin(processor, "vamp:qm-vamp-plugins:qm-tempotracker")) ++count;
+    if (loadPlugin(processor, "vamp:qm-vamp-plugins:qm-chromagram")) ++count;
+    if (loadPlugin(processor, "vamp:vamp-example-plugins:zerocrossing")) ++count;
+
+    std::cerr << count << " plugin(s) loaded" << std::endl;
 
     button->show();
+    processor.start();
 
     application.exec();
 }
 
+bool loadPlugin(Processor &processor, QString id)
+{
+    int n = processor.addPlugin(id);
+    if (n) {
+        std::cerr << "Plugin \"" << id.toStdString() << "\" successfully loaded (index " << n << ")" << std::endl;
+        return true;
+    } else {
+        std::cerr << "Failed to load plugin \"" << id.toStdString() << "\"" << std::endl;
+        return false;
+    }
+}