[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] Embedded routines and Conditions



The following works as expected:

c = Condition(false);

r = Routine({
"before".postln;
c.wait;
"after".postln;
}).play

c.test_(true).signal;

The Routine advances only when the Condition is changed. However, in a situation where the above Routine is embedded in another Routine, it behaves strangely:

c.test_(false); // reset the condition

Routine({
"before1".postln;
r.embedInStream;
"after1".postln;
}).play

c.test_(true).signal;

will yield:
before1
before
after1

and then, after changing the Condition:
after

The outside Routine is continuing on, instead of waiting for the Condition, though the inside routine is still waiting.

So, what am I doing wrong here? Is there another way I can approach this? Help would be much appreciated!

- Scott