summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-06 23:10:58 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-06 23:10:58 +0200
commitca68aae0fe183c89875d04fc78ee3413fc6486c8 (patch)
tree0f24a820118362ebacbc24892ddd30847de57eae
parenta6206e2a444a2ae94cea0d3d4a6b3762e289a07e (diff)
downloaddigitale-debutanten-ca68aae0fe183c89875d04fc78ee3413fc6486c8.tar.gz
store maximum latency for Sample Oscillator into class attribute
-rw-r--r--lib/SampOsc.ck8
1 files changed, 5 insertions, 3 deletions
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)