feat(web): live mod-source meters
This commit is contained in:
@@ -212,3 +212,9 @@ button.queued { animation: queued-blink 600ms ease-in-out infinite alternate; }
|
||||
.seq-cell.playhead { outline: 2px solid rgba(255,255,255,0.75); outline-offset: -1px; }
|
||||
.pr-cell.playhead { background: rgba(255,255,255,0.14); outline: 1px solid rgba(255,255,255,0.55); outline-offset: -1px; }
|
||||
.pr-cell.on.playhead { filter: brightness(1.45); outline: 1px solid #fff; outline-offset: -1px; }
|
||||
|
||||
/* --- Mod-source live meters --- */
|
||||
.cd-meter { display:inline-block; width:42px; height:8px; border:1px solid #444;
|
||||
border-radius:3px; vertical-align:middle; margin:0 4px; position:relative; background:#1b1b1b; }
|
||||
.cd-meter::after { content:""; position:absolute; left:0; top:0; bottom:0;
|
||||
width:calc(var(--v,0) * 100%); background:#1a8; border-radius:2px; }
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
VOICE_CLASS, defaultStepMode, isMelodic,
|
||||
matVoiceMods, matVoicePoses,
|
||||
MOD_SOURCE_LABELS, MOD_TARGET_LABELS, POSE_EVENT_CHOICES,
|
||||
parseVoiceMod, parseVoicePose,
|
||||
parseVoiceMod, parseVoicePose, parseModValues,
|
||||
} from "./matrix-state.js";
|
||||
|
||||
// Per-voice step edit mode; initialised from defaultStepMode() on first expand.
|
||||
@@ -566,6 +566,21 @@ on("/matrix/voicepose", (args) => {
|
||||
}
|
||||
});
|
||||
|
||||
let latestModValues = {};
|
||||
on("/matrix/modvalues", (args) => {
|
||||
latestModValues = parseModValues(args);
|
||||
updateMeters();
|
||||
});
|
||||
function updateMeters() {
|
||||
if (expandedVoice < 0 || activeTab !== "modpose") return;
|
||||
const meters = cdTabBodyEl ? cdTabBodyEl.querySelectorAll(".cd-meter") : [];
|
||||
meters.forEach((m) => {
|
||||
const v = latestModValues[m.dataset.src] || 0;
|
||||
m.style.setProperty("--v", v.toFixed(3));
|
||||
m.title = `${m.dataset.src}: ${v.toFixed(2)}`;
|
||||
});
|
||||
}
|
||||
|
||||
on("/matrix/stephead", (args) => {
|
||||
// Guard: only act when a voice is open and the STEPS tab is active.
|
||||
if (expandedVoice < 0 || !cdTabBodyEl || activeTab !== "steps") return;
|
||||
|
||||
@@ -33,6 +33,7 @@ export let matVoiceMods=Array.from({length:22},()=>[]);
|
||||
export let matVoicePoses=Array.from({length:22},()=>[]);
|
||||
export function parseVoiceMod(args){ return {vi:0,list:[]}; }
|
||||
export function parseVoicePose(args){ return {vi:0,list:[]}; }
|
||||
export function parseModValues(){ return {}; }
|
||||
export function saveMatState(){}
|
||||
export const VOICE_CLASS={};
|
||||
export function defaultStepMode(){ return "drum"; }
|
||||
|
||||
Reference in New Issue
Block a user