Processings with controls

From Clam

Unlike ports, controls are not bound to the execution of the Do method. Controls are sent and received inmediately. When a processing Do gets executed it just gets the last received value.

You can define and initialize InControls and OutControls in a similar way you did with In/OutPorts but they are not templated (to the date) since they are always CLAM::TControlData which renders to float or double depending on your compilation flags.

First you should add the necessary includes:

       #include<CLAM/InControl.hxx>
       #include<CLAM/OutControl.hxx>

Then you are ready to add your input and output controls to the class declaration:

NetworkEditor represents controls as little squares on the top and the bottom of the processing box. Control flow is up-down.
Enlarge
NetworkEditor represents controls as little squares on the top and the bottom of the processing box. Control flow is up-down.
	...
	CLAM::InPort<MyInputDataType> mIn;
	CLAM::OutPort<MyOutputDataType> mOut;
	CLAM::InControl mInControl;         // <- New
	CLAM::OutControl mOutControl;       // <- New
	...

And at the initialization of the class:

	MyProcessing(const Config & config=Config()) 
		: mIn("My Input", this)
		, mOut("My Output", this) 
		, mInControl("In Control", this)   // <- New
		, mOutControl("Out Control", this)  // <- New
	{
	....

TODO: Correct place to set default input values: constructor, ConcreteConfigure or ConcreteStart?

	....
	mInControl.DoControl(3.1416);
	....


Within the Do method, whenever we want to read a input value just do:

	....
	CLAM::TControlData controlValue = mInControl.GetLastValue();
	....

And to send a value through a output control:

	....
	mOutControl.SendControl(3.1416);
	....
Several control related processing are available on the NetworkEditor.
Enlarge
Several control related processing are available on the NetworkEditor.

When playing with controls there are several useful processings available on the NetworkEditor:

  • ControlSender: Controls a single output control with a Slider, a Knob or an Spinbox.
  • ControlSurface: Controls two output controls at a time by moving a 2D point.
  • ControlPrinter: Shows the values it gets on its input controls.
  • ...

TODO: Put here a note on ControlSource and ControlSink as soon as they are working on the Network editor.