On Jul 21, 2009, at 12:18 PM, Hjalte Møller wrote: Thank's James, That's a bit trickier, because it isn't the embedded pattern that comes to an end. It's really the stream made from that pattern that finishes. Attaching a dependent to the pattern itself wouldn't help because the pattern's state doesn't change (hence nothing to update). I know to little about Streams and Events to really know what is possible here, but it would nice to have something to put into a pattern itself. Maybe a pattern object like Pfunc, but Pended, so if the stream containing it ends it evaluates... Off the top of my head: a = Pbind(\degree, Pseries(0, 1, 8), \dur, 0.25); a = Pseq([a, Pfuncn { /* send notification here */; Event.silent(0) }], 1); b = Pseq([b, Pfuncn { /* send notification here */; Event.silent(0) }], 1); Pseq([a,b], inf).play f = { |pattern, endAction| Pseq([a, Pfuncn { endAction.value; Event.silent(0) }], 1); }; Pseq([f.(a), f.(b)], inf) Note that this would handle streams stopping by themselves, but not an explicit stop by the user. For the latter, look at Pfset. hjh : H. James Harkins .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..: "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman |