diff --git a/docs/ARD_056_MASTER_NATIVE_METER_VISIBILITY_2026-10-28.md b/docs/ARD_056_MASTER_NATIVE_METER_VISIBILITY_2026-10-28.md new file mode 100644 index 000000000..f68320a9b --- /dev/null +++ b/docs/ARD_056_MASTER_NATIVE_METER_VISIBILITY_2026-10-28.md @@ -0,0 +1,23 @@ +# P0 root cause — live MASTER L/R meter hidden by preview-only FX marker + +**Reported evidence**: Windows native screenshot, CH1 green meter active, MASTER L/R bars dark, even though MASTER physical fader and stereo control render normally. Reconciled base `main@6cafdc5d094c58dcc9c3faa412dcbbb43e4574d3`; other threads own PRs #101, #102 and #103. No overwrite of their native FX reorder, CI, Orbit or fader work. + +## Reproduced source-level defect + +`web/bridge.js::patchMixer()` sets `track.dataset.preview="1"` on MASTER because **only the master FX/pan controls** are not routed to native DSP yet. The native injected CSS globally matches `.strip[data-preview="1"] .meter-fill` and forcibly sets `opacity:0!important`. Thus even when `src/LiveAudioEngine.h::status()` reports genuine `peakLeft` and `peakRight`, and the new ~30 FPS JavaScript LED painter advances, both MASTER LED fills are **invisible**. This is a visual-state ownership bug, not proof of broken DSP. See exact status properties `peakLeft`, `peakRight` and native pre-output peak buffers in `src/LiveAudioEngine.h`. + +## Fix (two-layer guard) + +1. MASTER gets a **separate** `data-fx-preview="1"`, never `data-preview="1"`; physical MASTER stereo output meter stays live. Master FX and PAN click remain disabled/preview-only, with no fabricated processing. +2. Existing generic preview CSS is narrowed to `.strip:not(.master-strip)[data-preview="1"]` for **both** the opaque LED fill gate and faded-out background track. Even accidental legacy master preview marking cannot mask real MASTER metering. +3. CH2–10 still have no native audio routing, retain the exact old preview marker and muted LED CSS. CH1 remains genuine live native input. No fake signal or meter, no change to `LiveAudioEngine.h`, JUCE telemetry, 30 FPS animation, LED/peak/clip visual geometry, HTML/CSS build or C++ realtime callback. + +## Automated acceptance + +- Native integration Playwright smoke uses a stub JUCE event emitter, verifies native CSS opacity for MASTER L/R 1, unrouted CH2 opacity 0, and injects a **test-only** nonzero `arMixStatus` that drives both MASTER 7px LED clips using the actual shared scheduler; no fake runtime waveform. +- Node contract enforces preview CSS scope and MASTER branch semantics. +- Full Chromium/Firefox/Orbit smoke, Windows MSVC CTest and ZIP packaging, and source/offline parity gates before merge. + +## Hardware evidence boundary + +User still needs to test real connected Windows audio. Genuine output peaks are zero if MONITOR disabled, MASTER muted, an output device is disconnected, a diagnostic route is capture-only or a plugin is silent. If MASTER is **visually empty after this fix while sound is audible**, inspect status fields `peakLeft`/`peakRight` and device channel map with signal check; do not generate decorative signal bars. Known issue #56 remains open for low-spec PC pointer performance until measured. diff --git a/tests/native_ui_contract_test.mjs b/tests/native_ui_contract_test.mjs index 48e8041af..c73a55dfb 100644 --- a/tests/native_ui_contract_test.mjs +++ b/tests/native_ui_contract_test.mjs @@ -19,7 +19,7 @@ test('native app never runs demo sine meters',()=>{ assert.ok(fn>scheduler && meterGuard>fn && meterGuard{meterRAF=0;meters(t)});',scheduler)>scheduler); }); -test('native meter reads DSP and hides all 11 visual-only channels',()=>{ +test('native meter reads DSP and hides only the nine unrouted input channels',()=>{ assert.ok(bridge.includes('percent(d.inputPeak)'),'CH1 uses native audio input peak'); assert.ok(bridge.includes('percent(d.peakLeft)') && bridge.includes('percent(d.peakRight)'),'real output L/R peak inputs'); assert.ok(bridge.includes('percent(d.peak)'),'master aux uses native output peak'); @@ -58,3 +58,18 @@ test('MASTER MONO/STEREO is delivered to RT audio as equal post-pan L+R summing' assert.match(engine,/const float fromR = mono \? monoR/); assert.match(bridge,/setMasterMono\(d\.masterMono,false\)/); }); + +// Regression: MASTER has preview-only FX, not preview-only AUDIO. Do not +// let the generic "data-preview" selector suppress real master output peaks. +test('MASTER stereo meters are never hidden by native preview CSS',()=>{ + assert.ok(bridge.includes('.strip:not(.master-strip)[data-preview=\\\"1\\\"] .meter-fill{opacity:0!important}')); + assert.ok(bridge.includes('.strip:not(.master-strip)[data-preview=\\\"1\\\"] .meter{opacity:.36}')); + const start=bridge.indexOf('if(track.classList.contains("master-strip"))'); + const end=bridge.indexOf('const rack=track.querySelector(".rack")',start); + assert.ok(start>=0&&end>start); + const masterBranch=bridge.slice(start,end); + assert.ok(masterBranch.includes('track.removeAttribute("data-preview")')); + assert.ok(masterBranch.includes('track.dataset.fxPreview="1"')); + assert.ok(!masterBranch.includes('track.dataset.preview="1"')); + assert.ok(bridge.includes('percent(d.peakLeft)')&&bridge.includes('percent(d.peakRight)')); +}); diff --git a/tests/ui_smoke.py b/tests/ui_smoke.py index dfef0141d..b10e0273f 100644 --- a/tests/ui_smoke.py +++ b/tests/ui_smoke.py @@ -1027,6 +1027,53 @@ async def image_for(selector): assert measured["mode"]=="meters-off" and measured["durationMs"]==1000,measured assert measured["mixer"]["samples"]>0 and measured["pointerMoves"]["mixer"]>0,measured await diag.close() + # Native WebView bridge integration: real MASTER peaks must stay visible + # while preview-only channels 2–10 remain dark. No synthetic DSP meter. + native=await browser.new_page(viewport={"width":1680,"height":920}) + native_errors=[] + native.on("pageerror",lambda e: native_errors.append(str(e))) + await native.add_init_script("""(() => { + window.__arMixMockEvents={}; + window.__JUCE__={backend:{ + emitEvent(){}, + addEventListener(name,fn){window.__arMixMockEvents[name]=fn;} + }}; + })()""") + await native.goto((project/"AR-MIX-Live-FX-Host-Standalone-v0.3.html").as_uri()) + await native.add_script_tag(path=str(project/"web/bridge.js")) + native_static=await native.evaluate("""()=>{ + const master=document.querySelector('#masterLeft'); + const left=master.querySelector('[data-meter="masterL"]'); + const right=master.querySelector('[data-meter="masterR"]'); + const ch2=document.querySelector('[data-strip="1"]'); + const inactive=ch2.querySelector('[data-meter="1"]'); + return {native:document.documentElement.classList.contains('native-engine'), + masterPreview:master.dataset.preview,fxPreview:master.dataset.fxPreview, + leftOpacity:getComputedStyle(left).opacity, + rightOpacity:getComputedStyle(right).opacity, + ch2Preview:ch2.dataset.preview, + ch2Opacity:getComputedStyle(inactive).opacity}; + }""") + assert native_static["native"] and native_static["fxPreview"]=="1",native_static + assert native_static["masterPreview"] is None,native_static + assert native_static["leftOpacity"]=="1" and native_static["rightOpacity"]=="1",native_static + assert native_static["ch2Preview"]=="1" and native_static["ch2Opacity"]=="0",native_static + await native.evaluate("""()=>{ + window.__arMixMockEvents.arMixStatus({ + connected:true,error:'',driver:'Windows Audio',rate:48000,buffer:480, + monitor:true,channelDb:0,masterDb:0,channelPan:0, + inputPeak:.45,peak:.38,peakLeft:.38,peakRight:.24, + peakOutput:.38,deviceOutputChannels:2,masterMute:false + }); + }""") + await native.wait_for_function("""()=>{ + const l=document.querySelector('[data-meter="masterL"]'); + const r=document.querySelector('[data-meter="masterR"]'); + return Number.parseFloat(l.style.getPropertyValue('--led-lit'))>7 && + Number.parseFloat(r.style.getPropertyValue('--led-lit'))>7; + }""",timeout=3000) + assert not native_errors,native_errors + await native.close() await browser.close() print("PASS: 10-channel premium mixer, rose MASTER, responsive layout, double-click rename, no JS errors") diff --git a/web/bridge.js b/web/bridge.js index fbe980d5a..c8661016f 100644 --- a/web/bridge.js +++ b/web/bridge.js @@ -90,7 +90,7 @@ @media(max-width:1150px){.native-grid{grid-template-columns:1fr}.native-hdr{flex-direction:column}} `; css.textContent += "\n .native-modal{position:fixed;inset:0;z-index:700;display:flex;align-items:center;justify-content:center;\n background:rgba(3,11,18,.9);backdrop-filter:none;padding:22px;box-sizing:border-box}\n .native-modal[hidden]{display:none}\n .native-dialog{width:min(860px,96vw);max-height:min(840px,92vh);overflow:hidden;\n display:flex;flex-direction:column;background:linear-gradient(145deg,#243945 0%,#101e29 62%,#0c1821);\n border:1px solid #638293;border-radius:11px;box-shadow:0 18px 80px #000c,inset 0 1px #b2d9e449}\n .native-dialog-header{display:flex;align-items:center;justify-content:space-between;gap:15px;\n border-bottom:1px solid #3c5360;padding:14px 17px}\n .native-dialog-header h2{font-size:18px;font-weight:500;color:#e4f4f9;margin:4px 0}\n .native-dialog-body{padding:14px 17px;overflow:auto;min-height:60px}\n .native-dialog-footer{border-top:1px solid #334b58;padding:9px 17px;color:#91abb8;font-size:11px}\n .native-dialog.small{max-width:520px}\n .native-bar{height:12px;border:1px solid #527282;background:#0a1621;border-radius:7px;overflow:hidden;position:relative;\n box-shadow:inset 0 2px 5px #000c}\n .native-bar-fill{height:100%;width:0%;background:linear-gradient(180deg,#8ef6ff,#17a8da 43%,#08688e);\n box-shadow:none;border-right:1px solid #ddffff}\n .native-bar.unknown .native-bar-fill{width:34%;position:absolute;animation:native-indeterminate 1.65s ease-in-out infinite}\n @keyframes native-indeterminate{0%{left:-36%}50%{left:58%}100%{left:105%}}\n .native-progress-info{font:11px monospace;color:#a5d5e2;margin:8px 0;display:flex;justify-content:space-between;gap:9px}\n .native-progress-info strong{font-weight:500;color:#d8f9ff}\n #nativeScanHud{position:fixed;left:50%;transform:translateX(-50%);bottom:37px;z-index:550;\n background:#152c3b;border:1px solid #537588;border-radius:8px;box-shadow:0 6px 20px #000a;\n padding:9px 13px;width:min(470px,90vw)}\n #nativeScanHud[hidden]{display:none}\n .native-result{display:flex;align-items:center;gap:7px;background:#10222c;border:1px solid #314d5c;\n border-radius:6px;padding:9px 11px;margin:5px 0}\n .native-result span{flex:1;min-width:0}\n .native-result b{display:block;font-weight:500;color:#d6edf7;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n .native-result small{display:block;color:#88aaba;font-size:10px;margin-top:4px}\n .native-search{font-family:inherit!important}\n"; - css.textContent += "\n .native-insert-row{display:flex;align-items:center;gap:2px;width:100%;min-width:0}\n .native-insert-row>.insert{flex:1;min-width:0;text-align:left;overflow:hidden;\n text-overflow:ellipsis;white-space:nowrap;padding-left:4px;padding-right:1px}\n .native-insert-row>.native-power{flex:0 0 21px;width:21px;height:21px;\n font-size:14px;line-height:18px;text-align:center;border-radius:3px;\n border:1px solid #3b6973;color:#8becb3;cursor:pointer;padding:0;\n background:linear-gradient(#385e65,#102c30);box-shadow:inset 0 1px #91e8bd44}\n .native-insert-row>.native-power.is-off{color:#8b9ca5;border-color:#53616a;\n background:linear-gradient(#39414a,#171e27);box-shadow:none}\n .native-insert-row>.native-power:focus-visible{outline:2px solid #4dd7ff}\n .native-insert-row.is-bypassed>.insert{opacity:.54;filter:saturate(.55)}\n .native-engine .strip[data-preview=\"1\"] .meter-fill{opacity:0!important}\n .native-engine .strip[data-preview=\"1\"] .meter{opacity:.36}\n .native-engine .meter-fill{transition:none}\n "; + css.textContent += "\n .native-insert-row{display:flex;align-items:center;gap:2px;width:100%;min-width:0}\n .native-insert-row>.insert{flex:1;min-width:0;text-align:left;overflow:hidden;\n text-overflow:ellipsis;white-space:nowrap;padding-left:4px;padding-right:1px}\n .native-insert-row>.native-power{flex:0 0 21px;width:21px;height:21px;\n font-size:14px;line-height:18px;text-align:center;border-radius:3px;\n border:1px solid #3b6973;color:#8becb3;cursor:pointer;padding:0;\n background:linear-gradient(#385e65,#102c30);box-shadow:inset 0 1px #91e8bd44}\n .native-insert-row>.native-power.is-off{color:#8b9ca5;border-color:#53616a;\n background:linear-gradient(#39414a,#171e27);box-shadow:none}\n .native-insert-row>.native-power:focus-visible{outline:2px solid #4dd7ff}\n .native-insert-row.is-bypassed>.insert{opacity:.54;filter:saturate(.55)}\n .native-engine .strip:not(.master-strip)[data-preview=\"1\"] .meter-fill{opacity:0!important}\n .native-engine .strip:not(.master-strip)[data-preview=\"1\"] .meter{opacity:.36}\n .native-engine .meter-fill{transition:none}\n "; // Native-only FX popover: no mixer theme/layout changes and no full-screen dimmer. css.textContent += ` #nativeOrbit{z-index:980;background:transparent!important;backdrop-filter:none!important; @@ -567,7 +567,10 @@ tracks.forEach((track,i)=>{ // The v0.8 Master uses .master-fx-rack, not .rack. Handle it first. if(track.classList.contains("master-strip")){ - track.dataset.preview="1"; + // FX/PAN are previews, but MASTER L/R metering is REAL native output. + // Never tag this entire strip data-preview: that hides its live LEDs. + track.removeAttribute("data-preview"); + track.dataset.fxPreview="1"; track.title="Master FX and master PAN are visual previews; Master fader and meters are native"; track.querySelectorAll("[data-master-insert],[data-master-power]").forEach(x=>{ x.disabled=true;x.title="Preview only — Master FX DSP not yet implemented";