Correct audio metering and realtime displays

This commit is contained in:
Mikei386
2026-07-22 10:50:15 +02:00
parent 97352ecfce
commit 2e868bfa3a
26 changed files with 999 additions and 903 deletions
+16
View File
@@ -1,6 +1,8 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import vm from 'node:vm';
import { getRtwCenters } from '../www/core/rtw_centers.js';
import { selectLocalRtwPacket } from '../www/views/realtime.js';
const source = fs.readFileSync(new URL('../www/core/audio.js', import.meta.url), 'utf8');
const functionSource = source.match(/export function buildRtaRuntimeConfig[\s\S]*?\n\}/)?.[0];
@@ -71,4 +73,18 @@ assert.equal(selectionContext.CONFIG.RTA_BAR_LAYOUT, 'rtw');
assert.equal(selectionContext.applyRtaBpoSelection('1_3'), '1_3');
assert.equal(selectionContext.CONFIG.RTA_BAR_LAYOUT, 'rtw');
const twelfthCenters = getRtwCenters('1_12');
const staleTwelfthPacket = {
engine: 'iir',
bpo: '1_12',
centers: twelfthCenters,
bands_avg: twelfthCenters.map((_, index) => index),
bands_peak: twelfthCenters.map((_, index) => index + 1000),
};
const selectedSixth = selectLocalRtwPacket(staleTwelfthPacket, '1_6');
assert.equal(selectedSixth.bpo, '1_6');
assert.equal(selectedSixth.centers.length, getRtwCenters('1_6').length);
assert.equal(selectedSixth.bands_avg.length, selectedSixth.centers.length);
assert.equal(selectedSixth.bands_peak.length, selectedSixth.centers.length);
console.log('RTA profile regression tests passed');