From 30d4c7382ceb71ae2072616f95bf47fd2ec036e8 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 26 May 2013 15:08:46 +0100 Subject: switching vamp plugins --- vamphost/config.make | 2 +- vamphost/src/ofxVamphost.cpp | 42 ++++++++++++++++++++++++++++++++++-------- vamphost/src/ofxVamphost.h | 10 +++++++++- vamphost/src/testApp.cpp | 34 ++++++++++++++++++++++++++++------ vamphost/src/testApp.h | 2 ++ 5 files changed, 74 insertions(+), 16 deletions(-) (limited to 'vamphost') diff --git a/vamphost/config.make b/vamphost/config.make index da65b3e..aff87ad 100755 --- a/vamphost/config.make +++ b/vamphost/config.make @@ -11,7 +11,7 @@ OF_ROOT = /home/tim/workspace/openFrameworks # for example search paths like: # USER_CFLAGS = -I src/objects -USER_CFLAGS = -fpermissive +USER_CFLAGS = -fpermissive -std=c++11 # USER_LDFLAGS allows to pass custom flags to the linker diff --git a/vamphost/src/ofxVamphost.cpp b/vamphost/src/ofxVamphost.cpp index 3844c60..4a8ade6 100644 --- a/vamphost/src/ofxVamphost.cpp +++ b/vamphost/src/ofxVamphost.cpp @@ -1,27 +1,53 @@ #include "ofxVamphost.h" using namespace std; +using namespace Vamp; int Vamphost::getRT(){ return rt.msec(); } -int Vamphost::init(const string &soname,const string &id,const int &_channels,const int &_rate,const int &_outputNo,const string &_output){ - //stuff that only happens once + +Vamphost::Vamphost(){ + loader = PluginLoader::getInstance(); + list=loader->listPlugins(); + for (auto p: list) { + cerr<composePluginKey(soname, id); + init(_channels,_rate,_outputNo,_output); +} +int Vamphost::init(const int &_channels,const int &_rate,const int &_outputNo,const string &_output){ channels =_channels; rate=_rate; outputNo=_outputNo; output=_output; +} +int Vamphost::init(int whichplugin){ + key = list[whichplugin]; + init(); +} +int Vamphost::init(){ + //stuff that only happens once + features[0.0f]=0; - loader = PluginLoader::getInstance(); - key = loader->composePluginKey(soname, id); - plugin = loader->loadPlugin(key, _rate, PluginLoader::ADAPT_ALL_SAFE); + + + plugin = loader->loadPlugin(key, rate, PluginLoader::ADAPT_ALL_SAFE); if (!plugin) { - cerr << ": ERROR: Failed to load plugin \"" << id - << "\" from library \"" << soname << "\"" << endl; + cerr << ": ERROR: Failed to load plugin \"" << key<< "\"" << endl; return -1; } @@ -165,7 +191,7 @@ void Vamphost::process_frame(float *data,int samples_in_frame){ Plugin::FeatureSet feat=plugin->process(plugbuf, rt); - if (feat[outputNo].size()>0) cerr<<"BEAT"<0) cerr<<"BEAT"<0?whichplugin-1:vamphost.list.size()-1; + vamphost.cleanup(); + vamphost.init(whichplugin); + break; + } } diff --git a/vamphost/src/testApp.h b/vamphost/src/testApp.h index ad24233..112f697 100644 --- a/vamphost/src/testApp.h +++ b/vamphost/src/testApp.h @@ -35,6 +35,8 @@ public: ofSoundStream soundStream; Vamphost vamphost; + + int whichplugin; }; -- cgit v1.2.3