fix: apply psi dbL conversion rule

This commit is contained in:
2026-05-20 05:43:52 +00:00
parent 350f81f8b5
commit 3265ad6fa3
+18 -4
View File
@@ -2392,6 +2392,11 @@ async function loadHistory() {
<td class="td-dim">${(() => {
const m = ev.mic_ppv == null ? null : Number(ev.mic_ppv);
if (m == null || !isFinite(m) || m <= 0) return '—';
// BW (.AB0*/.N00) stores mic_ppv as psi → convert to dBL.
// Thor IDF (.IDFH/.IDFW) already stores dBL → display directly.
const fn = (ev.blastware_filename || '').toUpperCase();
const isThor = fn.endsWith('.IDFH') || fn.endsWith('.IDFW');
if (isThor) return m.toFixed(1) + ' dBL';
return (20 * Math.log10(m / DBL_REF)).toFixed(1) + ' dBL';
})()}</td>
<td class="td-text">${ev.project ?? '—'}</td>
@@ -2454,11 +2459,20 @@ function _renderSidecar(data) {
document.getElementById('sc-title').textContent = `Event — ${bw.filename || ev.waveform_key || 'unknown'}`;
const fmtPpv = v => (v == null ? '—' : Number(v).toFixed(5) + ' in/s');
const fmtPpv = v => {
if (v == null) return '—';
const n = Number(v);
return isFinite(n) ? n.toFixed(5) + ' in/s' : String(v);
};
const fmtMic = v => {
if (v == null || v <= 0) return '—';
const dbl = 20 * Math.log10(v / DBL_REF);
return `${dbl.toFixed(1)} dBL (${v.toExponential(2)} psi)`;
if (v == null) return '—';
const n = Number(v);
if (!isFinite(n) || n <= 0) return '—';
// Source-aware: Thor IDF imports store mic as dB(L); BW imports store
// it as psi. `src` is in the outer scope from _renderSidecar().
if ((src.kind || '') === 'idf-import') return `${n.toFixed(1)} dBL`;
const dbl = 20 * Math.log10(n / DBL_REF);
return `${dbl.toFixed(1)} dBL (${n.toExponential(2)} psi)`;
};
document.getElementById('sc-f-serial').textContent = ev.serial || '—';