summaryrefslogtreecommitdiff
path: root/NT
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2014-01-30 18:13:45 +0000
committerTim Redfern <tim@eclectronics.org>2014-01-30 18:13:45 +0000
commitc2b62131b0e6984f8fea7f44e364ae5c886c211a (patch)
tree0e6e1502d95a8c9e99fea979f92d2ee12518ecbe /NT
parent5858a7f89d844e3577f6400681bdd47a7bdd8e2c (diff)
making fragmenting exporter
Diffstat (limited to 'NT')
-rw-r--r--NT/src/nodes_audio_analysis.h9
-rw-r--r--NT/src/rotor.h25
2 files changed, 23 insertions, 11 deletions
diff --git a/NT/src/nodes_audio_analysis.h b/NT/src/nodes_audio_analysis.h
index 4542e19..aa4abeb 100644
--- a/NT/src/nodes_audio_analysis.h
+++ b/NT/src/nodes_audio_analysis.h
@@ -39,7 +39,6 @@ namespace Rotor {
void cleanup(){};
int process_frame(uint8_t *data,int samples_in_frame);
void print_vector(xmlIO XML);
- const double get_output(const Frame_parameters &frame){return 0.0;};
vector<double> audiodata;
int height,width,samples_per_column;
int out_sample,sample,samples;
@@ -55,9 +54,9 @@ namespace Rotor {
bool init(int _channels,int _bits,int _samples,int _rate);
void cleanup();
int process_frame(uint8_t *data,int samples_in_frame);
- const double output(const Time_spec &time) {
+ const double& output(const Frame_parameters &frame) {
if (features.size()) {
- auto i=features.upper_bound(time.time); //the first element in the container whose key is considered to go after k
+ auto i=features.upper_bound(frame.time); //the first element in the container whose key is considered to go after k
double uk;
double v1,v2;
v1=v2=0.0;
@@ -74,11 +73,11 @@ namespace Rotor {
if (i->second.values.size()) v1=i->second.values[0];
switch (attributes["mode"]->intVal){
case VAMPHOST_Timeline:
- return (((time.time-lk)/(uk-lk))+ln);
+ return (((frame.time-lk)/(uk-lk))+ln);
case VAMPHOST_Timesteps:
return (double)ln;
case VAMPHOST_Valueline:
- return ((time.time-lk)/(uk-lk))+v1; //((((time.time-lk)/(uk-lk))*(v2-v1))+v1);
+ return ((frame.time-lk)/(uk-lk))+v1; //((((time.time-lk)/(uk-lk))*(v2-v1))+v1);
case VAMPHOST_Values:
return v1;
}
diff --git a/NT/src/rotor.h b/NT/src/rotor.h
index 1ed02dc..d2d7d00 100644
--- a/NT/src/rotor.h
+++ b/NT/src/rotor.h
@@ -78,11 +78,22 @@ struct TypeName<std::string> {
+
+
namespace Rotor {
class Node;
template <class NT> class Node_type;
+ class Enum{
+ //enumerated string type for menus
+ public:
+ Enum(std::initializer_list<std::string> init) : labels(init){};
+ private:
+ std::vector<std::string> labels;
+ int value;
+ };
+
class Audio_frame{
public:
Audio_frame(uint16_t *_samples,int _channels,int _numsamples){
@@ -117,9 +128,7 @@ namespace Rotor {
};
class Variable { //pure virtual base type for variable pointers
public:
- Variable(){
- connection=nullptr;
- };
+ Variable():name(""),description(""),title(""),connection(nullptr){};
virtual ~Variable(){};
virtual Json::Value to_json()=0;
virtual void init(Json::Value s)=0;
@@ -133,7 +142,7 @@ namespace Rotor {
std::string get_connection_id();
std::string get_name();
protected:
- std::string name;
+ std::string name,description,title;
Node* connection;
bool connectable;
std::string input;
@@ -300,7 +309,7 @@ namespace Rotor {
};
template <class NT> class Node_type : public Node {
public:
- virtual const NT& get_output(const Frame_parameters &frame)=0;
+ virtual const NT& get_output(const Frame_parameters &frame){return value;};
void init(Json::Value settings){
if (!settings["vars"].empty()){
for ( uint32_t i = 0; i < settings["vars"].size(); ++i ) {
@@ -316,7 +325,7 @@ namespace Rotor {
vars[name]=new Variable_type<IT>(name,"",true);
return (dynamic_cast<Variable_type<IT>*>(vars[name]));
}
- template <class IT> Variable_type<IT>* create_attribute(std::string name){
+ template <class IT> Variable_type<IT>* create_attribute(std::string name="",std::string description="",std::string title="",IT _default=IT()){
vars[name]=new Variable_type<IT>(name,"",false);
return (dynamic_cast<Variable_type<IT>*>(vars[name]));
}
@@ -324,6 +333,10 @@ namespace Rotor {
vars[name]=new Variable_array_type<IT>(name);
return (dynamic_cast<Variable_array_type<IT>*>(vars[name]));
}
+ //enum will require specialisation
+ //1st, define the enum data type
+ protected:
+ NT value; //every node has a value so it can return a reference
};
}