From 15df20d22d14ae006a2701a397ea15673586bb21 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Thu, 8 Feb 2024 00:37:16 -0500 Subject: [PATCH] cleanup --- packages/core/clockworker.js | 40 +----------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/packages/core/clockworker.js b/packages/core/clockworker.js index d9e9ae83..2b813769 100644 --- a/packages/core/clockworker.js +++ b/packages/core/clockworker.js @@ -29,6 +29,7 @@ const sendTick = (phase, duration, tick, time) => { num_ticks_since_cps_change++; }; +//create clock method from zyklus const clock = this.createClock(getTime, sendTick, duration); let started = false; @@ -90,42 +91,3 @@ this.onconnect = function (e) { }); port.start(); // Required when using addEventListener. Otherwise called implicitly by onmessage setter. }; - -// function createClock( -// callback, // called slightly before each cycle -// duration, -// ) { -// const interval = 0.1; -// const overlap = interval / 2; -// const precision = 10 ** 4; // used to round phase -// const minLatency = 0.01; -// let phase = 0; // next callback time - -// const onTick = () => { -// const t = getTime(precision); -// const lookahead = t + interval + overlap; // the time window for this tick -// if (phase === 0) { -// phase = t + minLatency; -// } -// // callback as long as we're inside the lookahead -// while (phase < lookahead) { -// phase = Math.round(phase * precision) / precision; -// phase >= t && callback({ phase, duration, time: t }); -// phase < t && console.log('TOO LATE', phase); // what if latency is added from outside? -// phase += duration; // increment phase by duration -// } -// }; -// let intervalID; -// const start = () => { -// clear(); // just in case start was called more than once -// onTick(); -// intervalID = setInterval(onTick, interval * 1000); -// }; -// const clear = () => intervalID !== undefined && clearInterval(intervalID); -// const stop = () => { -// phase = 0; -// clear(); -// }; - -// return { start, stop }; -// }