From ca68aae0fe183c89875d04fc78ee3413fc6486c8 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 6 Jun 2012 23:10:58 +0200 Subject: store maximum latency for Sample Oscillator into class attribute --- lib/SampOsc.ck | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/SampOsc.ck b/lib/SampOsc.ck index a6a57e6..72dcc68 100644 --- a/lib/SampOsc.ck +++ b/lib/SampOsc.ck @@ -17,19 +17,21 @@ public class SampOsc extends SndBuf { } /* - * Wait till next loop point but no longer than 100::ms, + * Wait till next loop point but no longer than `max_latency', * so frequency changes get applied with a maximum of 100::ms latency. * NOTE: Due to a ChucK bug, simply killing and restarting the shred * does not work very well. */ + 100::ms => dur max_latency; + fun void __loop() /* pseudo-private */ { now => time last_trigger; while (second/__freq => dur interval) { - if (last_trigger+interval - now > 100::ms) { - 100::ms => now; + if (last_trigger+interval - now > max_latency) { + max_latency => now; } else { interval +=> last_trigger; if (last_trigger >= now) -- cgit v1.2.3