summaryrefslogtreecommitdiff
path: root/vamphost/src
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-05-23 18:19:13 +0100
committerTim Redfern <tim@eclectronics.org>2013-05-23 18:19:13 +0100
commit63971c9b5e2dcfa1b7e254cac9cac5629c776835 (patch)
treed8eca036763531fd9cb9191ebf3c241f2efb9868 /vamphost/src
parent0f5301b988bad81b2f27ba4d88c6ee3d0205603a (diff)
rearrange folders: working vamp host
Diffstat (limited to 'vamphost/src')
-rw-r--r--vamphost/src/ofxVamphost.cpp10
-rw-r--r--vamphost/src/ofxVamphost.h5
-rw-r--r--vamphost/src/testApp.cpp11
3 files changed, 23 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);