#include "rotor.h" #include "nodes_audio_analysis.h" #include "nodes_maths.h" #include "nodes_drawing.h" #include "nodes_filters.h" #include "nodes_transform.h" using namespace Rotor; using Poco::Logger; Node_factory::Node_factory(){ //for now, statically load prototype map in constructor //how to deal with categories //have an associative array of arrays of pointers to nodes, "categories" //this can be hard coded also // categories["signals"]=vector(); add_type("time",new Time(),categories["signals"]); add_type("track_time",new Track_time(),categories["signals"]); add_type("at_track_time",new At_track_time(),categories["signals"]); // add_type("signal_output",new Signal_output()); add_type("testcard",new Testcard()); // categories["channels"]=vector(); add_type("invert",new Invert(),categories["channels"]); add_type("monochrome",new Monochrome(),categories["channels"]); add_type("blend",new Blend(),categories["channels"]); add_type("image_arithmetic",new Image_arithmetic(),categories["channels"]); add_type("alpha_merge",new Alpha_merge(),categories["channels"]); add_type("difference_matte",new Difference_matte(),categories["channels"]); add_type("rgb_levels",new RGB_levels(),categories["channels"]); add_type("luma_levels",new Luma_levels(),categories["channels"]); categories["source"]=vector(); add_type("signal_colour",new Signal_colour(),categories["source"]); add_type("signal_greyscale",new Signal_greyscale(),categories["source"]); add_type("shape",new Shape(),categories["source"]); add_type("text",new Text(),categories["source"]); add_type("waves",new Waves(),categories["source"]); add_type("still_image",new Still_image(),categories["source"]); add_type("video_loader",new Video_loader(),categories["source"]); categories["distort"]=vector(); add_type("mirror",new Mirror(),categories["distort"]); add_type("transform",new Transform(),categories["distort"]); categories["editing"]=vector(); add_type("video_cycler",new Video_cycler(),categories["editing"]); add_type("video_output",new Video_output(),categories["editing"]); add_type("act_segmenter",new Act_segmenter(),categories["editing"]); categories["audio"]=vector(); add_type("audio_analysis",new Audio_analysis(),categories["audio"]); categories["maths"]=vector(); add_type("comparison",new Comparison(),categories["maths"]); //TODO: alias to symbols add_type("arithmetic",new Arithmetic(),categories["maths"]); //TODO: alias to symbols add_type("bang",new Is_new_integer(),categories["maths"]); add_type("on_off",new On_off(),categories["maths"]); add_type("random",new Random(),categories["maths"]); categories["fx"]=vector(); add_type("blur",new Blur(),categories["fx"]); add_type("vhs",new VHS(),categories["fx"]); add_type("echo_trails",new Echo_trails(),categories["fx"]); add_type("video_feedback",new Video_feedback(),categories["fx"]); } bool Signal_input::connect(Node* source) { connection=dynamic_cast(source); if (connection) return true; else return false; } float Signal_input::get(const Time_spec& time){ //gets input and updates variable if (connection){ return (((Signal_node*)connection)->get_output(time)); } else return 0.0f; } bool Image_input::connect(Node* source) { connection=dynamic_cast(source); if (connection) return true; else return false; } Image* Image_input::get(const Frame_spec& time){ //gets input and updates variable if (connection){ return (((Image_node*)connection)->get_image_output(time)); } else return nullptr; } float Parameter::get(const Time_spec& time){ //gets input and updates variable if (connection){ value = ((Signal_node*)connection)->get_output(time); } return value; }