From a879f37ff944cd7bf502f4e3520b7da3d8faf39b Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 22 Jan 2014 14:28:34 +0000 Subject: variable arrays working correctly --- NT/src/graph.cpp | 3 +-- NT/src/graph.h | 35 ++++++++++++++++++----------------- NT/src/nodes.h | 10 +++++++--- NT/src/rotor.h | 19 ++++++++++++++----- 4 files changed, 40 insertions(+), 27 deletions(-) (limited to 'NT') diff --git a/NT/src/graph.cpp b/NT/src/graph.cpp index 65bd6c8..f774528 100644 --- a/NT/src/graph.cpp +++ b/NT/src/graph.cpp @@ -68,9 +68,8 @@ bool Graph::parse_json(string &data,string &media_path){ // //node.create_links(nodes) //will allow the nodes to be passed into each member of a variable array + node->create_connections(nodes); nodes[node_id]=node; - nodes[node_id]->create_connections(nodes); - } else cerr << "ERROR: duplicate node '"< nodes; + std::vector find_nodes(const std::string &type); Node* find_node(const std::string &type); - Json::Value signal_render(const std::string &node,const double framerate); - bool video_render(const std::string &output_filename,const double framerate,int start, int end); + //--context// Json::Value signal_render(const std::string &node,const double framerate); + //--context// bool video_render(const std::string &output_filename,const double framerate,int start, int end); bool load_file(std::string filename,std::string media_path); bool parse_json(std::string &data,std::string &media_path); - Json::Value preview(std::string &node ,std::string &format,int frame,int w,int h); + //--context// Json::Value preview(std::string &node ,std::string &format,int frame,int w,int h); bool check_audio (std::string audio ,std::string path); - Json::Value print_features (std::string &node); + //--context// Json::Value print_features (std::string &node); //bool load_audio(const std::string &filename, std::vector processors); - bool load_video(const std::string &node_id,const std::string &filename); + //bool load_video(const std::string &node_id,const std::string &filename); + //load audio and video should be methods of the nodes themselves? bool loaded; bool audio_loaded; std::string audio_filename; bool cancelled; double progress; - void set_log_name (std::string _Log_name){ - Log_name=_Log_name; - } + //void set_log_name (std::string _Log_name){ + //log name should be the same as the graph uid + //Log_name=_Log_name; + //} //Audio_thumbnailer *audio_thumb; private: - int analysis_seed; - std::string Log_name; + std::string uid; + std::string description; + std::unordered_map nodes; }; } diff --git a/NT/src/nodes.h b/NT/src/nodes.h index 0f885da..21b1fc4 100644 --- a/NT/src/nodes.h +++ b/NT/src/nodes.h @@ -45,9 +45,13 @@ namespace Rotor{ }; const double &get_output(const Frame_parameters &frame){ result=1.0f; - for (auto val:factors->get_values()) { - std::cerr<<"got value: "<get_values()) { + // result*=val.get(frame); + //} + //std::cerr<<"multiplying "<get_number()<<" factors"<get_number();i++){ + //std::cerr<<"result from input "<get(i,frame)<get(i,frame); } return result; } diff --git a/NT/src/rotor.h b/NT/src/rotor.h index 96a89ef..68473af 100644 --- a/NT/src/rotor.h +++ b/NT/src/rotor.h @@ -126,9 +126,10 @@ namespace Rotor { for (auto node:nodes){ if (node.first==input){ if (connect(node.second)) { - std::cerr<<"connecting '"<::Get()<<"' input to '"<::Get()<<"' input to '"<<(dynamic_cast*>(connection))->get_type()<<"' "<::Get()<<"'' input to '"<::Get()<<"'' input to '"<*>(connection))->get_type()<<"'"<*>(connection))->get_type()<<"' node ("<*>(connection))->get_output(frame)<*>(connection))->get_output(frame); } + //else std::cerr<<"variable: returning default"< &nodes){ - for (auto v:values){ - v.create_connection(nodes); - } + //for (auto v:values){ //weirdly does not work even though it seems to! maybe it returns a copy of of the object? + // v.create_connection(nodes); + //} + for (uint32_t i=0;iwhich){ + //std::cerr<<"array: requested value "<>& get_values(){return values;}; + uint32_t get_number(){return values.size();}; protected: std::vector> values; T value; -- cgit v1.2.3