[Clam-devel] Control objects

Pau Arumi parumi at iua.upf.edu
Sat Mar 31 12:50:13 PDT 2007

En/na Albert Graef ha escrit:
> Hi Pau,
> I'm forwarding this to the devel list now, so that maybe some other kind
> soul will relieve you from the burden of having to reply yourself. ;-)
>> controls threading is something that needs to be fixed: right now the
>> control registers are saved from the ui tread. and control callbacks (if
>> any) are also executed from ui thread. of course all this should be done
>> from the processing thread, once per Network::Do(). we need to add an
>> event queue that acts as the tread boundary.
> Yes, I remember that we discussed this at LAC. Lockfree queue data
> structures are readily available, so it should be easy enough to add
> this. Anyway, I don't think that this will be much of a problem for me
> right now.

ok. do you have any pointers to available lockfree queues?

>> anyhow, we are able (though not safely) to access processing object
>> state from the ui thread. actually controlt registers are processing
>> object attributes.
> Does "though not safely" mean that right now there will be races between
> the GUI thread updating the control values and the audio thread reading
> those values in the Do() method?


>> look at these examples. specially the "simple" one.
>> http://iua-share.upf.edu/svn/clam/trunk/CLAM/examples/ControlArrayExamples/
> Yes thanks, that was more or less what I was looking for. I browsed that
> code and also digged through the available tutorials, documentation and
> the wiki. Alas, I don't have the time to sift through the entire ml
> archives right now, and they don't have a search function. ;-) So I
> still have a few questions.
> 1. Is there a simple example which also shows how to do control
> *output*? This is supposed to be done in the Do() method, right?

probably not. but it works the obvious way.
for example, this is a control "wire":

InControl _in;
OutControl _out;
int Do()
	TControlData control = _in.GetLastValue()
	_out.SendControl( control );

> 2. How do I build a version of CLAM and/or the NetworkEditor which has
> my custom processing object included -- just add my class to the
> src/Processing tree?

it's easier it you put it in NetworkEditor, in

look other processings there to learn how we register processings to the
factory. for example:
static ProcessingFactory::Registrator<Random> regtRandom( "Random" );

finally add some entries in this structure in 
NetworkEditor/src/ProcessingTree.cxx (line 34)

const static char * processingClasses[] = {
	"my category",

this will be much easier in a near future. we are working towards
dynamically loadable clam processings plugins

> 3. Last but not least, I'll need to have a little configuration dialog
> which will allow the user to pick the Q function to be called for the
> control processing (similar to what the AudioFile object does when you
> enter the name of the file to be played). Does the NetworkEditor create
> that automagically from the configuration interface of the processing
> object or do I have to do my own with QtDesigner?

yes it's automatically created from the processing configuration object,
which is a (think we call) DynamicType.
it have some limitations, so in some cases we overwrite the automatic 

i have probably missed some things. just keep asking :-)

thanks for your interest for integrating Q in Clam.
btw, we have already started working with Faust integration. i'm very
excited on these two integrations!


More information about the clam-devel mailing list