Revert "fix: improve metadata frame detection and update version to v0.12.1"

This reverts commit ad7b064b67.
This commit is contained in:
2026-04-15 02:01:28 -04:00
parent 257c8ad186
commit 8bfebadd46
7 changed files with 34 additions and 140 deletions
+4 -8
View File
@@ -1574,10 +1574,7 @@ function _buildWaveformCharts(data, chartsEl, emptyEl, chartsStore) {
return;
}
// Clip to configured record window — device streams extra zero-padded frames
// beyond total_samples; showing them just adds a flat tail to every chart.
const display = data.total_samples ? Math.min(data.total_samples, decoded) : decoded;
const times = Array.from({length: display}, (_, i) => ((i - pretrig) / sr * 1000).toFixed(2));
const times = Array.from({length: decoded}, (_, i) => ((i - pretrig) / sr * 1000).toFixed(2));
if (emptyEl) emptyEl.style.display = 'none';
chartsEl.style.display = 'flex';
chartsEl.style.flexDirection = 'column';
@@ -1595,7 +1592,7 @@ function _buildWaveformCharts(data, chartsEl, emptyEl, chartsStore) {
if (isGeo) {
const scale = geoRange / 32767;
plotData = samples.slice(0, display).map(s => s * scale);
plotData = samples.map(s => s * scale);
// Use the device-recorded peak from the 0C waveform record — authoritative
// and matches Blastware. Computing from raw samples can catch rogue
// near-full-scale values from decoding artifacts.
@@ -1606,10 +1603,9 @@ function _buildWaveformCharts(data, chartsEl, emptyEl, chartsStore) {
ttFmt = v => `${ch}: ${v.toFixed(5)} in/s`;
tickFmt = v => v.toFixed(4);
} else {
const clippedMic = samples.slice(0, display);
const peakCounts = Math.max(...clippedMic.map(Math.abs));
const peakCounts = Math.max(...samples.map(Math.abs));
const micScale = (micPeakPsi !== null && peakCounts > 0) ? Math.abs(micPeakPsi) / peakCounts : 1.0;
plotData = clippedMic.map(s => s * micScale);
plotData = samples.map(s => s * micScale);
const peakPsi = Math.max(...plotData.map(Math.abs));
const peakDbl = peakPsi > 0 ? 20 * Math.log10(peakPsi / DBL_REF) : -Infinity;
peakLabel = `${peakDbl.toFixed(1)} dBL`;