diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-09-04 15:30:03 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-09-04 15:30:03 +0100 |
| commit | be19f5a21dc1fe717711d76f500f6bfe0c4d166b (patch) | |
| tree | 8cffe4ea47bd5cd66f8fe5fd1fb537c40a52e8f4 /rotord/src/nodes_audio_analysis.h | |
| parent | bb4e23344b03c4f0947852530e13885035a6c3fb (diff) | |
adding final audio feature
Diffstat (limited to 'rotord/src/nodes_audio_analysis.h')
| -rw-r--r-- | rotord/src/nodes_audio_analysis.h | 12 |
1 files changed, 7 insertions, 5 deletions
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 |
