From 8c32151a655fa1d7b4d82a3b8325845f2ed7d290 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 14:19:03 +0700 Subject: [PATCH 1/9] fix(native): publish authoritative DSP gains to v0.8 WebView --- src/LiveAudioEngine.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 95c437d55..e4068344c 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -396,6 +396,11 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback o->setProperty ("masterMute", masterMute_.load()); o->setProperty ("channelMute", channelMute_.load()); o->setProperty ("channelPan", channelPan_.load()); + // Live controls are authoritative: never trust an old WebView localStorage fader/mute. + o->setProperty ("channelDb", juce::Decibels::gainToDecibels ( + channelGain_.load (std::memory_order_relaxed), -60.f)); + o->setProperty ("masterDb", juce::Decibels::gainToDecibels ( + masterGain_.load (std::memory_order_relaxed), -60.f)); o->setProperty ("dryTest", dryTest_.load()); juce::AudioDeviceManager::AudioDeviceSetup setup; deviceManager_.getAudioDeviceSetup (setup); From 3703bb76cb6b76db551ab733e6cbfd8d9d077c6b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 14:19:07 +0700 Subject: [PATCH 2/9] fix(native): block stale VST3 editors during graph retirement --- src/Main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Main.cpp b/src/Main.cpp index c2830f83e..4990da760 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -446,6 +446,10 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr } else if (action == "fxEditor") { + // Pending callback handoff may retire pluginAt() immediately after this event. + // Never open an editor for an old graph waiting to be destroyed. + if (engine_.isGraphSwitchPending()) + return emitNotice ("FX recall is transitioning; open the editor after recall completes.", true); editorWindow_.reset(); if (auto* processor = engine_.pluginAt (slot)) { From 63f3a8daac9700647dc75f9c4f496067cae19cf9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 14:19:11 +0700 Subject: [PATCH 3/9] fix(native-ui): reconcile actual gains and mutes and disable preview master PAN --- web/bridge.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/web/bridge.js b/web/bridge.js index 8f429a3a5..2a3efdbd9 100644 --- a/web/bridge.js +++ b/web/bridge.js @@ -307,8 +307,7 @@ if(!mixer)return; const tracks=mixer.querySelectorAll(".strip"); tracks.forEach((track,i)=>{ - const rack=track.querySelector(".rack"); - if(!rack)return; + // The v0.8 Master uses .master-fx-rack, not .rack. Handle it first. if(track.classList.contains("master-strip")){ track.dataset.preview="1"; track.title="Master FX and master PAN are visual previews; Master fader and meters are native"; @@ -321,6 +320,8 @@ if(marker)marker.textContent="NATIVE PEAKS"; return; } + const rack=track.querySelector(".rack"); + if(!rack)return; if(i!==0){ rack.dataset.preview="1"; track.dataset.preview="1"; @@ -552,11 +553,36 @@ } if(data.error)console.warn("AR MIX native:",text); }); + // The desktop DSP owns Channel 1 and Master gain/mute and Channel 1 PAN. + // Demo localStorage/snapshots must never make a live control visually disagree with audio. + function syncNativeMixerControls(d){ + if(typeof channels==="undefined" || !channels[0])return; + const channelDb=Number(d.channelDb), masterDb=Number(d.masterDb); + const channelPan=Math.round(Number(d.channelPan)*100); + if(!Number.isFinite(channelDb)||!Number.isFinite(masterDb)||!Number.isFinite(channelPan))return; + const channel=channels[0]; + let inputDirty=false,masterDirty=false; + if(Math.abs(channel.fader-channelDb)>0.05){channel.fader=channelDb;inputDirty=true;} + if(channel.pan!==channelPan){channel.pan=channelPan;inputDirty=true;} + if(typeof d.channelMute==="boolean" && channel.mute!==d.channelMute){ + channel.mute=d.channelMute;inputDirty=true; + } + if(typeof masterGain!=="undefined" && Math.abs(masterGain-masterDb)>0.05){ + masterGain=masterDb;masterDirty=true; + } + if(typeof masterMute!=="undefined" && typeof d.masterMute==="boolean" && masterMute!==d.masterMute){ + masterMute=d.masterMute;masterDirty=true; + } + if(inputDirty && typeof renderMixer==="function")renderMixer(); + else if(masterDirty && typeof renderMaster==="function")renderMaster(); + if(inputDirty||masterDirty)patchMixer(); + } let liveInputLevel=0, liveOutputLevel=0, liveOutputLeft=0, liveOutputRight=0; let lastSetupSignature=""; backend.addEventListener("arMixStatus",d=>{ state.device=d; state.monitor=!!d.monitor; + syncNativeMixerControls(d); const b=document.querySelector('[data-native-action="monitor"]'); if(b){b.textContent=state.monitor?"MUTE OUTPUT":"UNMUTE OUTPUT";b.classList.toggle("on",!state.monitor);} const text=d.error?"AUDIO ERROR: "+d.error: From 0b777715292514e009a904304b22f7d4eab2338c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 14:19:15 +0700 Subject: [PATCH 4/9] test(native): guard startup control truth, master PAN and editor lifetime --- tests/main_v08_native_integration_test.mjs | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/main_v08_native_integration_test.mjs b/tests/main_v08_native_integration_test.mjs index c6755ec8c..0280ad9c4 100644 --- a/tests/main_v08_native_integration_test.mjs +++ b/tests/main_v08_native_integration_test.mjs @@ -4,7 +4,7 @@ import assert from 'node:assert/strict'; import {readFileSync} from 'node:fs'; const read=p=>readFileSync(p,'utf8'); const app=read('web/app.js'), css=read('web/styles.css'), html=read('web/index.html'); -const bridge=read('web/bridge.js'), src=read('src/LiveAudioEngine.h'), offline=read('AR-MIX-Live-FX-Host-Standalone-v0.3.html'); +const bridge=read('web/bridge.js'), src=read('src/LiveAudioEngine.h'), main=read('src/Main.cpp'), offline=read('AR-MIX-Live-FX-Host-Standalone-v0.3.html'); test('GUI v0.8 remains the canonical host, not an older v0.5 reset',()=>{ assert.match(app,/function openChannelIdentity\(/); assert.match(app,/function masterFxRows\(/); @@ -27,6 +27,27 @@ test('no fake oscillating VUs inside native JUCE',()=>{ assert.match(bridge,/\["masterL",liveOutputLeft\]/); assert.match(bridge,/\["masterR",liveOutputRight\]/); }); +test('native mixer always displays DSP gain, pan, and mute instead of stale demo session',()=>{ + assert.match(src,/setProperty \("channelDb", juce::Decibels::gainToDecibels/); + assert.match(src,/setProperty \("masterDb", juce::Decibels::gainToDecibels/); + assert.match(bridge,/function syncNativeMixerControls\(d\)/); + assert.match(bridge,/syncNativeMixerControls\(d\);/); + assert.match(bridge,/channel\.mute=d\.channelMute/); + assert.match(bridge,/masterMute=d\.masterMute/); + assert.match(bridge,/Math\.abs\(channel\.fader-channelDb\)/); +}); +test('master native preview restrictions run before source channel rack lookup',()=>{ + const a=bridge.indexOf('if(track.classList.contains("master-strip"))'); + const b=bridge.indexOf('const rack=track.querySelector(".rack")',a); + assert.ok(a>0 && b>a); + assert.match(bridge,/pan\.style\.pointerEvents="none"/); +}); +test('editor opening cannot race with pending graph retirement',()=>{ + const a=main.indexOf('else if (action == "fxEditor")'); + const guard=main.indexOf('if (engine_.isGraphSwitchPending())',a); + const open=main.indexOf('engine_.pluginAt (slot)',a); + assert.ok(a>0 && guard>a && guard{ assert.match(src,/handoff_\.beginCycle\(/); assert.match(src,/handoff_\.stage \(/); From de5291e2de49aea781c658e6981c160be2945264 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 14:21:11 +0700 Subject: [PATCH 5/9] fix(native-ui): reconcile status without remounting active faders --- web/bridge.js | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/web/bridge.js b/web/bridge.js index 2a3efdbd9..b74e59cd5 100644 --- a/web/bridge.js +++ b/web/bridge.js @@ -554,28 +554,53 @@ if(data.error)console.warn("AR MIX native:",text); }); // The desktop DSP owns Channel 1 and Master gain/mute and Channel 1 PAN. - // Demo localStorage/snapshots must never make a live control visually disagree with audio. + // Only reconcile changed controls; never rebuild the strip while dragging a fader. + // A restored GUI-only snapshot must not masquerade as a live native setting. function syncNativeMixerControls(d){ if(typeof channels==="undefined" || !channels[0])return; const channelDb=Number(d.channelDb), masterDb=Number(d.masterDb); const channelPan=Math.round(Number(d.channelPan)*100); if(!Number.isFinite(channelDb)||!Number.isFinite(masterDb)||!Number.isFinite(channelPan))return; const channel=channels[0]; - let inputDirty=false,masterDirty=false; - if(Math.abs(channel.fader-channelDb)>0.05){channel.fader=channelDb;inputDirty=true;} - if(channel.pan!==channelPan){channel.pan=channelPan;inputDirty=true;} + let changed=false; + if(Math.abs(channel.fader-channelDb)>0.05){ + channel.fader=channelDb;changed=true; + const fader=document.querySelector('[data-fader="0"]'); + if(fader){fader.querySelector(".cap")?.style.setProperty("--pos",levelToTop(channelDb)+"%");fader.setAttribute("aria-valuenow",channelDb.toFixed(1));} + const read=document.querySelector('[data-read="0"]'); + if(read)read.textContent=fmt(channelDb); + } + if(channel.pan!==channelPan){ + channel.pan=channelPan;changed=true; + const pan=document.querySelector('[data-pan="0"]'); + if(pan){ + pan.classList.toggle("is-centered",channelPan===0); + pan.style.setProperty("--pan-frac",(channelPan+100)/200); + pan.style.setProperty("--pan-left",Math.min(.5,(channelPan+100)/200)); + pan.style.setProperty("--pan-span",Math.abs(channelPan)/200); + pan.setAttribute("aria-valuenow",String(channelPan)); + pan.setAttribute("aria-valuetext",panText(channelPan)); + } + const read=document.querySelector('[data-pan-read="0"]'); + if(read)read.textContent=panText(channelPan); + } if(typeof d.channelMute==="boolean" && channel.mute!==d.channelMute){ - channel.mute=d.channelMute;inputDirty=true; + channel.mute=d.channelMute;changed=true; + const mute=document.querySelector('[data-mute="0"]'); + if(mute){mute.classList.toggle("active",channel.mute);mute.setAttribute("aria-pressed",String(channel.mute));} } if(typeof masterGain!=="undefined" && Math.abs(masterGain-masterDb)>0.05){ - masterGain=masterDb;masterDirty=true; + masterGain=masterDb;changed=true; + const fader=document.querySelector('[data-fader="master"]'); + if(fader){fader.querySelector(".cap")?.style.setProperty("--pos",levelToTop(masterDb)+"%");fader.setAttribute("aria-valuenow",masterDb.toFixed(1));} + document.querySelectorAll(".master-db").forEach(e=>e.textContent=fmt(masterDb)); } if(typeof masterMute!=="undefined" && typeof d.masterMute==="boolean" && masterMute!==d.masterMute){ - masterMute=d.masterMute;masterDirty=true; + masterMute=d.masterMute;changed=true; + const mute=document.querySelector("#masterMute"); + if(mute){mute.classList.toggle("active",masterMute);mute.setAttribute("aria-pressed",String(masterMute));} } - if(inputDirty && typeof renderMixer==="function")renderMixer(); - else if(masterDirty && typeof renderMaster==="function")renderMaster(); - if(inputDirty||masterDirty)patchMixer(); + if(changed)patchMixer(); } let liveInputLevel=0, liveOutputLevel=0, liveOutputLeft=0, liveOutputRight=0; let lastSetupSignature=""; From 299e7644e0601da422d3258d70592b2958b81e40 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 14:23:01 +0700 Subject: [PATCH 6/9] fix(native-ui): reapply master preview restrictions after nested redraws --- web/bridge.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/bridge.js b/web/bridge.js index b74e59cd5..91be999db 100644 --- a/web/bridge.js +++ b/web/bridge.js @@ -317,7 +317,7 @@ const pan=track.querySelector('[data-pan="master"]'); if(pan){pan.removeAttribute("tabindex");pan.style.pointerEvents="none";pan.title="Master PAN DSP not yet implemented";} const marker=track.querySelector(".master-info-kicker span"); - if(marker)marker.textContent="NATIVE PEAKS"; + if(marker && marker.textContent!=="NATIVE PEAKS")marker.textContent="NATIVE PEAKS"; return; } const rack=track.querySelector(".rack"); @@ -363,7 +363,9 @@ }); } new MutationObserver(()=>syncView()).observe(workspace,{childList:true}); - new MutationObserver(()=>syncView()).observe(mixer,{childList:true}); + // renderMaster() replaces descendants without replacing the mixer root. + // Reapply the disabled native-only controls after each Master redraw. + new MutationObserver(()=>syncView()).observe(mixer,{childList:true,subtree:true}); const repaint=()=>{ if(currentTab()==="FX RACK") renderRack(); if(currentTab()==="SETUP") renderSetup(); From 5373d831f496989d722db30064d119c6520449ae Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 14:23:04 +0700 Subject: [PATCH 7/9] test(native-ui): assert nested Master render still disables preview controls --- tests/main_v08_native_integration_test.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/main_v08_native_integration_test.mjs b/tests/main_v08_native_integration_test.mjs index 0280ad9c4..c13d9a483 100644 --- a/tests/main_v08_native_integration_test.mjs +++ b/tests/main_v08_native_integration_test.mjs @@ -41,6 +41,8 @@ test('master native preview restrictions run before source channel rack lookup', const b=bridge.indexOf('const rack=track.querySelector(".rack")',a); assert.ok(a>0 && b>a); assert.match(bridge,/pan\.style\.pointerEvents="none"/); + assert.match(bridge,/observe\(mixer,\{childList:true,subtree:true\}\)/); + assert.match(bridge,/marker\.textContent!=="NATIVE PEAKS"/); }); test('editor opening cannot race with pending graph retirement',()=>{ const a=main.indexOf('else if (action == "fxEditor")'); From 6b4c98a3c717ee59302349a8b0b1029e62320d1c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 14:24:48 +0700 Subject: [PATCH 8/9] fix(native-ui): suppress stale DSP status while native fader or PAN is edited --- web/bridge.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/web/bridge.js b/web/bridge.js index 91be999db..03f0894c9 100644 --- a/web/bridge.js +++ b/web/bridge.js @@ -556,7 +556,18 @@ if(data.error)console.warn("AR MIX native:",text); }); // The desktop DSP owns Channel 1 and Master gain/mute and Channel 1 PAN. - // Only reconcile changed controls; never rebuild the strip while dragging a fader. + // Control events are dispatched asynchronously; never overwrite an in-flight + // fader/PAN edit with an older audio status frame. + let controlEditUntil=0; + function markNativeUiEdit(e){ + if(e.target?.closest?.('[data-fader="0"],[data-fader="master"],[data-pan="0"]')) + controlEditUntil=Date.now()+350; + if(typeof drag!=="undefined" && drag && + (drag.type==="fader" || drag.type==="pan")) + controlEditUntil=Date.now()+350; + } + for(const event of ["pointerdown","pointermove","pointerup","pointercancel","wheel","keydown"]) + document.addEventListener(event,markNativeUiEdit,true); // A restored GUI-only snapshot must not masquerade as a live native setting. function syncNativeMixerControls(d){ if(typeof channels==="undefined" || !channels[0])return; @@ -564,15 +575,17 @@ const channelPan=Math.round(Number(d.channelPan)*100); if(!Number.isFinite(channelDb)||!Number.isFinite(masterDb)||!Number.isFinite(channelPan))return; const channel=channels[0]; + const editing=Date.now()0.05){ + if(!editing && Math.abs(channel.fader-channelDb)>0.05){ channel.fader=channelDb;changed=true; const fader=document.querySelector('[data-fader="0"]'); if(fader){fader.querySelector(".cap")?.style.setProperty("--pos",levelToTop(channelDb)+"%");fader.setAttribute("aria-valuenow",channelDb.toFixed(1));} const read=document.querySelector('[data-read="0"]'); if(read)read.textContent=fmt(channelDb); } - if(channel.pan!==channelPan){ + if(!editing && channel.pan!==channelPan){ channel.pan=channelPan;changed=true; const pan=document.querySelector('[data-pan="0"]'); if(pan){ @@ -591,7 +604,7 @@ const mute=document.querySelector('[data-mute="0"]'); if(mute){mute.classList.toggle("active",channel.mute);mute.setAttribute("aria-pressed",String(channel.mute));} } - if(typeof masterGain!=="undefined" && Math.abs(masterGain-masterDb)>0.05){ + if(!editing && typeof masterGain!=="undefined" && Math.abs(masterGain-masterDb)>0.05){ masterGain=masterDb;changed=true; const fader=document.querySelector('[data-fader="master"]'); if(fader){fader.querySelector(".cap")?.style.setProperty("--pos",levelToTop(masterDb)+"%");fader.setAttribute("aria-valuenow",masterDb.toFixed(1));} From ee3532e454746fd676f9eb66d5a7b654b180e6d0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 14:25:02 +0700 Subject: [PATCH 9/9] test(native-ui): prevent stale status during active mixer gestures --- tests/main_v08_native_integration_test.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/main_v08_native_integration_test.mjs b/tests/main_v08_native_integration_test.mjs index c13d9a483..28caaeadc 100644 --- a/tests/main_v08_native_integration_test.mjs +++ b/tests/main_v08_native_integration_test.mjs @@ -35,6 +35,9 @@ test('native mixer always displays DSP gain, pan, and mute instead of stale demo assert.match(bridge,/channel\.mute=d\.channelMute/); assert.match(bridge,/masterMute=d\.masterMute/); assert.match(bridge,/Math\.abs\(channel\.fader-channelDb\)/); + assert.match(bridge,/const editing=Date\.now\(\){ const a=bridge.indexOf('if(track.classList.contains("master-strip"))');