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;