diff options
Diffstat (limited to 'rotord/src/rotor.h')
| -rw-r--r-- | rotord/src/rotor.h | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index a2c33d2..1c8e992 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -209,9 +209,24 @@ namespace Rotor { float get(const Time_spec& time); string type; }; + /* + tributes want to be extended beyond the original vision of a string that can be interpreted in different ways + could be a template? + typedef attribute<int32_t> intattribute; + could be a subclass ie + attributes=vector<attribute*> + class lyrics_attribute : public attribut + if(<dynamic_cast>(lyrics_attribute)attributes["lyrics"]) { + thislyric=(lyrics_attribute)attributes["lyrics"].findkey(1); + } + + 1) generic way to define and use attributes of different types + + */ class Attribute{ //description of a static attribute which can be an enumerated string array public: virtual ~Attribute(){}; + Attribute(){}; Attribute(const string &_desc,const string &_title,const string &_value,std::vector<std::string> _vals={},std::string _type="string"): description(_desc),title(_title),value(_value),intVal(0),type(_type){ vals=_vals; init(_value); @@ -236,6 +251,27 @@ namespace Rotor { std::vector<std::string> vals; }; + class Lyrics_attribute: public Attribute{ //description of a static attribute which can be an enumerated string array + public: + virtual ~Lyrics_attribute(){}; + Lyrics_attribute(const string &_desc,const string &_title){ + description=_desc; + title=_title; + type="lyrics"; + }; + void init(const std::map<float,std::pair<string,float> > _lyrics){ + lyrics=_lyrics; + for (auto l:lyrics){ + cerr<<l.first<<":"<<l.second.first<<" ("<<l.second.second<<")"<<endl; + } + } + const string &get_lyric(const Time_spec &time){ + + } + private: + std::map<float,std::pair<string,float> > lyrics; + + }; class Node{ public: Node(){duplicate_inputs=false;}; @@ -258,6 +294,11 @@ namespace Rotor { if (_vals.size()&&_type!="array") _type="enum"; //hack for incomplete attribute types attributes[_attr]=new Attribute(_desc,_title,_value,_vals,_type); }; + void create_empty_attribute(const string &_attr,const string &_desc,const string &_title,const string &_type="string") { + //initialiser without initialisation + if (_type=="lyrics") attributes[_attr]=new Lyrics_attribute(_desc,_title); + else attributes[_attr]=new Attribute(_desc,_title,"",{},_type); + }; void create_attribute(string *alias,const string &_attr,const string &_desc,const string &_title,const string &_value,std::vector<std::string> _vals={},std::string _type="string") { create_attribute(_attr,_desc,_title,_value,_vals,_type); alias=&(attributes[_attr]->value); @@ -396,7 +437,7 @@ namespace Rotor { Video_cycler(){ create_image_input("Image input","Image input"); create_signal_input("Selector","Selector input"); - create_attribute("mode","Cycling mode {cut|mix}","Mode","cut",{"cut","mix"}); + create_attribute("mode","Cycling mode","Mode","cut",{"cut","mix"}); create_attribute("length_mode","Transition length mode","Length mode","seconds",{"seconds","fraction"}); create_attribute("time_mode","Time mode","time mode","absolute",{"absolute","relative"}); create_parameter("transition_length","number","transition length","Transition length",-1.0f,0.0f,0.0f); |
