3 summary::schedules functions to be evaluated in the future
6 A Scheduler can be used to schedule and reschedule functions to be evaluated at a specific time-point. The Scheduler's time needs to be advanced manually. In most cases you will probably want to use a Clock (e.g. link::Classes/TempoClock::, link::Classes/SystemClock::, link::Classes/AppClock::) instead, in which the march of time is handled for you.
12 A clock, like SystemClock.
14 If true, it will schedule the events relative to Main.elapsedTime, otherwise to the current seconds of the scheduler.
19 Schedules the task to play, with the delta time returned from it.
25 Advance time by n seconds. Any task that is scheduled within the new time, is evaluated, and, if it returns a new time, rescheduled.
28 Set new time. Any task that is scheduled within the new time, is evaluated, and, if it returns a new time, rescheduled.
31 Returns whether the scheduling queue is empty.
34 Clear the scheduling queue
39 a = Scheduler(SystemClock);
41 a.sched(3, { "now it is 3 seconds.".postln; nil });
42 a.sched(5, { "now it is 5 seconds.".postln; nil });
43 a.sched(1, { "now it is 1 second.".postln; nil });
50 // the beats, seconds and clock are passed into the task function:
51 a.sched(1, { arg beats, secs, clock; [beats, secs, clock].postln });
54 // the scheduling is relative to "now":
55 a.sched(3, { "now it was 3 seconds.".postln });
56 a.sched(5, { "now it was 5 seconds.".postln });
57 a.sched(1, { "now it was 1 second.".postln });
64 // play a Routine or a task:
65 a.play(Routine { 5.do { arg i; i.postln; 1.yield } });
72 x = Scheduler(TempoClock.default);
76 ("next " ++ i ++ " in task." + Main.elapsedTime).postln;
89 loop { x.advance(0.1); 0.1.wait };
103 Pbind(\degree, Pseries(0, 2, 8), \dur, 0.25).play(x);