Fun with scheduling

This commit is contained in:
Dan Buch 2015-12-28 14:16:28 -05:00
parent 472d6a606f
commit 771eba53fc

View File

@ -736,3 +736,45 @@
SystemClock.sched(10, { x.free; b.free; });
)
(
SystemClock.sched(5, { "hello".postln });
)
(
var timeNow = TempoClock.default.beats;
"Time is now: ".post;
timeNow.postln;
"Scheduling for: ".post;
(timeNow + 5).postln;
TempoClock.default.schedAbs(timeNow + 5,
{ "Time is later: ".post; thisThread.clock.beats.postln; nil }
);
)
(
var timeNow;
"------------------------------------".postln;
TempoClock.default.tempo = 2;
timeNow = TempoClock.default.beats;
"Time is now: ".post;
timeNow.postln;
"Scheduling for: ".post;
(timeNow + 5).postln;
TempoClock.default.schedAbs(timeNow + 5,
{ "Time is later: ".post; thisThread.clock.beats.postln; nil }
);
)
(
"SystemClock.beats: ".post; SystemClock.beats.postln;
"TempoClock.default.beats: ".post; TempoClock.default.beats.postln;
"AppClock.beats: ".post; AppClock.beats.postln;
Task({
"thisThread.clock.beats: ".post; thisThread.clock.beats.postln;
}).play;
)
(
TempoClock.default.sched(5, { "hello".postln; nil; });
)