diff options
| author | Tim Redfern <tim@eclectronics.org> | 2014-01-20 05:42:52 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2014-01-20 05:42:52 +0000 |
| commit | 344e9b1a484b361cac7b07500cb7d2699cc93c29 (patch) | |
| tree | 0177d9963df8da75f438c55a4367bada0adf4324 /NT/src | |
| parent | 0dfbf40106d6a6c70d949e1f5bcfa1b33b20a68f (diff) | |
updating graph
Diffstat (limited to 'NT/src')
| -rw-r--r-- | NT/src/factory.cpp | 1 | ||||
| -rw-r--r-- | NT/src/graph.h | 79 | ||||
| -rw-r--r-- | NT/src/nodes.h | 12 | ||||
| -rw-r--r-- | NT/src/rotor.cpp | 6 | ||||
| -rw-r--r-- | NT/src/testgraph.json | 43 |
5 files changed, 88 insertions, 53 deletions
diff --git a/NT/src/factory.cpp b/NT/src/factory.cpp index 86b6a48..73a96f4 100644 --- a/NT/src/factory.cpp +++ b/NT/src/factory.cpp @@ -10,7 +10,6 @@ Node_factory::Node_factory(){ } bool Node_factory::list_node(const string &_type,Json::Value &json){ for (auto& type: type_map) { -cerr<<type.first<<endl; if (type.first==_type) { json["node"]=type.second->to_json(); return true; diff --git a/NT/src/graph.h b/NT/src/graph.h index 0a20ffe..c61d385 100644 --- a/NT/src/graph.h +++ b/NT/src/graph.h @@ -9,24 +9,27 @@ Graph object manages a collection of nodes and provides the interface for render #include "rotor.h" -/* + namespace Rotor { class Graph{ public: - Graph(){duration=20.0;loaded = false;audio_loaded=false;bitRate=0;outW=640;outH=360;audio_thumb=new Audio_thumbnailer();use_fragmentation=false;analysis_seed=0;Log_name="";}; - Graph(const string& _uid,const string& _desc){ - Graph(); + Graph(){init();}; + Graph(const std::string& _uid,const std::string& _desc){ init(_uid,_desc); }; - void init(const string& _uid,const string& _desc){ + void init(const std::string& _uid="",const std::string& _desc=""){ uid=_uid; description=_desc; - duration=20.0; - framerate=25.0; loaded=false; + audio_loaded=false; cancelled=false; + //audio_thumb=new Audio_thumbnailer(); + Log_name=""; + }; + ~Graph(){ + clear(); + //delete audio_thumb; }; - ~Graph(){ clear(); delete audio_thumb;}; void clear(){ for (auto n: nodes) { delete n.second; @@ -34,58 +37,36 @@ namespace Rotor { nodes.clear(); loaded=false; } - string uid; //every version of a graph has a UUID, no particular need to actually read its data(?) - //?? is it faster than using strings?? - string description; - std::unordered_map<string,Node*> nodes; - vector<Node*> find_nodes(const string &type); //could be a way of finding a set based on capabilities? - Node* find_node(const string &type); - bool signal_render(xmlIO &XML,const string &node,const double framerate); - bool video_render(const string &output_filename,const double framerate,int start, int end); - bool load(string data,string media_path); - bool loadFile(string &filename,string media_path); - bool parseXml(string media_path); - bool parseJson(string &data,string &media_path); - bool set_resolution(int w,int h); - bool preview(xmlIO &XML,string &node,string &format,int frame,int w,int h); - bool check_audio(string audio,string path); - bool print_features(xmlIO &XML,string &node); - bool load_audio(const string &filename,vector<Audio_processor*> processors); - bool load_video(const string &nodeID,const string &filename);//can be performance or clip - bool set_bitrate(int b){ - if (b>1000){ - bitRate=b; - return true; - } - else return false; - } - bool set_fragmentation(bool f){ - use_fragmentation=f; - return true; - } + std::string uid; + std::string description; + std::unordered_map<std::string,Node*> nodes; + std::vector<Node*> 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); + bool load(std::string data ,std::string media_path); + bool loadFile(std::string &filename,std::string media_path); + bool parseJson(std::string &data,std::string &media_path); + 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); + //bool load_audio(const std::string &filename, std::vector<Audio_processor*> processors); + bool load_video(const std::string &node_id,const std::string &filename); bool loaded; - double duration; - double framerate; - const string graphToString(); - xmlIO xml; bool audio_loaded; - string audio_filename; + std::string audio_filename; bool cancelled; double progress; - int bitRate; - void set_log_name(string _Log_name){ + void set_log_name (std::string _Log_name){ Log_name=_Log_name; } - Audio_thumbnailer *audio_thumb; + //Audio_thumbnailer *audio_thumb; private: - int outW,outH; - bool use_fragmentation; int analysis_seed; - string Log_name; + std::string Log_name; }; } -*/ #endif //GRAPH_H diff --git a/NT/src/nodes.h b/NT/src/nodes.h index 1632363..4b1b2ac 100644 --- a/NT/src/nodes.h +++ b/NT/src/nodes.h @@ -12,7 +12,13 @@ namespace Rotor{ }; class Time: public Double_node { public: - Time(){type="time";}; + Time(){ + type="time"; + description="time in fractional seconds"; + title="Time"; + type_id="4bdaaa7a-8194-11e3-8a4f-2ff6852ae2c7"; + ui_type="none"; + }; Time(Json::Value &settings):Time() { init(settings); }; @@ -56,6 +62,10 @@ namespace Rotor{ Print(){ inlet=create_inlet<double>("inlet"); type="print"; + description="number as a string"; + title="Print"; + type_id="9b9232b8-8194-11e3-a5a2-07659a1b53c3"; + ui_type="none"; } Print(Json::Value &settings):Print() { init(settings); diff --git a/NT/src/rotor.cpp b/NT/src/rotor.cpp index 1b75187..8fdec07 100644 --- a/NT/src/rotor.cpp +++ b/NT/src/rotor.cpp @@ -47,7 +47,7 @@ Json::Value Node::to_json(){ node["type"]=type; node["type_id"]=type_id; node["title"]=title; - node["output_type"]=get_type(); + node["output_type"]=get_output_type(); node["description"]=description; node["id"]=id; node["ui_type"]=ui_type; @@ -82,9 +82,11 @@ int main(){ delete p; */ Json::Value js; -f.list_node("multiply",js); +f.list_node("time",js); Json::StyledWriter writer; cerr<<writer.write(js)<<endl; +f.list_node("multiply",js); +cerr<<writer.write(js)<<endl; f.list_node("print",js); cerr<<writer.write(js)<<endl; } diff --git a/NT/src/testgraph.json b/NT/src/testgraph.json new file mode 100644 index 0000000..6d48284 --- /dev/null +++ b/NT/src/testgraph.json @@ -0,0 +1,43 @@ +{ + { + "id" : "5dadaf18-8194-11e3-93c7-0b0ba07b492b", + "type" : "time", + "type_id" : "4bdaaa7a-8194-11e3-8a4f-2ff6852ae2c7", + } + { + "id" : "d6d94d3e-8194-11e3-aa9c-4302e420eaaf", + "type" : "time", + "type_id" : "4bdaaa7a-8194-11e3-8a4f-2ff6852ae2c7", + } + { + "id" : "6aaa4820-8194-11e3-8b35-a7fa04a44d58", + "type" : "multiply", + "type_id" : "11c67850-7ce4-11e3-abf6-930ef8613c46", + "ui_type" : "none", + "vars" : [ + { + "connectable" : "yes", + "input" : [ + "5dadaf18-8194-11e3-93c7-0b0ba07b492b", + "d6d94d3e-8194-11e3-aa9c-4302e420eaaf" + ], + "name" : "factors", + "type" : "number" + } + ] + }, + { + "id" : "8d1d5348-8194-11e3-a483-b3ff8d9340ef", + "type" : "print", + "type_id" : "9b9232b8-8194-11e3-a5a2-07659a1b53c3", + "vars" : [ + { + "input" : "6aaa4820-8194-11e3-8b35-a7fa04a44d58", + "name" : "inlet", + "type" : "number" + } + ] + } +} + + |
