From 6275e8f15b63f85c2206f0acb64023610c711f24 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 10 Apr 2013 13:49:24 +0100 Subject: signal rendering path nearly there --- rotord/rotor.cpp | 6 +++ rotord/rotor.h | 16 ++++++- rotord/vampHost.cpp | 132 ++++++++++++++++------------------------------------ rotord/vampHost.h | 14 +++--- 4 files changed, 65 insertions(+), 103 deletions(-) (limited to 'rotord') diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 2cd894f..af0bd7e 100644 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -567,4 +567,10 @@ int Audio_analysis::process_frame(uint8_t *data,int samples_in_frame) { } void Audio_analysis::cleanup() { analyser.cleanup(); + //print_features(); } +void Audio_analysis::print_features(){ + for (auto i: analyser.features) { + cerr<first; + int ln=i->second; + if (i++!=analyser.features.end()){ + float uk=i->first; + return (((time-lk)/(uk-lk))+ln); + } + else return (float)ln; + } + } + return 0.0f; } + void print_features(); private: string soname,id; int outputNo; diff --git a/rotord/vampHost.cpp b/rotord/vampHost.cpp index 21f5db5..2713e38 100644 --- a/rotord/vampHost.cpp +++ b/rotord/vampHost.cpp @@ -604,7 +604,7 @@ bool vampHost::Analyser::init(const string &soname,const string &id,const int &_ stride=channels*bytes; scale=(1.0f/pow(2.0f,bits)); - + features[0.0f]=0; loader = PluginLoader::getInstance(); key = loader->composePluginKey(soname, id); @@ -643,7 +643,6 @@ bool vampHost::Analyser::init(const string &soname,const string &id,const int &_ currentStep = 0; finalStepsRemaining = max(1, (blockSize / stepSize) - 1); // at end of file, this many part-silent frames needed after we hit EOF - filebuf = new float[blockSize * channels]; plugbuf = new float*[channels]; for (int c = 0; c < channels; ++c) plugbuf[c] = new float[blockSize + 2]; @@ -716,7 +715,7 @@ bool vampHost::Analyser::init(const string &soname,const string &id,const int &_ blocks_processed=0; currentStep=0; - featureNo=0; + featureNo=1; return true; } @@ -725,63 +724,6 @@ void vampHost::Analyser::process_frame(uint8_t *data,int samples_in_frame){ //process the whole frame which may be f>1getIdentifier()<<" processed block "<process(plugbuf, rt); @@ -804,45 +750,45 @@ void vampHost::Analyser::process_frame(uint8_t *data,int samples_in_frame){ featureNo++; } + //shunt it down + for (int i=0;iprocess(plugbuf, rt); - - 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++; - } - - feat = plugin->getRemainingFeatures(); - - 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++; - } - - cerr<getIdentifier()<<" found "<process(plugbuf, rt); + + 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++; + } + + feat=plugin->getRemainingFeatures(); + + 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++; + } + + cerr<getIdentifier()<<" found "<<(features.size()-1)<<" features"< features; + //map + //this is the best way to store features: because map allows to search for the key below and above the present time + private: PluginLoader *loader; PluginLoader::PluginKey key; Plugin *plugin; + RealTime rt; int channels,bits,samples,rate; int bytes,stride; float scale; int blockSize,stepSize,overlapSize,finalStepsRemaining,currentStep,outputNo; int in_block,blocks_processed; string output; - float *filebuf; float **plugbuf; - RealTime rt; int featureNo; - map features; - //what's the best way to store features? - //how will it be used? - //we ask for a signal at a time, return interpolated value representing feature number + fraction - //is there a quick way to search the keys and return the last one below a given value - }; string getQMBeats(const string soundfile); -- cgit v1.2.3