We had a discussion about it the other day, tangentially.
It’s ok to not understand it at first glance. The implications of it will be obvious after a while.
Fundamentally, consider that there’s an actor that is interacting with a system. In this case you’re the actor, but generating events through the use of the mouse. But, what you’re really interested in is the number of impulses that will be played.
bus=Bus.control;
SynthDef(\mouse,{
arg bus;
var sig=MouseX.kr(0,50);
Out.kr(bus,sig);
}).add;
SynthDef(\imp,{
arg mouseinput;
var sig=In.kr(mouseinput);
sig= [ 4*sig,5*sig ];
sig=Impulse.ar(sig,0.0,0.2);
Out.ar(0,sig);
}).add;
a=Synth(\mouse,[\bus:bus]);
b=Synth(\imp,[\mouseinput:bus]);
// to read,
bus.get(|x|, { x.postln;});
// Then have a task that updates a gui element
<< the gui creation code here >>
t=Task({
inf.do({
bus.get(|x|, {
x.postln;
<<update gui part here>>.defer;
});
});
0.1.wait;
});
fork{
t.start(AppClock);
}
Eventually, when there’s enough number of parameters for display, it’s easier to have a function that generates all the intermediate steps and chains everything together.