Recover analyzer DSP and realtime pipeline corrections
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import vm from 'node:vm';
|
||||
|
||||
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];
|
||||
assert.ok(functionSource, 'buildRtaRuntimeConfig must remain testable');
|
||||
const context = vm.createContext({
|
||||
Number,
|
||||
getRtwCenters(mode) {
|
||||
return mode === '1_3' ? new Array(31).fill(0) : [];
|
||||
},
|
||||
});
|
||||
vm.runInContext(functionSource.replace('export function', 'function'), context);
|
||||
|
||||
const forced = context.buildRtaRuntimeConfig({
|
||||
RTA_BAR_LAYOUT: 'rtw',
|
||||
RTA_ENGINE: 'fft',
|
||||
RTA_BPO_MODE: '1_12',
|
||||
RTA_FREQ_RANGE: 'lf',
|
||||
RTA_IIR_ORDER: 2,
|
||||
});
|
||||
assert.equal(forced.engine, 'iir');
|
||||
assert.equal(forced.bpo, '1_3');
|
||||
assert.equal(forced.freqRange, 'norm');
|
||||
assert.equal(forced.order, 6);
|
||||
assert.equal(forced.rtwCenters.length, 31);
|
||||
|
||||
const extension = context.buildRtaRuntimeConfig({
|
||||
RTA_BAR_LAYOUT: 'iec',
|
||||
RTA_ENGINE: 'fft',
|
||||
RTA_BPO_MODE: '1_12',
|
||||
RTA_FREQ_RANGE: 'lf',
|
||||
RTA_IIR_ORDER: 8,
|
||||
});
|
||||
assert.equal(extension.engine, 'fft');
|
||||
assert.equal(extension.bpo, '1_12');
|
||||
assert.equal(extension.freqRange, 'lf');
|
||||
assert.equal(extension.order, 8);
|
||||
|
||||
console.log('RTA profile regression tests passed');
|
||||
Reference in New Issue
Block a user