From ccdbd6a7f7984d015da5db13226f864c41e13755 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Fri, 10 Nov 2023 14:12:54 +0100 Subject: [PATCH] Revert "Faster PPQN and bigger latency" This reverts commit ca4f7acfe232ec59066d5265c816034097b310b4. --- src/Clock.ts | 3 ++- src/TransportProcessor.js | 1 + src/main.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Clock.ts b/src/Clock.ts index a06d342..7638c7b 100644 --- a/src/Clock.ts +++ b/src/Clock.ts @@ -54,7 +54,7 @@ export class Clock { this.logicalTime = 0; this.tick = 0; this._bpm = 120; - this._ppqn = 48 * 2; + this._ppqn = 48; this.transportNode = null; this.ctx = ctx; this.running = true; @@ -175,6 +175,7 @@ export class Clock { if (ppqn > 0 && this._ppqn !== ppqn) { this._ppqn = ppqn; this.transportNode?.setPPQN(ppqn); + this.logicalTime = this.realTime; } } diff --git a/src/TransportProcessor.js b/src/TransportProcessor.js index c978b2a..20e96ce 100644 --- a/src/TransportProcessor.js +++ b/src/TransportProcessor.js @@ -24,6 +24,7 @@ class TransportProcessor extends AudioWorkletProcessor { this.currentPulsePosition = currentTime; } else if (message.data.type === "ppqn") { this.ppqn = message.data.value; + this.currentPulsePosition = currentTime; } else if (message.data.type === "nudge") { this.nudge = message.data.value; } diff --git a/src/main.ts b/src/main.ts index 56a0baf..0e1249e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -83,7 +83,7 @@ export class Editor { // Audio stuff audioContext: AudioContext; clock: Clock; - dough_nudge: number = 40; + dough_nudge: number = 20; manualPlay: boolean = false; isPlaying: boolean = false;