This is how I define my Synth groups in my default workset:
(
ServerTree.removeServer(s);
ServerTree.add({
~soundGrp=Group.new;
~effectGrp=Group.after(~soundGrp);
~mixerGrp=Group.after(~effectGrp);
~masterGrp=Group.after(~mixerGrp);
~mix=Synth(\Mixer,args: [\vol1,1,\vol2,1],target: ~mixerGrp);
},s);
CmdPeriod.run;
)
And one basic pattern:
p=Pbind(\scale, Scale.dorian, \degree, Pwhite(0,7), \dur, 0.25, \out, ~channel1, \group, ~soundGrp);
When pressing Ctrl+. all the groups are released and then recreated, and the variables are getting a new value. That’s ok, except that any pattern playing in one of those groups is “lost” after Ctrl+. . A p.play
will not produced any sound, because the group referred in the pattern does not exist any more.
One option to get those patterns working again is to re-evaluate all the patterns after a Ctrl+. . But this is not really convenient to my opinion.
Are there better options ?
-
Is there a way to reuse groups id ? So that
~soundGrp
remains unchanged after the Ctrl+. ? -
What about references ? It is working fine for the patterns but not so well with Synths:
E.g.
// define as Ref objects
~soundGrp=`0;
// add default groups and synths
ServerTree.removeServer(s);
ServerTree.add({
~soundGrp.value=Group.new;
},s);
)
// ~mix=Synth(\Mixer,args: [\vol1,1,\vol2,0.2],target: ~mixerGrp); // KO.
~mix=Synth(\Mixer,args: [\vol1,1,\vol2,0.2],target: ~mixerGrp.value); // OK -> for Synth, the reference **must** be resolved. Prone to error.
p=Pbind(\scale, Scale.dorian, \degree, Pwhite(0,7), \dur, 0.25, \out, ~channel1, \group, ~soundGrp); // OK -> for patterns, the reference **must not** be resolved.
So, what would be a convenient method to “preserve” the groups variables after Ctrl+. , working fine with both Synth and Patterns ?