diff --git a/scripts/test_rta_profile.mjs b/scripts/test_rta_profile.mjs index cdbaaef..8ff4df3 100644 --- a/scripts/test_rta_profile.mjs +++ b/scripts/test_rta_profile.mjs @@ -44,4 +44,19 @@ assert.equal(extension.bpo, '1_12'); assert.equal(extension.freqRange, 'lf'); assert.equal(extension.order, 8); +const configSource = fs.readFileSync(new URL('../www/core/config.js', import.meta.url), 'utf8'); +const selectionSource = configSource.match(/function applyRtaBpoSelection[\s\S]*?\n\}/)?.[0]; +assert.ok(selectionSource, 'RTA BPO selection policy must remain testable'); +const selectionContext = vm.createContext({ + String, + CONFIG: { RTA_BPO_MODE: '1_3', RTA_BAR_LAYOUT: 'rtw' }, +}); +vm.runInContext(selectionSource, selectionContext); +assert.equal(selectionContext.applyRtaBpoSelection('1_6'), '1_6'); +assert.equal(selectionContext.CONFIG.RTA_BPO_MODE, '1_6'); +assert.equal(selectionContext.CONFIG.RTA_BAR_LAYOUT, 'iec'); +selectionContext.CONFIG.RTA_BAR_LAYOUT = 'rtw'; +assert.equal(selectionContext.applyRtaBpoSelection('1_3'), '1_3'); +assert.equal(selectionContext.CONFIG.RTA_BAR_LAYOUT, 'rtw'); + console.log('RTA profile regression tests passed'); diff --git a/src/state.rs b/src/state.rs index 6f5f272..815ee23 100644 --- a/src/state.rs +++ b/src/state.rs @@ -663,6 +663,9 @@ fn apply_global_to_rta( ) -> PhoenixRtaConfig { config.fft_size = global.fft_size; config.bpo = global.rta_bpo_mode.clone(); + if config.bpo != "1_3" && config.layout == "rtw" { + config.layout = "iec".to_string(); + } config.input_offset_db_l = global.input_offset_db_l; config.input_offset_db_r = global.input_offset_db_r; config.mono_input = global.mono_input; @@ -744,4 +747,14 @@ mod tests { assert_eq!(config.freq_range, "lf"); assert_eq!(config.integration, "medium"); } + + #[test] + fn non_third_octave_global_selection_leaves_locked_rtw_profile() { + let mut global = PhoenixGlobalConfig::default(); + global.rta_bpo_mode = "1_12".to_string(); + let config = apply_global_to_rta(PhoenixRtaConfig::default(), &global); + assert_eq!(config.layout, "iec"); + assert_eq!(config.bpo, "1_12"); + assert_eq!(config.engine, "iir"); + } } diff --git a/www/core/config.js b/www/core/config.js index cdb8ce4..3289a81 100644 --- a/www/core/config.js +++ b/www/core/config.js @@ -281,6 +281,17 @@ const CONFIG = { SOFTWARE_PRESET: 'default', }; const CONFIG_DEFAULTS = JSON.parse(JSON.stringify(CONFIG)); + +function applyRtaBpoSelection(value) { + const mode = ['1_3', '1_6', '1_12'].includes(String(value)) ? String(value) : '1_3'; + CONFIG.RTA_BPO_MODE = mode; + // RTW remains the original 31-band third-octave reference profile. Finer + // resolutions are Phoenix extensions and switch visibly to the IEC profile. + if (mode !== '1_3' && CONFIG.RTA_BAR_LAYOUT === 'rtw') { + CONFIG.RTA_BAR_LAYOUT = 'iec'; + } + return mode; +} const SOFTWARE_PRESET_IDS = Object.freeze(['default', 'claus', 'michael']); const LAYOUT_PRESET_IDS = Object.freeze(['1', '2', '3', '4']); const LAYOUT_PRESET_KEYS = Object.freeze([ @@ -778,6 +789,9 @@ function loadConfig(opts = {}) { if (typeof saved.PPM_DIN_DECAY_DB_PER_S === 'number') CONFIG.PPM_DIN_DECAY_DB_PER_S = saved.PPM_DIN_DECAY_DB_PER_S; if (typeof saved.PPM_DIN_HOLD_MS === 'number') CONFIG.PPM_DIN_HOLD_MS = saved.PPM_DIN_HOLD_MS; if (CONFIG.RTA_BAR_LAYOUT === 'classic') CONFIG.RTA_BAR_LAYOUT = 'rtw'; + if (CONFIG.RTA_BAR_LAYOUT === 'rtw' && CONFIG.RTA_BPO_MODE !== '1_3') { + CONFIG.RTA_BAR_LAYOUT = 'iec'; + } if (CONFIG.RTA_BAR_LAYOUT === 'rtw') { CONFIG.RTA_ENGINE = 'iir'; CONFIG.RTA_BPO_MODE = '1_3'; @@ -1108,7 +1122,7 @@ function applyPhoenixGlobalConfig(payload = {}) { } if ('rtaBpoMode' in payload) { const mode = String(payload.rtaBpoMode || '').trim(); - CONFIG.RTA_BPO_MODE = (mode === '1_3' || mode === '1_6' || mode === '1_12') ? mode : '1_6'; + applyRtaBpoSelection(mode); } if (CONFIG.RTA_BAR_LAYOUT === 'rtw') { CONFIG.RTA_ENGINE = 'iir'; @@ -1278,6 +1292,7 @@ export { saveConfig, buildPhoenixGlobalConfigPayload, applyPhoenixGlobalConfig, + applyRtaBpoSelection, applyBroadcastStandard, applySoftwarePreset, loadSoftwarePreset, diff --git a/www/index.html b/www/index.html index 4118680..0c9d15a 100644 --- a/www/index.html +++ b/www/index.html @@ -310,7 +310,7 @@ - Filterauflösung – Anzahl Bänder + RTW verwendet fest 1/3; 1/6 und 1/12 wechseln automatisch zum IEC-/Phoenix-Profil.
Veröffentlichung: 21.07.2026
+Änderungen:
+