2 categories::Scheduling>Clocks
3 summary::Clock running on main application thread
4 related::Classes/SystemClock, Classes/TempoClock
7 SystemClock is more accurate, but cannot call Cocoa primitives. AppClock is less accurate (uses NSTimers) but can call Cocoa primitives.
9 You will need to use the link::Classes/SystemClock:: to get accurate/musical scheduling.
16 The float you return specifies the delta to resched the function for. Returning nil will stop the task from being rescheduled.
19 AppClock.sched(0.0,{ arg time;
20 ["AppClock has been playing for ",time].postln;
28 "2.0 seconds later".postln;
35 Clear the AppClock's scheduler to stop it.
41 The link::Classes/Routine:: (or link::Classes/Task::) yields a float value indicating the delta (secs) for the AppClock to wait until resuming the Routine.
45 w = Window.new("trem", Rect(512, 256, 360, 130));
47 r = Routine({ arg appClockTime;
48 ["AppClock has been playing for secs:",appClockTime].postln;
51 w.bounds = w.bounds.moveBy(10.rand2, 10.rand2);
52 w.alpha = cos(i*0.1pi)*0.5+0.5;
62 AppClock.tick is called periodically by the SuperCollider application itself. This updates the link::Classes/Scheduler:: and causes any scheduled tasks to be executed. You should never call this method yourself.