Hi!
I’m working on a UGen for interpreting bytebeat expressions on the fly. I’m using a UnitCmd to send strings containing expressions to the UGen for parsing.
On the sclang side, the interface looks like this:
(
SynthDef.new(\bytebeat, {
var t = PulseCount.ar(Impulse.ar(8000));
Out.ar(0, ByteBeat.ar(t).dup)
}).add;
)
b = ByteBeatController(Synth.new(\bytebeat), 2);
b.eval("((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7");
The second parameter of ByteBeatController
is the index of the ByteBeat
UGen in the Synth. The controller uses this to send the UnitCmd to the UGen: synth.server.sendMsg('/u_cmd', synth.nodeID, synthIndex, cmd, *args)
.
I’d like to avoid having to manually provide the index. Is it possible to determine it automatically from the Synth instance?
Thanks!