When you “plug” a Ndef y
into one of the sources
slots of another x
Ndef’s, e.g. x[3] = y
, the object that is plugged in Ndef’s x
objects
array is actually a BusPlug.
But this only routes the output of y
to x
's own bus. It does nothing for the controls of y
, which I find somewhat limiting, because I end up juggling multiple objects either mentally or on-screen.
Ndef(\y, { arg freq = 555; 0.1 * SinOsc.ar(freq) })
Ndef(\x, { Silent.ar })
Ndef(\x)[1] = Ndef(\y)
Ndef(\x).play.edit // zero controls
Ndef(\x).set(\freq, 999) // does nothing, of course
Ndef(\y).set(\freq, 999) // still have to do it from here
I’d like some auto-routing magic that does make Ndef(\x).set(\freq
work
for all controls of y
.
At a brainstorming level, syntactically this could be something like a (new) NodeProxy role although the direction of the arrow looks a big wrong, visually, for the intended semantics…
Ndef(\x)[1] = \dock -> Ndef(\y)
So, has anyone written something that extends BusPlug so that it also “slaves” the controls of y
to x
, meaning map all of them to some controls in x
?
Basically y
would lose its own controls while “slaved”, but you’d be able to control it through x
, which would provide a unified interface. I realize you could more or less do this without touching the Ndef themselves by some GUI docking of widgets in groups, but GUI docking support is rater non-existent in sclang, as far as I can tell, and I’m not talking about scide here, I know the IDE has docking for its own windows, but you can’t really dock sclang-generated windows either in the ide nor with each other, as far as I can tell.
A bit later, it occurred to me that to keep with the SC terminology, it would be best if I called it \wrap
, based on the obvious analogy with SynthDef.wrap
, rather than \dock
. (SynthDef.wrap
also collects the Controls from the “sub-function” into the “master list” of Controls of the enclosing SynthDef.) Perhaps, in those more familiar terms, someone else has considered it already, for Ndefs, I mean.