
18 Mar
2007
18 Mar
'07
5:15 p.m.
Veli-Pekka Tätilä wrote:
[...] IMplement an infrastructure for timers in which, a particular method of all attached objects gets called when-ever a specified amount of time has elapsed. [...]
Coming from a Max background, one of the first things that I worked out was a Metro object: http://developer.kde.org/~wheeler/files/Metro.ck That is overly simple, but a reasonable example. From there you can do stuff like: fun void beat(Metro m) { while(m.pulse => now) { <<< "beat" >>>; } } Metro m; m.start(); spork ~ beat(m); 30::second => now; ChucK lets you wait on events just like it lets you wait on arbitrary time or sample amounts, so it makes it easy to synchronize multiple shreds based on them. -Scott