From e57cb0d831a1ee806a4efb1fbffa8811343e233a Mon Sep 17 00:00:00 2001 From: cv <34649812+cpvalente@users.noreply.github.com> Date: Tue, 25 May 2021 23:14:56 +0200 Subject: [PATCH] bugfix: timer negative on goto when jumping events using goto, start time would not be set --- server/classes/Timer.js | 3 +++ server/controllers/OscController.js | 1 + 2 files changed, 4 insertions(+) diff --git a/server/classes/Timer.js b/server/classes/Timer.js index 6fd83e5e3..d322c8bf4 100644 --- a/server/classes/Timer.js +++ b/server/classes/Timer.js @@ -50,6 +50,9 @@ class Timer { // check playstate switch (this.state) { case 'start': + // ensure we have a start time + if (this._startedAt == null) this._startedAt = now; + // update current timer this.current = this._startedAt + this.duration + this._pausedTotal - now; diff --git a/server/controllers/OscController.js b/server/controllers/OscController.js index 488442002..dba6d9cc1 100644 --- a/server/controllers/OscController.js +++ b/server/controllers/OscController.js @@ -63,6 +63,7 @@ const initiateOSC = (config) => { try { let eventIndex = parseInt(args); if (isNaN(eventIndex) || eventIndex <= 0) return; + global.timer.pause(); global.timer.loadEvent(eventIndex - 1, undefined, true); } catch (error) { console.log('error calling goto: ', error);