Correct audio metering and realtime displays
This commit is contained in:
+2
-52
@@ -7,7 +7,6 @@ import { clamp, clampPow2 } from '../core/utils.js';
|
||||
// DOM helper
|
||||
const E = (id) => document.getElementById(id);
|
||||
const PPM_LOUD_WARN_KEY = 'ppm_din_loudness_warn_ack_v1';
|
||||
const PPM_DIN_FAST_WARN_KEY = 'ppm_din_fast_attack_warn_ack_v1';
|
||||
|
||||
function getPpmDinVisibleBaseOffset() {
|
||||
const baseMode = (CONFIG.PPM_DIN_MODE === 'al_minus6') ? -6 : -9;
|
||||
@@ -81,27 +80,6 @@ function showPpmLoudnessWarning(onConfirm) {
|
||||
wrap.style.display = 'flex';
|
||||
}
|
||||
|
||||
function showPpmDinFastAttackWarning(onConfirm) {
|
||||
const wrap = E('ppmDinFastWarn');
|
||||
const btn = E('ppmDinFastWarnBtn');
|
||||
if (!wrap || !btn) {
|
||||
if (onConfirm) onConfirm();
|
||||
return;
|
||||
}
|
||||
if (!wrap.dataset.bound) {
|
||||
btn.addEventListener('click', () => {
|
||||
try { localStorage.setItem(PPM_DIN_FAST_WARN_KEY, '1'); } catch (_) {}
|
||||
wrap.style.display = 'none';
|
||||
if (onConfirm) onConfirm();
|
||||
});
|
||||
wrap.addEventListener('click', (e) => {
|
||||
if (e.target === wrap) wrap.style.display = 'none';
|
||||
});
|
||||
wrap.dataset.bound = '1';
|
||||
}
|
||||
wrap.style.display = 'flex';
|
||||
}
|
||||
|
||||
export function setupOptions(env) {
|
||||
// Initial laden
|
||||
loadConfig();
|
||||
@@ -237,7 +215,6 @@ function syncUI() {
|
||||
['opt_ppmDinColWarn', CONFIG.PPM_DIN_COLOR_WARN],
|
||||
['opt_ppmDinHeaderValue', CONFIG.PPM_DIN_HEADER_SHOW_VALUE, null, null, 'checkbox'],
|
||||
['opt_ppmDinLoudnessBox', CONFIG.PPM_DIN_LOUDNESS_BOXES, null, null, 'checkbox'],
|
||||
['opt_ppmDinFastAttack', CONFIG.PPM_DIN_FAST_ATTACK, null, null, 'checkbox'],
|
||||
['opt_ppmDinLoudOff', CONFIG.PPM_DIN_LOUDNESS_OFFSET_DB ?? 0, 'val_ppmDinLoudOff', (v)=>`${Number(v).toFixed(1)} dB`],
|
||||
['opt_ppmEbuColNorm', CONFIG.PPM_EBU_COLOR_NORMAL],
|
||||
['opt_ppmEbuColWarn', CONFIG.PPM_EBU_COLOR_WARN],
|
||||
@@ -544,7 +521,6 @@ function wireHandlers(env) {
|
||||
const notifyRta = /^opt_rta/i.test(id)
|
||||
|| id === 'opt_lufsIWindowMin'
|
||||
|| id === 'opt_lufsINorm';
|
||||
const notifyPpm = (id === 'opt_ppmDinFastAttack');
|
||||
const inputType = String(el.type || '').toLowerCase();
|
||||
const commitOnInput = isCheckbox || inputType === 'range' || inputType === 'color';
|
||||
|
||||
@@ -558,9 +534,6 @@ function wireHandlers(env) {
|
||||
if (notifyRta) {
|
||||
try { env?.notifyRtaConfig?.(); } catch (_) {}
|
||||
}
|
||||
if (notifyPpm) {
|
||||
try { env?.notifyPpmConfig?.(); } catch (_) {}
|
||||
}
|
||||
try { env?.syncRealtimeGain?.(); } catch (_) {}
|
||||
try { env?.syncWaveformWindow?.(); } catch (_) {}
|
||||
try { env?.syncWaveformMode?.(); } catch (_) {}
|
||||
@@ -789,29 +762,6 @@ function wireHandlers(env) {
|
||||
CONFIG.PPM_DIN_HEADER_SHOW_VALUE = !!v;
|
||||
return CONFIG.PPM_DIN_HEADER_SHOW_VALUE;
|
||||
}, null, null, true);
|
||||
h('opt_ppmDinFastAttack', v => {
|
||||
const desired = !!v;
|
||||
const cb = E('opt_ppmDinFastAttack');
|
||||
const acked = (() => {
|
||||
try { return localStorage.getItem(PPM_DIN_FAST_WARN_KEY) === '1'; }
|
||||
catch (_) { return false; }
|
||||
})();
|
||||
if (desired && !acked) {
|
||||
if (cb) cb.checked = false;
|
||||
CONFIG.PPM_DIN_FAST_ATTACK = false;
|
||||
showPpmDinFastAttackWarning(() => {
|
||||
CONFIG.PPM_DIN_FAST_ATTACK = true;
|
||||
if (cb) cb.checked = true;
|
||||
try { saveConfig(); } catch (_) {}
|
||||
try { env?.notifyPpmConfig?.(); } catch (_) {}
|
||||
notifyPhoenixGlobalConfig();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
CONFIG.PPM_DIN_FAST_ATTACK = desired;
|
||||
notifyPhoenixGlobalConfig();
|
||||
return desired;
|
||||
}, null, null, true);
|
||||
h('opt_ppmDinLoudnessBox', v => {
|
||||
const desired = !!v;
|
||||
const cb = E('opt_ppmDinLoudnessBox');
|
||||
@@ -875,9 +825,9 @@ function wireHandlers(env) {
|
||||
}, null, null, true);
|
||||
h('opt_rmsTc', v => {
|
||||
const mode = String(v).toLowerCase();
|
||||
if (mode === 'impulse' || mode === 'fast' || mode === 'slow' || mode === 'none') {
|
||||
if (mode === 'fast' || mode === 'slow' || mode === 'window') {
|
||||
CONFIG.RMS_TC_MODE = mode;
|
||||
CONFIG.RMS_TC_MS = null;
|
||||
notifyPhoenixGlobalConfig();
|
||||
}
|
||||
return CONFIG.RMS_TC_MODE;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user