From 858cb95b8539f5695c5348c340b9f982d8b66719 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 29 Oct 2013 14:45:49 +0000 Subject: making intensity segmenter --- rotord/src/vampHost.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'rotord/src/vampHost.cpp') diff --git a/rotord/src/vampHost.cpp b/rotord/src/vampHost.cpp index 7bdbb0d..2ddc62f 100644 --- a/rotord/src/vampHost.cpp +++ b/rotord/src/vampHost.cpp @@ -275,6 +275,10 @@ bool vampHost::Analyser::init(const string &soname,const string &id,const int &_ return false; } + cerr << "Vamphost Plugin initialised: (channels = " << channels + << ", stepSize = " << stepSize << ", blockSize = " + << blockSize << ")" << endl; + wrapper = dynamic_cast(plugin); if (wrapper) { // See documentation for @@ -294,6 +298,7 @@ bool vampHost::Analyser::init(const string &soname,const string &id,const int &_ return true; } void vampHost::Analyser::process_frame(uint8_t *data,int samples_in_frame){ + int sample=0; uint16_t *_data=(uint16_t*)data; @@ -317,20 +322,25 @@ void vampHost::Analyser::process_frame(uint8_t *data,int samples_in_frame){ //I /think/ that the vamp plugin keeps processing through the plugbuf until it encounters 0s rt = RealTime::frame2RealTime(currentStep * stepSize, rate); //48000); //setting different rate doesn't affect it + Plugin::FeatureSet feat=plugin->process(plugbuf, rt); + float t; + for (unsigned int i = 0; i < feat[outputNo].size(); ++i) { feature f; f.number=featureNo; f.values=feat[outputNo][i].values; //fix for plugins that don't set timestamp properly - float t=((float)feat[outputNo][i].timestamp.sec)+(((float)feat[outputNo][i].timestamp.nsec)*.000000001); + t=((float)feat[outputNo][i].timestamp.sec)+(((float)feat[outputNo][i].timestamp.nsec)*.000000001); if (t<.01) t=((rt.sec)+(rt.nsec)*.000000001); features[t]=f; featureNo++; } + //if (feat[outputNo].size()>0) cerr<<"vamphost: "<0) cerr<getIdentifier()<<" step:"<first; + float v1,v2; + v1=v2=0.0f; + if (i->second.values.size()) v2=i->second.values[0]; + i--; + float lk=i->first; + int ln=i->second.number; + if (i->second.values.size()) v1=i->second.values[0]; + + return ((((time-lk)/(uk-lk))*(v2-v1))+v1); + } + } + return 0.0f; +} -- cgit v1.2.3