From 1b4ba9445bbee414b10077e40ded13c8f12aabd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lumi=C3=A8re=20=C3=89lev=C3=A9?= <88174309+PoneyClairDeLune@users.noreply.github.com> Date: Tue, 26 Sep 2023 06:57:46 +0000 Subject: [PATCH] Time source muxer for Cambiare. --- src/cambiare_demo/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cambiare_demo/index.js b/src/cambiare_demo/index.js index 230ad14b..62eb53bc 100644 --- a/src/cambiare_demo/index.js +++ b/src/cambiare_demo/index.js @@ -24,8 +24,14 @@ HTMLElement.prototype.$a = function (selector) { self.Alpine = Alpine; let useMidiBus = false; -let audioFilePlayer = $e("#audioFilePlayer"), -visualizer = new Cambiare($e(".cambiare"), audioFilePlayer); +let audioFilePlayer = $e("#audioFilePlayer"); +let timePlexer = {}; +Object.defineProperty(timePlexer, "currentTime", { + get: () => { + return audioFilePlayer.currentTime || (Date.now() / 1000); + } +}); +let visualizer = new Cambiare($e(".cambiare"), timePlexer); visualizer.reset(); Alpine.store("play", "smf");