From be19f5a21dc1fe717711d76f500f6bfe0c4d166b Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 4 Sep 2013 15:30:03 +0100 Subject: adding final audio feature --- rotord/src/nodes_audio_analysis.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'rotord/src/nodes_audio_analysis.h') diff --git a/rotord/src/nodes_audio_analysis.h b/rotord/src/nodes_audio_analysis.h index 619b60a..d192d26 100644 --- a/rotord/src/nodes_audio_analysis.h +++ b/rotord/src/nodes_audio_analysis.h @@ -36,7 +36,7 @@ namespace Rotor { void set_parameter(const std::string &key,const std::string &value){params[key]=ofToFloat(value);}; int process_frame(uint8_t *data,int samples_in_frame); const float output(const Time_spec &time) { - if (analyser.features.size()) { + if (analyser.features.size()) { auto i=analyser.features.upper_bound(time.time); //the first element in the container whose key is considered to go after k if (i!=analyser.features.end()){ float uk=i->first; @@ -45,15 +45,17 @@ namespace Rotor { if (i->second.values.size()) v2=i->second.values[0]; i--; float lk=i->first; - int ln=i->second.number; + int ln=i->second.number-1; //vamp numbers the first segment 0 if (i->second.values.size()) v1=i->second.values[0]; + int m=attributes["mode"]->intVal; + // switch (attributes["mode"]->intVal){ case VAMPHOST_Timeline: - return ((time.time-lk)+ln); + return (((time.time-lk)/(uk-lk))+ln); case VAMPHOST_Timesteps: return (float)ln; case VAMPHOST_Valueline: - return (((time.time-lk)*(v2-v1))+v1); + return ((((time.time-lk)/(uk-lk))*(v2-v1))+v1); case VAMPHOST_Values: return v1; } @@ -73,4 +75,4 @@ namespace Rotor { }; } -#endif \ No newline at end of file +#endif -- cgit v1.2.3