diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/host.cpp	Thu Oct 19 16:53:48 2006 +0000
@@ -0,0 +1,62 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
+
+#include <vamp-sdk/PluginHostAdapter.h>
+
+#include "audioio/BufferingAudioCallbackRecordTarget.h"
+#include "audioio/AudioRecordSourceFactory.h"
+
+#include <iostream>
+#include <sndfile.h>
+
+#include "system/System.h"
+
+#include "Processor.h"
+
+#include <cmath>
+
+#include <QApplication>
+#include <QFont>
+#include <QPushButton>
+
+using std::cout;
+using std::cerr;
+using std::endl;
+using std::string;
+using std::vector;
+
+
+int main(int argc, char **argv)
+{
+    QApplication application(argc, argv);
+
+    QFont fn = application.font();
+    fn.setPointSize(fn.pointSize() + 3);
+    application.setFont(fn);
+
+    QPushButton *button = new QPushButton("Quit");
+    QObject::connect(button, SIGNAL(clicked()), 
+                     &application, SLOT(closeAllWindows()));
+    
+    BufferingAudioCallbackRecordTarget *target =
+        new BufferingAudioCallbackRecordTarget();
+
+    AudioCallbackRecordSource *source =
+        AudioRecordSourceFactory::createCallbackRecordSource(target);
+    if (!source) {
+        std::cerr << "ERROR: Failed to create audio record source" << std::endl;
+        return 1;
+    }
+
+    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;
+
+    button->show();
+
+    application.exec();
+}
+