That can be a tricky problem when you have conflicting requests on the
scheduler.
The way I solved this in my performance code is with, essentially, an
event stream player wrapper that maintains a couple of flags:
isPlaying and isWaiting. The wrapper can start playback only when
isPlaying is false and isWaiting is true, and it can stop only when
isPlaying is true and isWaiting is false.
If you do play and stop in quick succession, it goes like this:
play: isWaiting = true, schedule ESP play
stop: schedule ESP stop
stop schedule fires: set isWaiting = false, attempt stop (no effect
because not playing)
play schedule fires: isWaiting is false, so play cannot proceed
Similar if you're playing, and do stop and play quickly:
isPlaying = true
stop: set isWaiting = false, schedule ESP stop
play: isWaiting = true, schedule ESP play
stop schedule fires: isWaiting is true, stop request is ignored and
isWaiting is set to false
play schedule fires: isWaiting is false and isPlaying is true, so we
are already playing and there's no need to play again (i.e. no loop
overlap)
It's something like that... I'm going from memory and I might have
some of the details wrong.
Something similar could be done with a routine or Task wrapper.
Let me know if you need more detail on this -- whether it's "the"
solution or not, I can't say, but I know it's robust for me.
hjh
On 9/20/05, LF <lerbyf@xxxxxxxxx> wrote:
why do I get several loops overlapping?
is there a way to stop it, so that I only have one loop producing
synths?
it seems that if I stop, reset and play the routing before the
2.wait has
happened,
then the loop duplicates, and the routine does not stop and reset.
is this an incorrect behavior of Routine?
what is the solution?
--
James Harkins /// dewdrop world
jamshark70@xxxxxxxxxxxxxxxxx
http://www.dewdrop-world.net
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman
_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users