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

Re: [sc-dev] Re: calling the stream upon EventStreamPlayer-stop



Hi James,

I think those are the appropriate semantics for CleanupStream, usually whatever needs to be done needs to be
done whether or not the stream runs to completion.

Can't you just use:

Pseq([p, Pfunc(finalFunc)])?


RJK

On Jan 1, 2006, at 8:35 PM, James Harkins wrote:

Hi Ron, 

The plot thickens ... calling the stream with a nil event has a side effect that I really can't live with. 

p = Pbind(\number, Pseries(0, 1, inf), \delta, 1.0).asStream;

e = EventStreamPlayer(CleanupStream(p, {
"this should execute when the stream ends, not on manual stop".postln;
}), (play: { ~number.postln }));

e.play;
an EventStreamPlayer
0
1
2
3
4
5

e.stop;
this should execute when the stream ends, not on manual stop
an EventStreamPlayer

e.play;
an EventStreamPlayer
// there is no further output from here

Effectively, this means EventStreamPlayer is no longer a PauseStream. It's impossible to pause the stream and resume it later, because stream.next(nil) causes the stream to abort. It can't be recovered. Part of the spec in my compositional framework is that you should be able to resume sequencing processes where they left off.

Also, in some new code I'm working on, I need the ability to stop an event stream player without triggering the CleanupStream (it sends some notifications and releases some resources).

It's easy to work around because I don't use Pmono and I personally have no need to support it in my framework. (IMHO, Pmono is an attempt to roll functionality into patterns and streams that doesn't really belong there and that these issues are evidence of that, but if we must support Pmono then I won't make a big stink about it.) I can just implement an alternate stop method and be done with it. 

It's unfortunate, though, that when I release this code, I'll have to document it that Pmono won't work. I can provide some alternate techniques, though. 

If you have any better ideas for how to handle Pmono as well as my requirements, I'd be glad to hear them. Thanks.

hjh

: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

_______________________________________________
sc-dev mailing list