Pspawner allows a routine to dynamically start and stop subpatterns.
Pspawner.new(routineFunc)
Arguments:
routineFunc |
The function defines a Routine that receives a Spawner as its sole argument. All control of subpatterns is through the spawner.
Spawner responds to the messages:
- par
- Begin an event stream in parallel to the routine. If delta is non-zero, the pattern will begin that many beats after 'now', provided that now + delta is later than the next event that the Spawner will generate. The method returns the stream. This may be called from any object.
- seq
- Run the entire pattern and then return control to the routine.
- wait
- Wait dur seconds and then return control to the routine.
- suspend
- Find the stream in the Spawner and stop it, returns nil if the stream is not found, the stream otherwise.
- suspendAll
- Stop all substreams of the Spawner.
NOTE: These are also documented in Spawner. |