comparison host/host.cpp @ 0:a6020bf991cd

* Initial import of what may or may not become a simple live visual-response host for causal Vamp plugins
author cannam
date Thu, 19 Oct 2006 16:53:48 +0000
parents
children 4342352b8ef3
comparison
equal deleted inserted replaced
-1:000000000000 0:a6020bf991cd
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 #include <vamp-sdk/PluginHostAdapter.h>
4
5 #include "audioio/BufferingAudioCallbackRecordTarget.h"
6 #include "audioio/AudioRecordSourceFactory.h"
7
8 #include <iostream>
9 #include <sndfile.h>
10
11 #include "system/System.h"
12
13 #include "Processor.h"
14
15 #include <cmath>
16
17 #include <QApplication>
18 #include <QFont>
19 #include <QPushButton>
20
21 using std::cout;
22 using std::cerr;
23 using std::endl;
24 using std::string;
25 using std::vector;
26
27
28 int main(int argc, char **argv)
29 {
30 QApplication application(argc, argv);
31
32 QFont fn = application.font();
33 fn.setPointSize(fn.pointSize() + 3);
34 application.setFont(fn);
35
36 QPushButton *button = new QPushButton("Quit");
37 QObject::connect(button, SIGNAL(clicked()),
38 &application, SLOT(closeAllWindows()));
39
40 BufferingAudioCallbackRecordTarget *target =
41 new BufferingAudioCallbackRecordTarget();
42
43 AudioCallbackRecordSource *source =
44 AudioRecordSourceFactory::createCallbackRecordSource(target);
45 if (!source) {
46 std::cerr << "ERROR: Failed to create audio record source" << std::endl;
47 return 1;
48 }
49
50 Processor processor(target);
51 processor.start();
52
53 // int n = processor.addPlugin("vamp:vamp-aubio:aubiotempo");
54 int n = processor.addPlugin("vamp:vamp-example-plugins:percussiononsets");
55 // int n = processor.addPlugin("vamp:vamp-example-plugins:spectralcentroid");
56 std::cerr << "Plugin loaded successfully (number: " << n << ")" << std::endl;
57
58 button->show();
59
60 application.exec();
61 }
62