From 869d2d8fa3d4916593aec19fc2a0956585e3f502 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, 18 Jun 2024 10:31:57 +0000 Subject: [PATCH] SC switched from time tracking to frame tracking. --- src/disp/disp_sc.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/disp/disp_sc.mjs b/src/disp/disp_sc.mjs index 6cc628b..dd48968 100644 --- a/src/disp/disp_sc.mjs +++ b/src/disp/disp_sc.mjs @@ -39,7 +39,7 @@ let ScDisplay = class extends RootDisplay { #lingerOld = new Uint8Array(allocated.ch); #peak = new Uint16Array(allocated.ch); #keep = new Uint8Array(allocated.ch); - #rtOn = new Float64Array(allocated.ch); + #noteOn = new Uint8Array(allocated.ch); #ch = 0; #lastBg = 0; #countBg = 0; @@ -87,7 +87,7 @@ let ScDisplay = class extends RootDisplay { }); upThis.addEventListener("note", ({data}) => { if (data.state == 3) { - upThis.#rtOn[data.part] = Date.now(); + upThis.#noteOn[data.part] = 10; }; }); }; @@ -353,13 +353,14 @@ let ScDisplay = class extends RootDisplay { // Strength calculation sum.velo.forEach(function (e, i) { upThis.#lingerOld[i] = upThis.#linger[i] >> 8; + upThis.#noteOn[i] --; if (((e >> 4) << 4) > upThis.#linger[i] >> 8) { if (scConf.peakHold == 3) { upThis.#linger[i] = ((e >> 4) << 4) << 8; } else { upThis.#linger[i] = (((e >> 4) << 4) + 15) << 8; }; - if (scConf.peakHold != 3 || timeNow - upThis.#rtOn[i] < 200) { + if (scConf.peakHold != 3 || upThis.#noteOn[i] > 0) { upThis.#keep[i] = 56; }; } else if (upThis.#keep[i] > 15) {