From dada6c1614c81225abbb8e732bb9d10284823b31 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Fri, 1 Dec 2023 10:52:42 +0100 Subject: [PATCH] connecting more stuff before fixing --- src/Clock.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Clock.ts b/src/Clock.ts index 1d93f92..3ab8595 100644 --- a/src/Clock.ts +++ b/src/Clock.ts @@ -184,10 +184,15 @@ export class Clock { set nudge(nudge: number) { } + get tickDuration() { + return 1 / this.ppqn; + } + set bpm(bpm: number) { if (bpm > 0 && this._bpm !== bpm) { this._bpm = bpm; this.logicalTime = this.realTime; + this.clock.setDuration(() => (this.tickDuration * 60) / this.bpm); } } @@ -261,6 +266,7 @@ export class Clock { this.app.api.MidiConnection.sendStopMessage(); this.lastPauseTime = this.app.audioContext.currentTime; this.logicalTime = this.realTime; + this.clock.pause() } public stop(): void { @@ -275,5 +281,6 @@ export class Clock { this.logicalTime = this.realTime; this.time_position = { bar: 0, beat: 0, pulse: 0 }; this.app.api.MidiConnection.sendStopMessage(); + this.clock.stop(); } }