I think I've figured it out, but it's not an ideal solution (it involves a special embedInStream method for Routines that works slightly differently, as well as a slight modification to Condition.wait). Basically, instead of stopping when it hits the first nil value, the modified .embedInStream continues until the Routine is actually finished. Any nil's are yielded all the way down the chain, so an embedded Routine can pause all of it's parents. I have no idea whether the embedInStream modification safe (it might break other things), but I'm going to see how it works. And, it solves my problem - I can now use Conditions in embedded Routines.
A better solution would be if Condition.wait yielded an inf instead of nil - conceptually, this makes more sense (wait forever, rather than stop playback entirely). Nil could then work as it does now, but some clock/scheduling code would have to be changed to treat inf exactly like it would treat nil (i.e. stop scheduling) - currently, yielding inf crashes SC.
- Scott On Oct 18, 2007, at 11:48 AM, Julian Rohrhuber wrote:
you are embedding streams (Routine) and not patterns, so you'd have to reset the first routine, since you've used it already.Routine({ "before1".postln; r.reset.embedInStream; "after1".postln; }).playThe 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: afterThe 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 _______________________________________________ sc-users mailing list sc-users@xxxxxxxxxxxxxxx http://www.create.ucsb.edu/mailman/listinfo/sc-users-- . _______________________________________________ sc-users mailing list sc-users@xxxxxxxxxxxxxxx http://www.create.ucsb.edu/mailman/listinfo/sc-users