diff options
Diffstat (limited to 'vamphost')
| -rw-r--r-- | vamphost/src/ofxVamphost.cpp | 10 | ||||
| -rw-r--r-- | vamphost/src/ofxVamphost.h | 5 | ||||
| -rw-r--r-- | vamphost/src/testApp.cpp | 11 | ||||
| -rwxr-xr-x | vamphost/vamphost.cbp | 6 |
4 files changed, 29 insertions, 3 deletions
diff --git a/vamphost/src/ofxVamphost.cpp b/vamphost/src/ofxVamphost.cpp index 1ba2b4e..3844c60 100644 --- a/vamphost/src/ofxVamphost.cpp +++ b/vamphost/src/ofxVamphost.cpp @@ -127,6 +127,11 @@ int Vamphost::init(const string &soname,const string &id,const int &_channels,co featureNo=1; + + avg=0.0f; + num=0; + numFeat=0; + return blockSize; } void Vamphost::process_frame(float *data,int samples_in_frame){ @@ -145,6 +150,8 @@ void Vamphost::process_frame(float *data,int samples_in_frame){ while(sample<samples_in_frame&&in_block<blockSize) { for (int i=0;i<channels;i++) { plugbuf[i][in_block]=data[sample]; + num++; + avg+=(data[sample]/num); } in_block++; sample++; @@ -158,9 +165,12 @@ 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; + 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; featureNo++; + numFeat++; } //shunt it down diff --git a/vamphost/src/ofxVamphost.h b/vamphost/src/ofxVamphost.h index fe36d06..2c618eb 100644 --- a/vamphost/src/ofxVamphost.h +++ b/vamphost/src/ofxVamphost.h @@ -29,6 +29,10 @@ class Vamphost{ //map<time,featureNo> //this is the best way to store features: because map allows to search for the key below and above the present time int getRT(); + + float avg; + int num; + int numFeat; private: PluginLoader *loader; @@ -45,6 +49,7 @@ class Vamphost{ int featureNo; + }; #endif diff --git a/vamphost/src/testApp.cpp b/vamphost/src/testApp.cpp index b431fce..659ed35 100644 --- a/vamphost/src/testApp.cpp +++ b/vamphost/src/testApp.cpp @@ -22,8 +22,12 @@ void testApp::setup() { int channels=1; int outputNo=0; - string soname="qm-vamp-plugins"; - string id="qm-tempotracker"; + //string soname="qm-vamp-plugins"; + //string id="qm-tempotracker"; + //string id="qm-barbeattracker"; + + string soname="vamp-example-plugins.so"; + string id="percussiononsets"; int bufferSize = vamphost.init(soname,id,channels,rate,outputNo); @@ -149,7 +153,7 @@ ofSetColor(225); ofSetColor(225); string reportString = "buffers received: "+ofToString(bufferCounter)+"\ndraw routines called: "+ofToString(drawCounter)+"\nticks: " + ofToString(soundStream.getTickCount()); - reportString +="\nfeatures found: "+ofToString(vamphost.features.size()); + reportString +="\nfeatures found: "+ofToString(vamphost.numFeat)+" average signal: "+ofToString(vamphost.avg)+" samples: "+ofToString(vamphost.num); ofDrawBitmapString(reportString, 32, 589); } @@ -183,6 +187,7 @@ void testApp::audioIn(float * input, int bufferSize, int nChannels){ bufferCounter++; + //input would seem to be in the range 0..1 vamphost.process_frame(input,bufferSize); diff --git a/vamphost/vamphost.cbp b/vamphost/vamphost.cbp index 4137986..6a22a01 100755 --- a/vamphost/vamphost.cbp +++ b/vamphost/vamphost.cbp @@ -36,6 +36,12 @@ <Unit filename="src/main.cpp"> <Option virtualFolder="src/" /> </Unit> + <Unit filename="src/ofxVamphost.cpp"> + <Option virtualFolder="src/" /> + </Unit> + <Unit filename="src/ofxVamphost.h"> + <Option virtualFolder="src/" /> + </Unit> <Unit filename="src/testApp.cpp"> <Option virtualFolder="src/" /> </Unit> |
