Mercurial > hg > vamp-live-host
view host/host.cpp @ 6:b046af03c719
* Added image window stuff
author | cannam |
---|---|
date | Fri, 10 Nov 2006 17:46:44 +0000 |
parents | 86914ea77b7b |
children | b30fcffc5000 |
line wrap: on
line source
/* -*- 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 "SimpleXMLRuleLoader.h" #include "ImageWindow.h" #include <cmath> #include <cassert> #include <QApplication> #include <QFont> #include <QPushButton> using std::cout; using std::cerr; using std::endl; using std::string; using std::vector; static bool loadPlugin(Processor &processor, QString id); 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; } ImageWindow window; window.show(); Processor processor(target); QObject::connect(&processor, SIGNAL(showImage(QString)), &window, SLOT(showImage(QString))); SimpleXMLRuleLoader loader; if (!loader.loadFile(processor, "test.xml")) { std::cerr << "ERROR: Failed to load test XML file" << std::endl; return 1; } 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; } }