jeremyz
1
Hello! Hoping to not have to redesign a somewhat complicated patch. In the example below, is there a way to stop all routines?
(
r = { |freqLo=220, freqHi=1500|
fork({
inf.do({
s.sendBundle(0.1, ["/s_new", \sin, -1, 0, 0, \freq, rrand(freqLo, freqHi)]);
[0.25, 1/3, 0.5].choose.wait;
});
});
};
)
~a1 = Array.fill(4, {2.do{r.value}});
~a1.collect{|i| i.stop}; //how to stop the child routines?
Thanks!
-jz
lgvr123
2
If instead of writing this
You wrote it like this
//~a1 = Array.fill(4, r);
~a1 = Array.fill(4, r!2);
Then you array would contain a reference to the routines, and the you could stop them:
// the "isArray" is for the case one work with MultiChannel expansion
~a1.collect{|i| i.isArray.if({i.collect(_.stop)},{i.stop})}; /
jeremyz
3
That’s fantastic. Thanks so much!
-j
jeremyz
4
Ran into another question. Why does this work as expected
~a1 = Array.fill(4, r!2);
but not this:
~a1 = Array.fill(4, {r.value(350, 700)!2})
Thanks again
Should be like this, I think:
~a1 = Array.fill(4, { { r.value(350, 700) } ! 2 })
// or, using consistent syntax
~a1 = Array.fill(4, { Array.fill(2, { r.value(350, 700) }) })
hjh
jeremyz
6
Awesome. Thanks, James! Hope you’re well!
-j