I see one can set this flag which by default is false to true and that will rebuild the msgFunc
of the SynthDef, e.g.
SynthDescLib.global[\default].msgFuncKeepGate = true
but I can’t figure out what’s different with that flag on. The controls, at least for the default synthdef include gate
for either setting… So when is that msgFuncKeepGate
actually effective? I see the actual msgFunc is changed. With keep… true
SynthDescLib.global[\default].msgFunc.cs
-> #{ arg out, freq, amp, pan, gate;
var x3E7438F4 = Array.new(10);
out !? { x3E7438F4.add('out').add(out) };
freq !? { x3E7438F4.add('freq').add(freq) };
amp !? { x3E7438F4.add('amp').add(amp) };
pan !? { x3E7438F4.add('pan').add(pan) };
gate !? { x3E7438F4.add('gate').add(gate) };
x3E7438F4
SynthDescLib.global[\default].msgFuncKeepGate = false
SynthDescLib.global[\default].msgFunc.cs
-> #{ arg out, freq, amp, pan;
var x3E7438F4 = Array.new(8);
out !? { x3E7438F4.add('out').add(out) };
freq !? { x3E7438F4.add('freq').add(freq) };
amp !? { x3E7438F4.add('amp').add(amp) };
pan !? { x3E7438F4.add('pan').add(pan) };
x3E7438F4
However, because Event.default
has args: #[\freq, \amp, \pan, \trig],
and Event \set
looks at ~args
size before deciding whether to look at ~msgFunc
, it’s actually a bit tricky to test this:
y = Synth(\default)
(type: \set, id: y.nodeID, gate: 0, args: []).play // resets freq, doesn't turn off
(type: \set, id: y.nodeID, gate: 0, args: [\gate]).play // turns off
SynthDescLib.global[\default].msgFuncKeepGate = true
y = Synth(\default)
(type: \set, id: y.nodeID, gate: 0, args: []).play // now resets freq AND turns off
So clearly the ~msgFunc is “gate-capable” in the latter case (after msgFuncKeepGate is turned on) and it does make a difference in Event-set use… but still I don’t get it why the frequency (still) resets with keep true… (I guess it’s because there are no default values in the msgFunc. Still the freq gets set to some 260 Hz or so…)