diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-05-26 15:08:46 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-05-26 15:08:46 +0100 |
| commit | 30d4c7382ceb71ae2072616f95bf47fd2ec036e8 (patch) | |
| tree | c58a788c72ae2410d24c51d00c0e67f47ba127d5 /vamphost/src/ofxVamphost.cpp | |
| parent | 63971c9b5e2dcfa1b7e254cac9cac5629c776835 (diff) | |
switching vamp plugins
Diffstat (limited to 'vamphost/src/ofxVamphost.cpp')
| -rw-r--r-- | vamphost/src/ofxVamphost.cpp | 42 |
1 files changed, 34 insertions, 8 deletions
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<<p<<endl; + } +} + +int Vamphost::init(int whichplugin,const int &_channels,const int &_rate,const int &_outputNo,const string &_output){ + key = list[whichplugin]; + init(_channels,_rate,_outputNo,_output); +} + + +int Vamphost::init(const string &soname,const string &id,const int &_channels,const int &_rate,const int &_outputNo,const string &_output){ + key = loader->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"<<endl; + //if (feat[outputNo].size()>0) cerr<<"BEAT"<<endl; for (unsigned int i = 0; i < feat[outputNo].size(); ++i) { features[((float)feat[outputNo][i].timestamp.sec)+(((float)feat[outputNo][i].timestamp.nsec)*.000000001)]=featureNo; |
