comparison 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
comparison
equal deleted inserted replaced
0:a6020bf991cd 1:4342352b8ef3
11 #include "system/System.h" 11 #include "system/System.h"
12 12
13 #include "Processor.h" 13 #include "Processor.h"
14 14
15 #include <cmath> 15 #include <cmath>
16 #include <cassert>
16 17
17 #include <QApplication> 18 #include <QApplication>
18 #include <QFont> 19 #include <QFont>
19 #include <QPushButton> 20 #include <QPushButton>
20 21
21 using std::cout; 22 using std::cout;
22 using std::cerr; 23 using std::cerr;
23 using std::endl; 24 using std::endl;
24 using std::string; 25 using std::string;
25 using std::vector; 26 using std::vector;
27
28 static bool loadPlugin(Processor &processor, QString id);
26 29
27 30
28 int main(int argc, char **argv) 31 int main(int argc, char **argv)
29 { 32 {
30 QApplication application(argc, argv); 33 QApplication application(argc, argv);
46 std::cerr << "ERROR: Failed to create audio record source" << std::endl; 49 std::cerr << "ERROR: Failed to create audio record source" << std::endl;
47 return 1; 50 return 1;
48 } 51 }
49 52
50 Processor processor(target); 53 Processor processor(target);
51 processor.start();
52 54
53 // int n = processor.addPlugin("vamp:vamp-aubio:aubiotempo"); 55 int count = 0;
54 int n = processor.addPlugin("vamp:vamp-example-plugins:percussiononsets"); 56 if (loadPlugin(processor, "vamp:vamp-aubio:aubiotempo")) ++count;
55 // int n = processor.addPlugin("vamp:vamp-example-plugins:spectralcentroid"); 57 if (loadPlugin(processor, "vamp:vamp-example-plugins:percussiononsets")) ++count;
56 std::cerr << "Plugin loaded successfully (number: " << n << ")" << std::endl; 58 if (loadPlugin(processor, "vamp:qm-vamp-plugins:qm-tempotracker")) ++count;
59 if (loadPlugin(processor, "vamp:qm-vamp-plugins:qm-chromagram")) ++count;
60 if (loadPlugin(processor, "vamp:vamp-example-plugins:zerocrossing")) ++count;
61
62 std::cerr << count << " plugin(s) loaded" << std::endl;
57 63
58 button->show(); 64 button->show();
65 processor.start();
59 66
60 application.exec(); 67 application.exec();
61 } 68 }
62 69
70 bool loadPlugin(Processor &processor, QString id)
71 {
72 int n = processor.addPlugin(id);
73 if (n) {
74 std::cerr << "Plugin \"" << id.toStdString() << "\" successfully loaded (index " << n << ")" << std::endl;
75 return true;
76 } else {
77 std::cerr << "Failed to load plugin \"" << id.toStdString() << "\"" << std::endl;
78 return false;
79 }
80 }