// Band meters (bass/mids/highs) + the signal meter on the audio-input
// settings row. Both read the same `smoothed` array from state_update.

export function updateBandMeters(smoothed) {
    // KL-64: HUD only shows bar fills; the per-band value text was
    // dropped when band meters moved into the director panel. The
    // val-* elements no longer exist, so we skip the textContent
    // update entirely.
    const bands = ['bass', 'mids', 'highs'];
    for (let i = 0; i < 3; i++) {
        const val = smoothed[i] || 0;
        const fill = document.getElementById(`fill-${bands[i]}`);
        if (fill) fill.style.width = `${Math.min(100, val * 100)}%`;
    }
}

export function updateSignalMeter(smoothed) {
    const signalFillEl = document.getElementById('signal-meter-fill');
    const signalLabelEl = document.getElementById('signal-meter-label');
    if (!signalFillEl || !signalLabelEl) return;
    const level = Math.max(...(smoothed || [0, 0, 0]));
    const pct = Math.min(100, level * 100);
    signalFillEl.style.width = `${pct}%`;
    signalFillEl.classList.toggle('silent', pct < 1);
    signalLabelEl.textContent = pct < 1 ? 'Signal: none' : `Signal: ${pct.toFixed(0)}%`;
}
