[chuck-users] Strategies for Complex Timing
Scott Wheeler
wheeler at kde.org
Sun Mar 18 17:15:01 EDT 2007
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
More information about the chuck-users
mailing list