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/src/ofxVamphost.cpp | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'vamphost/src/ofxVamphost.cpp') 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"<