Hello,
Sorry for the noob question, but is it somehow possible for the argument of the while loop to update/refresh itself with the current status of the global variable (~switch1 when I change it’s value from1 to 0 elsewhere) from within ?
~check = {arg switch;
while({switch > 0},{
"waiting".postln;
1.wait;
})}
Routine({
1.postln;
1.wait;
~switch1 = 0;
~switch2 = 0;
~check.value(~switch1 + ~switch2);
2.postln;
1.wait;
3.postln;
1.wait;
~switch1 = 1;
~check.value(~switch1); //here gets stuck
4.postln;
1.wait;
5.postln;
1.wait;
}).play
~switch1 = 0 // I would like to resume it by executing this
I would like to avoid using many of these :
~check1 = {
while({~switch1 > 0},{
"waiting".postln;
1.wait;
})};
~check2 = {
while({~switch1 + ~switch2 > 0},{
"waiting".postln;
1.wait;
})}
Thank you !