From 5eb823abb8ba91dbab098d7195094d0f76e4f332 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 21 Nov 2013 12:36:36 +0000 Subject: UI text node outline --- rotord/src/nodes_drawing.h | 19 +++++++++++++++++++ rotord/src/rotor.cpp | 5 +++++ rotord/src/rotor.h | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index 77a74cb..288514c 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -111,6 +111,25 @@ namespace Rotor { } private: }; + class UI_text: public Text_base { + public: + UI_text(){ + title="UI_text"; + description="Draws text entered by the user"; + create_attribute("text","Text to draw","Text","hello, world!"); + NODEID="22b47bea-52a9-11e3-b2b3-74d02b29f6a6"; + UItype="text"; + }; + UI_text(map &settings):UI_text() { + base_settings(settings); + }; + ~UI_text(){}; + UI_text* clone(map &_settings) { return new UI_text(_settings);}; + string select_text(const Frame_spec &frame){ + return attributes["text"]->value; + } + private: + }; class Lyrics: public Text_base { public: Lyrics(){ diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp index 0bb9341..b7bf642 100644 --- a/rotord/src/rotor.cpp +++ b/rotord/src/rotor.cpp @@ -77,6 +77,9 @@ Node_factory::Node_factory(){ add_type("echo_trails",new Echo_trails(),category["FX"]); add_type("video_feedback",new Video_feedback(),category["FX"]); + category["UI"]=vector(); + add_type("ui_text",new UI_text(),category["UI"]); + } bool Signal_input::connect(Node* source) { connection=dynamic_cast(source); @@ -135,6 +138,7 @@ Json::Value Node_factory::list_node(Rotor::Node* _node){ if (dynamic_cast (_node)!=nullptr) node["output"]="image"; node["description"]=_node->description; node["NODEID"]=_node->NODEID; + node["UItype"]=_node->UItype; if (_node->inputs.size()){ node["signal_inputs"]=Json::arrayValue; for (auto& input: _node->inputs) { @@ -204,6 +208,7 @@ void Node_factory::list_node(Rotor::Node* type,xmlIO XML,int i){ XML.addAttribute("node","title",type->title,i); XML.addAttribute("node","description",type->description,i); XML.addAttribute("node","NODEID",type->NODEID,i); + XML.addAttribute("node","UItype",type->UItype,i); if (dynamic_cast (type)!=nullptr) XML.addAttribute("node","output","signal",i); if (dynamic_cast (type)!=nullptr) XML.addAttribute("node","output","image",i); XML.pushTag("node",i); diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index 0833096..3874df6 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -280,7 +280,7 @@ namespace Rotor { }; class Node{ public: - Node(){duplicate_inputs=false;}; + Node(){duplicate_inputs=false;UItype="";}; virtual Node* clone(map &_settings)=0; //pure virtual virtual ~Node(){ for (auto a: attributes) delete a.second; @@ -320,6 +320,7 @@ namespace Rotor { string ID; string NODEID; string title; + string UItype; bool duplicate_inputs; string find_setting(map &settings,string key,string def=""){ if (settings.find(key)!=settings.end()) return settings[key]; else return def;}; float find_setting(map &settings,string key,float def){ if (settings.find(key)!=settings.end()) return toFloat(settings[key]); else return def;}; -- cgit v1.2.3 From f884e52ba3e454cbe0f1ac5bfd288083b47a237c Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 21 Nov 2013 13:40:05 +0000 Subject: fix mix mode cycler skip --- rotord/src/rotor.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index 3874df6..624e0f0 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -584,11 +584,11 @@ namespace Rotor { return nullptr; } //cut mode - for (uint32_t i=0;iget((Time_spec)frame)+i)%image_inputs.size(); + //for (uint32_t i=0;iget((Time_spec)frame)))%image_inputs.size(); //+i Image *in=image_inputs[whichinput]->get(inframe); if (in) return in; - } + //} return nullptr; } Video_cycler* clone(map &_settings) { return new Video_cycler(_settings);}; -- cgit v1.2.3 From 6a9e9a8f44ca5b9996acd239ddb16ee4f00f00d5 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 21 Nov 2013 16:10:21 +0000 Subject: intensity segmenter level redistribution --- rotord/src/nodes_audio_analysis.cpp | 22 +++++++++++++++++++++- rotord/src/nodes_audio_analysis.h | 1 + rotord/src/rotor.h | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/rotord/src/nodes_audio_analysis.cpp b/rotord/src/nodes_audio_analysis.cpp index 6ec1188..ad6f5ad 100644 --- a/rotord/src/nodes_audio_analysis.cpp +++ b/rotord/src/nodes_audio_analysis.cpp @@ -178,9 +178,29 @@ namespace Rotor{ } //sort and convert to features std::sort(totals.begin(),totals.end(),sortsegments); + vector bucketoffsets; + for (auto t:totals) bucketoffsets.push_back(0.0f); + if (parameters["levels"]->value>0.0f&¶meters["levels"]->valuevalue); + int numberperbin=ceil((float)numbertoredistribute/totals.size()); + int added=0; + for (int j=0;j0) { + cerr<<"reducing number of levels by "< &settings):Intensity_segmenter() { base_settings(settings); diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index 624e0f0..e882c05 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -584,7 +584,7 @@ namespace Rotor { return nullptr; } //cut mode - //for (uint32_t i=0;iget((Time_spec)frame)))%image_inputs.size(); //+i Image *in=image_inputs[whichinput]->get(inframe); if (in) return in; -- cgit v1.2.3 From daadf9e268759f2052ccc1e30a201fe687ee4336 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 22 Nov 2013 14:18:24 +0000 Subject: intensity segmenter levels --- rotord/src/nodes_audio_analysis.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/rotord/src/nodes_audio_analysis.cpp b/rotord/src/nodes_audio_analysis.cpp index ad6f5ad..5770fb2 100644 --- a/rotord/src/nodes_audio_analysis.cpp +++ b/rotord/src/nodes_audio_analysis.cpp @@ -182,12 +182,14 @@ namespace Rotor{ for (auto t:totals) bucketoffsets.push_back(0.0f); if (parameters["levels"]->value>0.0f&¶meters["levels"]->valuevalue); - int numberperbin=ceil((float)numbertoredistribute/totals.size()); + int numbertoredistribute=totals.size()-((int)parameters["levels"]->value-2); + float numberperbin=((float)numbertoredistribute/totals.size()); + float toadd=0.0f; int added=0; - for (int j=0;j0) { @@ -200,7 +202,7 @@ namespace Rotor{ } for (i=0;i Date: Fri, 22 Nov 2013 15:19:51 +0000 Subject: intensity segmenter update --- rotord/src/nodes_audio_analysis.cpp | 11 +++++++---- rotord/src/nodes_audio_analysis.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/rotord/src/nodes_audio_analysis.cpp b/rotord/src/nodes_audio_analysis.cpp index 5770fb2..9ad33f6 100644 --- a/rotord/src/nodes_audio_analysis.cpp +++ b/rotord/src/nodes_audio_analysis.cpp @@ -69,6 +69,7 @@ namespace Rotor{ bits=_bits; samples=_samples; + features.clear(); return analyser.init(soname,id,_channels,_bits,_samples,_rate,outputNo,params); @@ -167,7 +168,6 @@ namespace Rotor{ if (intensity>max_intensity) max_intensity=intensity; if (intensity> totals; @@ -178,19 +178,22 @@ namespace Rotor{ } //sort and convert to features std::sort(totals.begin(),totals.end(),sortsegments); + for (i=0;i bucketoffsets; for (auto t:totals) bucketoffsets.push_back(0.0f); if (parameters["levels"]->value>0.0f&¶meters["levels"]->valuevalue-2); + int numbertoredistribute=totals.size()-((int)parameters["levels"]->value); float numberperbin=((float)numbertoredistribute/totals.size()); - float toadd=0.0f; + float toadd=0.5f; int added=0; for (int j=0;j0) { cerr<<"reducing number of levels by "< &_settings) { return new Intensity_segmenter(_settings);}; bool init(int _channels,int _bits,int _samples,int _rate) { + features.clear(); return analysers["segmenter"].init("qm-vamp-plugins","qm-segmenter",_channels,_bits,_samples,_rate,0,params)\ &&analysers["tempo"].init("qm-vamp-plugins","qm-tempotracker",_channels,_bits,_samples,_rate,2,params)\ &&analysers["intensity"].init("bbc-vamp-plugins","bbc-intensity",_channels,_bits,_samples,_rate,0,params); -- cgit v1.2.3 From 5d8f8a40b50aa9e7237d972fe6fbf30279acf518 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 22 Nov 2013 15:48:58 +0000 Subject: adding new font --- fonts/Akzidenz Grotesk (R) Condensed Medium.ttf | Bin 0 -> 45700 bytes rotord/src/nodes_drawing.h | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 fonts/Akzidenz Grotesk (R) Condensed Medium.ttf diff --git a/fonts/Akzidenz Grotesk (R) Condensed Medium.ttf b/fonts/Akzidenz Grotesk (R) Condensed Medium.ttf new file mode 100644 index 0000000..8c8189a Binary files /dev/null and b/fonts/Akzidenz Grotesk (R) Condensed Medium.ttf differ diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index 288514c..8fe5d71 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -62,7 +62,7 @@ namespace Rotor { public: Text_base(){ create_attribute("colour","Colour to fill","Colour","FFFFFF"); - create_attribute("font","font to use","Font","Sans",{"Sans","Sans Mono","Serif"}); + create_attribute("font","font to use","Font","Akzidenz",{"Sans","Sans Mono","Serif","Akzidenz"}); create_parameter("size","number","Point size of font","size",50.0f); NODEID="7da93b94-2d0b-11e3-8940-77bce0f9d3e8"; }; @@ -76,7 +76,18 @@ namespace Rotor { string text=select_text(frame); cairo_text_extents_t te; cairo_set_source_rgb(cr, colour.Rfloat(),colour.Gfloat(),colour.Bfloat()); - cairo_select_font_face (cr, ("DejaVu "+attributes["font"]->value).c_str(), + string fontname; + switch (attributes["font"]->intVal){ + case 1: + case 2: + case 3: + fontname="DejaVu "+attributes["font"]->value; + break; + case 4: + fontname="Akzidenz-Grotesk Condensed BQ"; + break; + } + cairo_select_font_face (cr,fontname.c_str(), CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size (cr, parameters["size"]->value*(((float)frame.w)/360.0f)); cairo_text_extents(cr, text.c_str(), &te); -- cgit v1.2.3