From f0083cfe4597986bfc9b7ba874f13d7b415c58ca Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 1 Apr 2022 16:34:43 +0200 Subject: [PATCH] just increment those ticks --- packages/core/examples/metro.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/core/examples/metro.html b/packages/core/examples/metro.html index f9c97a00e..3d530dd51 100644 --- a/packages/core/examples/metro.html +++ b/packages/core/examples/metro.html @@ -53,6 +53,7 @@ Loading... { if (e.data === 'tick') { - const sinceStart = this.audioContext.currentTime - this.startedAt; // seconds since pressing start - const tick = Math.floor(sinceStart / this.interval); // tick number - - const begin = round(tick * this.interval + this.startedAt, precision); // begin of tick + const begin = round(this.tick * this.interval, precision) + this.startedAt; // begin of tick const end = round(begin + this.interval, precision); // end of tick + this.tick++; // callback with query span, using clock #2 (the audio clock) callback(begin, end); } }; } start() { + console.log('start...'); this.audioContext.resume(); + this.tick = 0; this.startedAt = this.audioContext.currentTime; this.worker.postMessage('start'); } stop() { + console.log('stop...'); this.worker.postMessage('stop'); } }