From fc9b92ea1ab78e8f8b441cef2416eb73472ff106 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 23 May 2014 09:45:50 +0100 Subject: variable type getter/setter --- NT/src/nodes_source.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'NT/src/nodes_source.h') diff --git a/NT/src/nodes_source.h b/NT/src/nodes_source.h index ede0dcb..ffc826f 100644 --- a/NT/src/nodes_source.h +++ b/NT/src/nodes_source.h @@ -10,45 +10,48 @@ namespace Rotor { //1 - a data type which is a variable length array of data [as opposed to a array of inlets] //2 - a way to initialise this from json //enum - this is a hack to achieve this? designed for option selectors, can it work here? - //or just parse a string into a list of colours? + + //for now: just parse a string into a list of colours + Signal_colour(){ selector=create_inlet("selector"); - palette=create_inlet("palette","colour to choose from palette","Palette","000000") + palette=create_inlet("palette","colour to choose from palette","Palette","000000"); //create_attribute("palette","palette list of web colours","Colour palette","000000"); + type="signal_colour"; title="Signal colour"; description="Cycles through a palette of background colours according to selector signal"; - NODEID="a2183fe0-2d09-11e3-9a64-538ee2cf40bc"; + type_id="a2183fe0-2d09-11e3-9a64-538ee2cf40bc"; }; - Signal_colour(map &settings):Signal_colour() { - base_settings(settings); - for (uint32_t i=0;ivalue.size()/6;i++){ - palette.push_back(Colour(attributes["palette"]->value.substr(i*6,6))); + Signal_colour(Json::Value &settings):Signal_colour() { + init(settings); + for (uint32_t i=0;ivalue.substr(i*6,6))); } prevcol=-1; }; ~Signal_colour(){}; - Image *output(const Frame_spec &frame){ + const Image &output(const Frame_parameters &frame){ if (palette.size()) { int col=((int)inputs[0]->get((Time_spec)frame))%palette.size(); //if (col!=prevcol) cerr<<"colour now "< &_settings) { return new Signal_colour(_settings);}; private: - vector palette; + vector colours; int prevcol; Number_inlet *selector; - Enum_inlet *palette; + String_inlet *palette; }; /* class Signal_greyscale: public Image_node { -- cgit v1.2.3