From ce37710b733b9f32541bc7d4094324d4b318de29 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:11:27 +0700 Subject: [PATCH 01/26] feat(UX): reuse existing DAW-style IN field for all ten native hardware channel inputs --- web/mixer-io.js | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/web/mixer-io.js b/web/mixer-io.js index bf34032b4..4f6446946 100644 --- a/web/mixer-io.js +++ b/web/mixer-io.js @@ -780,12 +780,9 @@ // Every physical channel gets its own source selector. The native // routing controller is unchanged and owns every hardware APPLY. const head=strip.querySelector('.ch-id'); - if(isNative()&&head&&!head.querySelector('.arChannelQuickInput')){ - const picker=node('select','arChannelQuickInput'); - picker.setAttribute('aria-label','CH '+(Number(strip.dataset.strip)+1)+' physical input'); - picker.title='Verified hardware source · native ACK required'; - head.appendChild(picker); - } + // Native hardware selection now lives in the approved strip's EXISTING + // IN dropdown, identical in location to a DAW mixer. No header duplicate. + head?.querySelector('.arChannelQuickInput')?.remove(); if(strip.querySelector('.arChannelBank'))continue; const bank=node('div','arChannelBank'); bank.innerHTML='
INPUT SOURCE · NATIVEOUTPUT DESTINATIONMAIN · UNKNOWN
NATIVE PATCH REQUIRED
AUX SENDS · PRE / POST
'; @@ -808,13 +805,14 @@ const source=strip.querySelector('.arBankSource'),output=strip.querySelector('.arBankOutput'); if(!source||!output)return; const current=valueFor(r),choices=portsFor(s,r); - const inline=strip.querySelector('.arChannelQuickInput'); - if(inline){ + // Never create a parallel source picker. The visible approved IN control + // is the only normal operator entry point and displays native ACK truth. + const inline=strip.querySelector('.route-select[data-field="input"]'); + if(inline&&isNative()){ populate(inline,choices,current); inline.dataset.channel=String(i); - inline.disabled=!isNative()||!s.ready||!!s.pending||!!quickSourcePending; - inline.title='CH '+(i+1)+' · '+(choices.find(p=>p[0]===current)?.[1]||'Select physical input')+ - ' · hardware source; native ACK required'; + inline.disabled=!s.ready||!!s.pending||!!quickSourcePending; + inline.title='CH '+(i+1)+' · verified hardware input · native ACK'; } populate(source,choices,current); source.dataset.channel=String(i);source.disabled=!isNative()||!s.ready||!!s.pending||!!quickSourcePending; @@ -1624,6 +1622,26 @@ return committed?.ok?{ok:true,pending:true,live:false,epoch:s.epoch}: {ok:false,error:committed?.error||'Safe native APPLY rejected'}; } + // The canonical mixer IN dropdown invokes the same 10-channel route + // controller as Advanced Audio I/O. The bridge consumes the Pages demo + // change event and calls this one action; no demo track model is mutated. + window.__arMixChooseChannelHardwareInput=(channel,value)=>{ + if(!isNative()||!Number.isInteger(channel)||channel<0||channel>=10) + return {ok:false,error:'No verified native mixer channel'}; + const parts=String(value).split(':'),mode=parts[0]; + const left=mode==='NONE'?-1:Number(parts[1]); + const right=mode==='STEREO'?Number(parts[2]):-1; + if(!['NONE','MONO','STEREO'].includes(mode)|| + (mode!=='NONE'&&!Number.isInteger(left))|| + (mode==='STEREO'&&!Number.isInteger(right))) + return {ok:false,error:'Select an actual mono/stereo hardware input'}; + const answer=commitSourceInOneGesture(channel,mode,left,right); + if(answer?.pending)quickSourcePending={channel,epoch:answer.epoch, + value:valueFor({mode,left,right}),live:!!answer.live}; + if(!answer?.ok)matrixSay(answer?.error||'Native INPUT rejected'); + lastSignature='';refresh(); + return answer||{ok:false,error:'Native source controller unavailable'}; + }; function changeSource(select){ const channel=Number(select.dataset.channel); const value=select.value,parts=value.split(':'); From 11a9b3ee9c12a417eab0e7f4cbcd03ea63b51a69 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:11:45 +0700 Subject: [PATCH 02/26] fix(UX): connect existing IN dropdown to native 10CH route controller and use custom Audio I/O setup --- web/approved-native-bridge.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 7e548a6e3..b5c65894c 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -219,10 +219,11 @@ }; const caption=item("span","more-tools-caption","REAL AUDIO · FIRST SOUND"); const setup=item("button","tool","Audio Setup"); - setup.addEventListener("click",()=>{ - backend.emitEvent("arMixAction",{action:"audioSetup"}); - status("NATIVE: select actual ASIO/WASAPI input + output in Audio Setup."); - }); + // Reuse the ALREADY implemented compact Audio I/O panel from mixer-io. + // Its window-capture setup handler owns driver inventory and APPLY/ACK. + // The stock JUCE device popup remains available only via Advanced. + setup.dataset.nativeAction="audioSetup"; + setup.title="Configure real input and output devices in the mixer"; inputSelect=item("select","toolbar-select",""); inputSelect.setAttribute("aria-label","JUCE physical input for CH1"); inputSelect.addEventListener("change",()=>updateHardwarePanel(hardware)); @@ -344,6 +345,19 @@ if (!field)return false; const t=scope?.findTrack?.(el) || null; if (!t)return true; + // DAW-style per-track IN is routing, not ChannelId G0 control. + // Every native input is committed through the existing M4 ten-channel + // ACK controller. NEVER let Pages' demo field change actual audio. + if(field==="input"){ + if(event.type==="change"){ + const strip=el.closest?.(".strip[data-strip]"); + const channel=Number(strip?.dataset.strip); + const outcome=window.__arMixChooseChannelHardwareInput?.(channel,el.value); + if(!outcome?.ok)status("INPUT REJECTED · "+(outcome?.error||"native mixer unavailable")); + else status("CH "+(channel+1)+" INPUT · native ACK pending"); + } + return true; + } if (!flags.acceptedGraphConnected) { if (field==="level")el.value=String(t.level); else if (field==="pan")el.value=String(t.pan); From 8e0dc9d811e39c166060335ce44df2b64cb40a2b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:12:27 +0700 Subject: [PATCH 03/26] fix(audio): one input choice resumes monitoring only after exact native source ACK --- web/mixer-io.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/web/mixer-io.js b/web/mixer-io.js index 4f6446946..cb4732472 100644 --- a/web/mixer-io.js +++ b/web/mixer-io.js @@ -2051,9 +2051,19 @@ }); window.addEventListener('arMixSourceSwitchResult',event=>{ const result=event.detail||{}; - if(quickSourcePending?.live&&quickSourcePending.channel===result.channel) - quickSourcePending=null; + // Changing an already-prepared source uses the atomic PCM crossfade. + // When monitoring had been off, the user's explicit IN selection is the + // one live-audio gesture: arm only AFTER a verified SOURCE ACK and only on + // the current native epoch. Never enable playback on stale/failed ACK. + const source=quickSourcePending; const s=route(); + if(source?.live&&source.channel===result.channel){ + quickSourcePending=null; + if(result.ok===true&&source.epoch===s.epoch&&!s.monitor){ + const resumed=window.__arMixApplyAndActivate?.(); + if(!resumed?.ok)matrixSay(resumed?.error||'Monitor output unavailable'); + } + } lastSignature='';refresh(); if(!sourceChooser.hidden){ renderSourceChooser(); From 0b2bfc91c8f7da339f1f6edc2dbfcf1cf0e94ea4 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:13:19 +0700 Subject: [PATCH 04/26] test(DAW): assert existing IN source, custom setup and verified ACK path --- tests/mixer_io_operator_contract_test.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/mixer_io_operator_contract_test.mjs b/tests/mixer_io_operator_contract_test.mjs index 1817c2b1f..6a32fc58a 100644 --- a/tests/mixer_io_operator_contract_test.mjs +++ b/tests/mixer_io_operator_contract_test.mjs @@ -568,7 +568,10 @@ test('R7 negative hardware ACK releases blocked source controls',()=>{ test('hardware input CH1/CH2/CH10 selectable on the mixer itself without an IO modal',()=>{ const io=read('web/mixer-io.js'),css=read('web/mixer-io.css'); - assert.match(io,/head\.appendChild\(picker\)/); + assert.doesNotMatch(io,/head\.appendChild\(picker\)/); + assert.match(io,/\.route-select\[data-field="input"\]/); + assert.match(io,/__arMixChooseChannelHardwareInput=/); + assert.match(io,/source\.epoch===s\.epoch&&!s\.monitor/); assert.match(io,/populate\(inline,choices,current\)/); assert.match(io,/\.arChannelQuickInput,\.arBankSource,\.arIOSource/); assert.match(io,/commitSourceInOneGesture\(channel,mode,left,right\)/); From f4d0ca5e6ae3eabd6a3b87db7c04f289af261eae Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:13:23 +0700 Subject: [PATCH 05/26] test(DAW): assert existing IN source, custom setup and verified ACK path --- tests/approved_native_m2_contract.test.cjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index 2b584dd09..2ac3a0225 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -433,7 +433,8 @@ test("native Windows operator can explicitly patch first physical input, arm and const main=read("src/Main.cpp"); const engine=read("src/LiveAudioEngine.h"); assert.match(js,/REAL AUDIO · FIRST SOUND/); - assert.match(js,/action:"audioSetup"/); + assert.match(js,/setup\.dataset\.nativeAction="audioSetup"/); + assert.doesNotMatch(js,/backend\.emitEvent\("arMixAction",\{action:"audioSetup"\}\)/); assert.match(js,/d\.inputEndpoints\.filter\(p=>/); assert.match(js,/d\.enabledInputs\.includes\(p\.port\)/); assert.match(js,/action:"routingSourceSwitch",requestId:pendingSourceId/); From a166096ebd394a2c8cae263e65d88cd81e9d45a6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:15:13 +0700 Subject: [PATCH 06/26] build(gui): regenerate source-owned standalone mixer I/O JS exactly for DAW native input workflow --- AR-MIX-Live-FX-Host-Standalone-v0.3.html | 54 ++++++++++++++++++------ 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/AR-MIX-Live-FX-Host-Standalone-v0.3.html b/AR-MIX-Live-FX-Host-Standalone-v0.3.html index d280a1443..23ea223b4 100644 --- a/AR-MIX-Live-FX-Host-Standalone-v0.3.html +++ b/AR-MIX-Live-FX-Host-Standalone-v0.3.html @@ -4239,12 +4239,9 @@ // Every physical channel gets its own source selector. The native // routing controller is unchanged and owns every hardware APPLY. const head=strip.querySelector('.ch-id'); - if(isNative()&&head&&!head.querySelector('.arChannelQuickInput')){ - const picker=node('select','arChannelQuickInput'); - picker.setAttribute('aria-label','CH '+(Number(strip.dataset.strip)+1)+' physical input'); - picker.title='Verified hardware source · native ACK required'; - head.appendChild(picker); - } + // Native hardware selection now lives in the approved strip's EXISTING + // IN dropdown, identical in location to a DAW mixer. No header duplicate. + head?.querySelector('.arChannelQuickInput')?.remove(); if(strip.querySelector('.arChannelBank'))continue; const bank=node('div','arChannelBank'); bank.innerHTML='
INPUT SOURCE · NATIVEOUTPUT DESTINATIONMAIN · UNKNOWN
NATIVE PATCH REQUIRED
AUX SENDS · PRE / POST
'; @@ -4267,13 +4264,14 @@ const source=strip.querySelector('.arBankSource'),output=strip.querySelector('.arBankOutput'); if(!source||!output)return; const current=valueFor(r),choices=portsFor(s,r); - const inline=strip.querySelector('.arChannelQuickInput'); - if(inline){ + // Never create a parallel source picker. The visible approved IN control + // is the only normal operator entry point and displays native ACK truth. + const inline=strip.querySelector('.route-select[data-field="input"]'); + if(inline&&isNative()){ populate(inline,choices,current); inline.dataset.channel=String(i); - inline.disabled=!isNative()||!s.ready||!!s.pending||!!quickSourcePending; - inline.title='CH '+(i+1)+' · '+(choices.find(p=>p[0]===current)?.[1]||'Select physical input')+ - ' · hardware source; native ACK required'; + inline.disabled=!s.ready||!!s.pending||!!quickSourcePending; + inline.title='CH '+(i+1)+' · verified hardware input · native ACK'; } populate(source,choices,current); source.dataset.channel=String(i);source.disabled=!isNative()||!s.ready||!!s.pending||!!quickSourcePending; @@ -5083,6 +5081,26 @@ return committed?.ok?{ok:true,pending:true,live:false,epoch:s.epoch}: {ok:false,error:committed?.error||'Safe native APPLY rejected'}; } + // The canonical mixer IN dropdown invokes the same 10-channel route + // controller as Advanced Audio I/O. The bridge consumes the Pages demo + // change event and calls this one action; no demo track model is mutated. + window.__arMixChooseChannelHardwareInput=(channel,value)=>{ + if(!isNative()||!Number.isInteger(channel)||channel<0||channel>=10) + return {ok:false,error:'No verified native mixer channel'}; + const parts=String(value).split(':'),mode=parts[0]; + const left=mode==='NONE'?-1:Number(parts[1]); + const right=mode==='STEREO'?Number(parts[2]):-1; + if(!['NONE','MONO','STEREO'].includes(mode)|| + (mode!=='NONE'&&!Number.isInteger(left))|| + (mode==='STEREO'&&!Number.isInteger(right))) + return {ok:false,error:'Select an actual mono/stereo hardware input'}; + const answer=commitSourceInOneGesture(channel,mode,left,right); + if(answer?.pending)quickSourcePending={channel,epoch:answer.epoch, + value:valueFor({mode,left,right}),live:!!answer.live}; + if(!answer?.ok)matrixSay(answer?.error||'Native INPUT rejected'); + lastSignature='';refresh(); + return answer||{ok:false,error:'Native source controller unavailable'}; + }; function changeSource(select){ const channel=Number(select.dataset.channel); const value=select.value,parts=value.split(':'); @@ -5492,9 +5510,19 @@ }); window.addEventListener('arMixSourceSwitchResult',event=>{ const result=event.detail||{}; - if(quickSourcePending?.live&&quickSourcePending.channel===result.channel) - quickSourcePending=null; + // Changing an already-prepared source uses the atomic PCM crossfade. + // When monitoring had been off, the user's explicit IN selection is the + // one live-audio gesture: arm only AFTER a verified SOURCE ACK and only on + // the current native epoch. Never enable playback on stale/failed ACK. + const source=quickSourcePending; const s=route(); + if(source?.live&&source.channel===result.channel){ + quickSourcePending=null; + if(result.ok===true&&source.epoch===s.epoch&&!s.monitor){ + const resumed=window.__arMixApplyAndActivate?.(); + if(!resumed?.ok)matrixSay(resumed?.error||'Monitor output unavailable'); + } + } lastSignature='';refresh(); if(!sourceChooser.hidden){ renderSourceChooser(); From a518e6a0d03b0fa8d893720457bc2de6055a0fa7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:16:20 +0700 Subject: [PATCH 07/26] ux: hide duplicate patch and arm wizard under advanced diagnostics, keep native panic controls --- web/approved-native-bridge.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index b5c65894c..3462512d3 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -264,7 +264,15 @@ }); hardwareNote=item("span","more-tools-caption","Device not initialized"); hardwareNote.style.whiteSpace="normal"; - menu.append(caption,setup,inputSelect,routeBtn,armBtn,muteBtn,hardwareNote); + // Do not expose a second patch/ARM wizard as the normal mixer workflow. + // Retain hardware FAT and panic diagnostics in a collapsed expert-only + // section, while existing strip IN selects and routes audio in one action. + const advanced=document.createElement("details"); + advanced.className="arNativeFirstSoundAdvanced"; + const summary=document.createElement("summary"); + summary.textContent="Advanced · hardware diagnostics"; + advanced.append(summary,caption,inputSelect,routeBtn,armBtn,muteBtn,hardwareNote); + menu.append(setup,advanced); updateHardwarePanel(hardware); } From beb224999e7a1ae3bc67986ae83e3f5269ac477e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:18:11 +0700 Subject: [PATCH 08/26] feat(native): expose authoritative ten-channel M4 controls and peaks during G0 without fake ChannelId admission --- integration/ApprovedNativeRuntimeSnapshot.h | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/integration/ApprovedNativeRuntimeSnapshot.h b/integration/ApprovedNativeRuntimeSnapshot.h index eaafd93b0..ee2d9a6c5 100644 --- a/integration/ApprovedNativeRuntimeSnapshot.h +++ b/integration/ApprovedNativeRuntimeSnapshot.h @@ -82,6 +82,44 @@ inline bool publishVerifiedFirstSoundState(juce::var& snapshot, boolIs(route,"hasAcceptedRoute",true)); firstSound->setProperty("routingRevision",physicalReady ?juce::String(static_cast(revision)):juce::String("0")); + // G0 may still have the genuine 10-strip M4 DSP callback. Export its + // existing atomic control readback without falsely admitting ChannelId. + // A fresh/unpatched device must NEVER display pseudo-active controls. + if(physicalReady && boolIs(route,"hasAcceptedRoute",true) && + !boolIs(route,"nativeChannelIdPcmActive",true)) { + const auto controls=route.getProperty("channelControls",{}); + const auto levelsL=route.getProperty("channelPeaksL",{}); + const auto levelsR=route.getProperty("channelPeaksR",{}); + const auto* ctl=controls.getArray(); + const auto* left=levelsL.getArray(); + const auto* right=levelsR.getArray(); + bool valid=ctl && left && right && ctl->size()==10 && + left->size()==10 && right->size()==10; + if(valid)for(int i=0;i<10;++i) { + const auto c=ctl->getReference(i); + double db=0.,pan=0.,peakL=0.,peakR=0.; + if(!c.isObject()|| + !nativeV8Number(c.getProperty("db",{}),db) || + !nativeV8Number(c.getProperty("pan",{}),pan) || + !nativeV8Number(left->getReference(i),peakL) || + !nativeV8Number(right->getReference(i),peakR) || + db < -60.01 || db > 10.01 || pan < -100.01 || pan > 100.01 || + peakL < 0. || peakR < 0. || + !c.getProperty("mute",{}).isBool() || + !c.getProperty("solo",{}).isBool()) {valid=false;break;} + } + if(valid) { + firstSound->setProperty("channelControls",controls); + firstSound->setProperty("channelPeaksL",levelsL); + firstSound->setProperty("channelPeaksR",levelsR); + double masterDb=0.; + if(nativeV8Number(live.getProperty("masterDb",{}),masterDb) && + masterDb>=-60.01 && masterDb<=12.01) + firstSound->setProperty("masterDb",masterDb); + const auto muted=live.getProperty("masterMute",{}); + if(muted.isBool())firstSound->setProperty("masterMute",muted); + } + } // Do not write the route to the graph or change native capability flags. snapshot.getDynamicObject()->setProperty("legacyM4",juce::var(firstSound.release())); return physicalReady; From f99e2bb191d3c50ae68d5c84dbdb33a3a5d3e224 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:19:20 +0700 Subject: [PATCH 09/26] feat(audio): make approved 10-channel fader pan mute solo control actual M4 PCM via epoch-fenced native readback --- web/approved-native-bridge.js | 98 +++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 4 deletions(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 3462512d3..5843464fe 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -276,6 +276,72 @@ updateHardwarePanel(hardware); } + // The installed M4 renderer already has ten real native strip setters. + // Before ChannelId migration, show its ACCEPTED readback rather than + // disabling fader/PAN/MUTE/SOLO or inventing an optimistic demo state. + function m4Verified(){ + const m=legacy(),d=hardware?.device; + return m?.active===true&&m.routeAccepted===true && + Array.isArray(m.channelControls)&&m.channelControls.length===10 && + safeNativeCounter(d?.epoch)!==null && + safeNativeCounter(m.routingRevision)!==null; + } + function m4StripIndex(el){ + const root=el?.closest?.('.strip[data-strip]'); + if(!root)return -1; + const n=Number(root.dataset.strip); + return Number.isInteger(n)&&n>=0&&n<10?n:-1; + } + function m4Send(parameter,channel,value){ + if(!m4Verified()||channel<0||channel>=10)return false; + if(typeof value!=="boolean"&&!(Number.isFinite(value)))return false; + backend.emitEvent("arMixParameter",{ + parameter,channel:channel+1,value, + routeEpoch:safeNativeCounter(hardware.device.epoch), + routeRevision:safeNativeCounter(legacy().routingRevision) + }); + // 12Hz native snapshots are authoritative; never update Pages model here. + return true; + } + function paintM4Readback(next) { + const m=next?.raw?.legacyM4,controls=m?.channelControls; + if(!m?.active||!m.routeAccepted||!Array.isArray(controls)|| + controls.length!==10||!scope?.render||!Array.isArray(scope?.tracks))return; + let change=false; + for(let i=0;i<10;i++){ + const ctl=controls[i],track=scope.tracks[i]; + if(!ctl||!track||track.kind!=="audio"|| + !Number.isFinite(ctl.db)||!Number.isFinite(ctl.pan)|| + typeof ctl.mute!=="boolean"||typeof ctl.solo!=="boolean")return; + if(Math.abs(track.level-ctl.db)>.015){track.level=ctl.db;change=true;} + if(Math.abs(track.pan-ctl.pan)>.015){track.pan=ctl.pan;change=true;} + if(track.mute!==ctl.mute){track.mute=ctl.mute;change=true;} + if(track.solo!==ctl.solo){track.solo=ctl.solo;change=true;} + } + if(scope.master && Number.isFinite(m.masterDb) && + Math.abs(scope.master.level-m.masterDb)>.015){ + scope.master.level=m.masterDb;change=true; + } + if(scope.master && typeof m.masterMute==="boolean" && + scope.master.mute!==m.masterMute){ + scope.master.mute=m.masterMute;change=true; + } + if(change)scope.render(); + const l=m.channelPeaksL,r=m.channelPeaksR; + if(!Array.isArray(l)||!Array.isArray(r)||!scope.displayMeterDbfs)return; + const now=performance.now(); + for(let i=0;i<10;i++){ + const root=document.querySelector('.strip[data-strip="'+i+'"]'); + if(!root)continue; + for(const [side,v] of [["left",l[i]],["right",r[i]]]){ + if(!Number.isFinite(v)||v<0)continue; + const fill=root.querySelector('.meter-fill.'+side); + if(fill)scope.displayMeterDbfs(fill,v===0?-90: + Math.max(-90,Math.min(6,20*Math.log10(v))),now, + "m4:"+i+":"+side); + } + } + } function onNativeReadback(next) { updateHardwarePanel(next); const caps=next?.graph?.capabilities; @@ -284,7 +350,10 @@ flags.productionCallbackLive=false;flags.acceptedGraphConnected=false; lastPaintedSignature=""; stopDemo(); - status("NATIVE G0 · PATCH CH1/ARM tersedia pada device terverifikasi; kontrol ChannelId/WIRE menunggu PCM native."); + paintM4Readback(next); + status(m4Verified()? + "LIVE 10CH MIXER · INPUT/FADER/PAN/MUTE native · ChannelId migration pending": + "NATIVE DEVICE · select real IN on channel; output remains safe until native route"); return; } // Control readback may change at the SAME structural graph revision. @@ -367,9 +436,21 @@ return true; } if (!flags.acceptedGraphConnected) { - if (field==="level")el.value=String(t.level); - else if (field==="pan")el.value=String(t.pan); - status("NATIVE: ChannelId PCM not admitted; control unchanged"); + const n=m4StripIndex(el); + if(m4Verified()&&n>=0&&(field==="level"||field==="pan")){ + if(event.type!=="change")return true; // cap preview, native control on commit + const numeric=Number(el.value); + const value=field==="pan"? + (!el.dataset.panKeyboard&&!el.dataset.panAltPointer&&Math.abs(numeric)<=12?0:numeric): + numeric; + const parameter=field==="level"?"faderDb":"pan"; + if(!m4Send(parameter,n,value)) + status("NATIVE M4: control rejected; waiting real readback"); + return true; + } + if(field==="level")el.value=String(t.level); + else if(field==="pan")el.value=String(t.pan); + status("NATIVE: route not yet accepted; control unchanged"); return true; } // During a native pointer drag move the approved fader *cap* only. @@ -409,6 +490,14 @@ if (["wireExpand","wireSource","wireRoute","editIdentity","rename"].includes(action)) return !["wireExpand","wireSource","wireRoute"].includes(action); if (action==="mute"||action==="solo") { + if(!flags.acceptedGraphConnected && m4Verified()){ + const n=m4StripIndex(btn); + if(n>=0) { + if(!m4Send(action,n,!t[action])) + status("Native M4 control rejected; waiting readback"); + return true; + } + } const key=action==="mute"?"SET_MUTE":"SET_SOLO"; intent(key,t,{value:!t[action],enabled:!t[action]});return true; } @@ -486,6 +575,7 @@ // Presentation-only bank/selection remains available. document.addEventListener("pointerdown",event=>{ if (flags.acceptedGraphConnected) return; + if (m4Verified()&&m4StripIndex(event.target)>=0) return; if (!event.target.closest?.(".fader-box,.center-pan")) return; event.preventDefault();event.stopImmediatePropagation(); status("NATIVE G0: physical gain/pan unavailable until engine graph admission"); From 3427df3deb75c03050d9119fdee4f8d6efa1d75e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:19:55 +0700 Subject: [PATCH 10/26] fix(audio): wire master fader and master mute to existing native MAIN PCM control in G0 --- web/approved-native-bridge.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 5843464fe..4b845388f 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -436,6 +436,14 @@ return true; } if (!flags.acceptedGraphConnected) { + if(m4Verified()&&t.kind==="master"&&field==="level"){ + if(event.type==="change"&&Number.isFinite(Number(el.value))) + backend.emitEvent("arMixParameter",{ + parameter:"masterGain",channel:-1,value:Number(el.value), + routeEpoch:safeNativeCounter(hardware.device.epoch), + routeRevision:safeNativeCounter(legacy().routingRevision)}); + return true; + } const n=m4StripIndex(el); if(m4Verified()&&n>=0&&(field==="level"||field==="pan")){ if(event.type!=="change")return true; // cap preview, native control on commit @@ -490,6 +498,14 @@ if (["wireExpand","wireSource","wireRoute","editIdentity","rename"].includes(action)) return !["wireExpand","wireSource","wireRoute"].includes(action); if (action==="mute"||action==="solo") { + if(!flags.acceptedGraphConnected && m4Verified()&& + t.kind==="master"&&action==="mute"){ + backend.emitEvent("arMixParameter",{ + parameter:"masterMute",channel:-1,value:!t.mute, + routeEpoch:safeNativeCounter(hardware.device.epoch), + routeRevision:safeNativeCounter(legacy().routingRevision)}); + return true; + } if(!flags.acceptedGraphConnected && m4Verified()){ const n=m4StripIndex(btn); if(n>=0) { @@ -575,7 +591,9 @@ // Presentation-only bank/selection remains available. document.addEventListener("pointerdown",event=>{ if (flags.acceptedGraphConnected) return; - if (m4Verified()&&m4StripIndex(event.target)>=0) return; + if (m4Verified()&& + (m4StripIndex(event.target)>=0|| + scope?.findTrack?.(event.target)?.kind==="master"))return; if (!event.target.closest?.(".fader-box,.center-pan")) return; event.preventDefault();event.stopImmediatePropagation(); status("NATIVE G0: physical gain/pan unavailable until engine graph admission"); From 72fb81a5c2114ea1bb1f7af0577dac2adbebde2b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:20:32 +0700 Subject: [PATCH 11/26] test(M4): only verified ten-strip native readback controls fader/pan/mute/meter; stale epoch fails closed --- tests/approved_native_v8_projection_test.cpp | 56 ++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tests/approved_native_v8_projection_test.cpp b/tests/approved_native_v8_projection_test.cpp index 335593c5a..40b854d65 100644 --- a/tests/approved_native_v8_projection_test.cpp +++ b/tests/approved_native_v8_projection_test.cpp @@ -457,6 +457,61 @@ static void firstSoundMeasuredSignalEvidenceRegression() { assert(!static_cast(signal(live,true,true).getProperty("captureObserved",true))); } +// G0 must expose actual installed M4 controls (not imaginary ChannelId) +// only while a verified direct, routed ten-channel callback exists. +static void firstSoundM4ConsoleControlsRegression() { + auto snap=canonicalSnapshot(); + auto* dev=snap.getProperty("device",{}).getDynamicObject(); + dev->setProperty("epoch","7"); + dev->setProperty("sampleRate",48000.0); + dev->setProperty("bufferFrames",128); + juce::Array in,out; + in.add(0);out.add(0);out.add(1); + dev->setProperty("enabledInputs",juce::var(in)); + dev->setProperty("enabledOutputs",juce::var(out)); + auto live=parse(R"JSON({ + "connected":true,"directRouteAuthorized":true,"adaptiveClockActive":false, + "masterDb":-6.0,"masterMute":false, + "dryRoutingLab":{"active":true,"ready":true,"topologyFault":false, + "hasAcceptedRoute":true,"nativeChannelIdPcmActive":false, + "epoch":7,"revision":12,"channelControls":[], + "channelPeaksL":[],"channelPeaksR":[]} + })JSON"); + auto route=live.getProperty("dryRoutingLab",{}); + juce::Array controls,left,right; + for(int i=0;i<10;++i) { + auto* c=new juce::DynamicObject; + c->setProperty("db",i==4?-12.0:0.0); + c->setProperty("pan",0.0); + c->setProperty("mute",false); + c->setProperty("solo",false); + controls.add(juce::var(c));left.add(0.2);right.add(0.1); + } + route.getDynamicObject()->setProperty("channelControls",juce::var(controls)); + route.getDynamicObject()->setProperty("channelPeaksL",juce::var(left)); + route.getDynamicObject()->setProperty("channelPeaksR",juce::var(right)); + assert(publishVerifiedFirstSoundState(snap,live)); + auto m4=snap.getProperty("legacyM4",{}); + assert(m4.getProperty("channelControls",{}).getArray()->size()==10); + assert(static_cast(m4.getProperty("channelControls",{})[4] + .getProperty("db",{}))==-12.0); + assert(static_cast(m4.getProperty("masterDb",{}))==-6.0); + assert(!static_cast(snap.getProperty("graph",{}) + .getProperty("capabilities",{}).getProperty("callbackOwnsChannelIds",true))); + // Bad controls are not published despite a prepared device. + controls.removeLast(); + route.getDynamicObject()->setProperty("channelControls",juce::var(controls)); + assert(publishVerifiedFirstSoundState(snap,live)); + assert(snap.getProperty("legacyM4",{}) + .getProperty("channelControls",{}).isVoid()); + // Hotplug/stale epoch removes all previously displayed live controls. + controls.add(juce::var(new juce::DynamicObject)); + route.getDynamicObject()->setProperty("epoch",8); + assert(!publishVerifiedFirstSoundState(snap,live)); + assert(snap.getProperty("legacyM4",{}) + .getProperty("channelControls",{}).isVoid()); +} + int main() { auto snap=canonicalSnapshot(); auto bus=realBusReadbackFixture(); @@ -490,6 +545,7 @@ int main() { controlIntentTranslationCases(snap,bus); installedCallbackAdmissionRegression(bus); firstSoundRouteAdmissionRegression(); + firstSoundM4ConsoleControlsRegression(); firstSoundMeasuredSignalEvidenceRegression(); auto missingMain=realBusReadbackFixture(); From f338e763ffa4957d508fb516d20941f5e2820c99 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:20:52 +0700 Subject: [PATCH 12/26] test(DAW): verify ten-channel M4 fader mute pan readback and single native IN routing authority --- tests/approved_native_m2_contract.test.cjs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index 2ac3a0225..8faf09220 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -114,6 +114,29 @@ test("native signal evidence is produced from measured engine fields, never JS s assert.doesNotMatch(transport,/setProperty \("rawCapturePeak", 0\.0\)/); assert.match(bridge,/protocol\.diagnoseFirstSound/); }); +test("DAW-style all-channel IN / M4 fader mute pan use real native control and readback, never mock PCM",()=>{ + const bridge=read("web/approved-native-bridge.js"); + const io=read("web/mixer-io.js"); + const producer=read("integration/ApprovedNativeRuntimeSnapshot.h"); + const engine=read("src/LiveDryRoutingLab.h"); + const nativeMain=read("src/Main.cpp"); + assert.match(io,/\.route-select\[data-field="input"\]/); + assert.match(io,/__arMixChooseChannelHardwareInput=/); + assert.match(bridge,/field==="input"/); + assert.match(bridge,/__arMixChooseChannelHardwareInput\?\.\(channel,el\.value\)/); + assert.match(bridge,/function paintM4Readback\(next\)/); + assert.match(bridge,/channelControls/); + assert.match(bridge,/parameter,channel:channel\+1,value/); + assert.match(bridge,/routeEpoch:safeNativeCounter/); + assert.match(bridge,/if\(m4Verified\(\)\&\&m4StripIndex\(event\.target\)>=0/); + assert.match(producer,/firstSound->setProperty\("channelControls",controls\)/); + assert.match(producer,/firstSound->setProperty\("channelPeaksL",levelsL\)/); + assert.match(engine,/publisher_\.updateActiveControl\(expectedEpoch,expectedRevision/); + assert.match(nativeMain,/engine_\.setDryRoutingLabParameter\(channel-1,epoch,revision/); + assert.doesNotMatch(bridge,/const audioContext=new AudioContext/); + assert.doesNotMatch(bridge,/function synthesizePCM/); + assert.match(bridge,/setup\.dataset\.nativeAction="audioSetup"/); +}); test("strict producer rejects JS Number identities, invalid hardware pins and fake LIVE",()=>{ const cases=[ s=>{s.device.epoch=69;}, From 5902aa10b8174e2747e8ae1b52a4d2bfd275a8f6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:22:06 +0700 Subject: [PATCH 13/26] test(DAW): validate G0 native gesture gate without assuming single-line formatting --- tests/approved_native_m2_contract.test.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index 8faf09220..2c4aec9a0 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -128,7 +128,7 @@ test("DAW-style all-channel IN / M4 fader mute pan use real native control and r assert.match(bridge,/channelControls/); assert.match(bridge,/parameter,channel:channel\+1,value/); assert.match(bridge,/routeEpoch:safeNativeCounter/); - assert.match(bridge,/if\(m4Verified\(\)\&\&m4StripIndex\(event\.target\)>=0/); + assert.match(bridge,/m4StripIndex\(event\.target\)>=0/); assert.match(producer,/firstSound->setProperty\("channelControls",controls\)/); assert.match(producer,/firstSound->setProperty\("channelPeaksL",levelsL\)/); assert.match(engine,/publisher_\.updateActiveControl\(expectedEpoch,expectedRevision/); From a525190efdbe6fe73048e185c0e93c4f87b71031 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:23:48 +0700 Subject: [PATCH 14/26] refactor: keep legacy renderer unchanged; native approved /preview/ owns DAW mixer controls --- web/mixer-io.js | 54 ++++++++++++------------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/web/mixer-io.js b/web/mixer-io.js index cb4732472..bf34032b4 100644 --- a/web/mixer-io.js +++ b/web/mixer-io.js @@ -780,9 +780,12 @@ // Every physical channel gets its own source selector. The native // routing controller is unchanged and owns every hardware APPLY. const head=strip.querySelector('.ch-id'); - // Native hardware selection now lives in the approved strip's EXISTING - // IN dropdown, identical in location to a DAW mixer. No header duplicate. - head?.querySelector('.arChannelQuickInput')?.remove(); + if(isNative()&&head&&!head.querySelector('.arChannelQuickInput')){ + const picker=node('select','arChannelQuickInput'); + picker.setAttribute('aria-label','CH '+(Number(strip.dataset.strip)+1)+' physical input'); + picker.title='Verified hardware source · native ACK required'; + head.appendChild(picker); + } if(strip.querySelector('.arChannelBank'))continue; const bank=node('div','arChannelBank'); bank.innerHTML='
INPUT SOURCE · NATIVEOUTPUT DESTINATIONMAIN · UNKNOWN
NATIVE PATCH REQUIRED
AUX SENDS · PRE / POST
'; @@ -805,14 +808,13 @@ const source=strip.querySelector('.arBankSource'),output=strip.querySelector('.arBankOutput'); if(!source||!output)return; const current=valueFor(r),choices=portsFor(s,r); - // Never create a parallel source picker. The visible approved IN control - // is the only normal operator entry point and displays native ACK truth. - const inline=strip.querySelector('.route-select[data-field="input"]'); - if(inline&&isNative()){ + const inline=strip.querySelector('.arChannelQuickInput'); + if(inline){ populate(inline,choices,current); inline.dataset.channel=String(i); - inline.disabled=!s.ready||!!s.pending||!!quickSourcePending; - inline.title='CH '+(i+1)+' · verified hardware input · native ACK'; + inline.disabled=!isNative()||!s.ready||!!s.pending||!!quickSourcePending; + inline.title='CH '+(i+1)+' · '+(choices.find(p=>p[0]===current)?.[1]||'Select physical input')+ + ' · hardware source; native ACK required'; } populate(source,choices,current); source.dataset.channel=String(i);source.disabled=!isNative()||!s.ready||!!s.pending||!!quickSourcePending; @@ -1622,26 +1624,6 @@ return committed?.ok?{ok:true,pending:true,live:false,epoch:s.epoch}: {ok:false,error:committed?.error||'Safe native APPLY rejected'}; } - // The canonical mixer IN dropdown invokes the same 10-channel route - // controller as Advanced Audio I/O. The bridge consumes the Pages demo - // change event and calls this one action; no demo track model is mutated. - window.__arMixChooseChannelHardwareInput=(channel,value)=>{ - if(!isNative()||!Number.isInteger(channel)||channel<0||channel>=10) - return {ok:false,error:'No verified native mixer channel'}; - const parts=String(value).split(':'),mode=parts[0]; - const left=mode==='NONE'?-1:Number(parts[1]); - const right=mode==='STEREO'?Number(parts[2]):-1; - if(!['NONE','MONO','STEREO'].includes(mode)|| - (mode!=='NONE'&&!Number.isInteger(left))|| - (mode==='STEREO'&&!Number.isInteger(right))) - return {ok:false,error:'Select an actual mono/stereo hardware input'}; - const answer=commitSourceInOneGesture(channel,mode,left,right); - if(answer?.pending)quickSourcePending={channel,epoch:answer.epoch, - value:valueFor({mode,left,right}),live:!!answer.live}; - if(!answer?.ok)matrixSay(answer?.error||'Native INPUT rejected'); - lastSignature='';refresh(); - return answer||{ok:false,error:'Native source controller unavailable'}; - }; function changeSource(select){ const channel=Number(select.dataset.channel); const value=select.value,parts=value.split(':'); @@ -2051,19 +2033,9 @@ }); window.addEventListener('arMixSourceSwitchResult',event=>{ const result=event.detail||{}; - // Changing an already-prepared source uses the atomic PCM crossfade. - // When monitoring had been off, the user's explicit IN selection is the - // one live-audio gesture: arm only AFTER a verified SOURCE ACK and only on - // the current native epoch. Never enable playback on stale/failed ACK. - const source=quickSourcePending; - const s=route(); - if(source?.live&&source.channel===result.channel){ + if(quickSourcePending?.live&&quickSourcePending.channel===result.channel) quickSourcePending=null; - if(result.ok===true&&source.epoch===s.epoch&&!s.monitor){ - const resumed=window.__arMixApplyAndActivate?.(); - if(!resumed?.ok)matrixSay(resumed?.error||'Monitor output unavailable'); - } - } + const s=route(); lastSignature='';refresh(); if(!sourceChooser.hidden){ renderSourceChooser(); From b440a874a9ed1c676410080c35ac439da216ede7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:23:55 +0700 Subject: [PATCH 15/26] refactor: keep legacy renderer unchanged; native approved /preview/ owns DAW mixer controls --- AR-MIX-Live-FX-Host-Standalone-v0.3.html | 54 ++++++------------------ 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/AR-MIX-Live-FX-Host-Standalone-v0.3.html b/AR-MIX-Live-FX-Host-Standalone-v0.3.html index 23ea223b4..d280a1443 100644 --- a/AR-MIX-Live-FX-Host-Standalone-v0.3.html +++ b/AR-MIX-Live-FX-Host-Standalone-v0.3.html @@ -4239,9 +4239,12 @@ // Every physical channel gets its own source selector. The native // routing controller is unchanged and owns every hardware APPLY. const head=strip.querySelector('.ch-id'); - // Native hardware selection now lives in the approved strip's EXISTING - // IN dropdown, identical in location to a DAW mixer. No header duplicate. - head?.querySelector('.arChannelQuickInput')?.remove(); + if(isNative()&&head&&!head.querySelector('.arChannelQuickInput')){ + const picker=node('select','arChannelQuickInput'); + picker.setAttribute('aria-label','CH '+(Number(strip.dataset.strip)+1)+' physical input'); + picker.title='Verified hardware source · native ACK required'; + head.appendChild(picker); + } if(strip.querySelector('.arChannelBank'))continue; const bank=node('div','arChannelBank'); bank.innerHTML='
INPUT SOURCE · NATIVEOUTPUT DESTINATIONMAIN · UNKNOWN
NATIVE PATCH REQUIRED
AUX SENDS · PRE / POST
'; @@ -4264,14 +4267,13 @@ const source=strip.querySelector('.arBankSource'),output=strip.querySelector('.arBankOutput'); if(!source||!output)return; const current=valueFor(r),choices=portsFor(s,r); - // Never create a parallel source picker. The visible approved IN control - // is the only normal operator entry point and displays native ACK truth. - const inline=strip.querySelector('.route-select[data-field="input"]'); - if(inline&&isNative()){ + const inline=strip.querySelector('.arChannelQuickInput'); + if(inline){ populate(inline,choices,current); inline.dataset.channel=String(i); - inline.disabled=!s.ready||!!s.pending||!!quickSourcePending; - inline.title='CH '+(i+1)+' · verified hardware input · native ACK'; + inline.disabled=!isNative()||!s.ready||!!s.pending||!!quickSourcePending; + inline.title='CH '+(i+1)+' · '+(choices.find(p=>p[0]===current)?.[1]||'Select physical input')+ + ' · hardware source; native ACK required'; } populate(source,choices,current); source.dataset.channel=String(i);source.disabled=!isNative()||!s.ready||!!s.pending||!!quickSourcePending; @@ -5081,26 +5083,6 @@ return committed?.ok?{ok:true,pending:true,live:false,epoch:s.epoch}: {ok:false,error:committed?.error||'Safe native APPLY rejected'}; } - // The canonical mixer IN dropdown invokes the same 10-channel route - // controller as Advanced Audio I/O. The bridge consumes the Pages demo - // change event and calls this one action; no demo track model is mutated. - window.__arMixChooseChannelHardwareInput=(channel,value)=>{ - if(!isNative()||!Number.isInteger(channel)||channel<0||channel>=10) - return {ok:false,error:'No verified native mixer channel'}; - const parts=String(value).split(':'),mode=parts[0]; - const left=mode==='NONE'?-1:Number(parts[1]); - const right=mode==='STEREO'?Number(parts[2]):-1; - if(!['NONE','MONO','STEREO'].includes(mode)|| - (mode!=='NONE'&&!Number.isInteger(left))|| - (mode==='STEREO'&&!Number.isInteger(right))) - return {ok:false,error:'Select an actual mono/stereo hardware input'}; - const answer=commitSourceInOneGesture(channel,mode,left,right); - if(answer?.pending)quickSourcePending={channel,epoch:answer.epoch, - value:valueFor({mode,left,right}),live:!!answer.live}; - if(!answer?.ok)matrixSay(answer?.error||'Native INPUT rejected'); - lastSignature='';refresh(); - return answer||{ok:false,error:'Native source controller unavailable'}; - }; function changeSource(select){ const channel=Number(select.dataset.channel); const value=select.value,parts=value.split(':'); @@ -5510,19 +5492,9 @@ }); window.addEventListener('arMixSourceSwitchResult',event=>{ const result=event.detail||{}; - // Changing an already-prepared source uses the atomic PCM crossfade. - // When monitoring had been off, the user's explicit IN selection is the - // one live-audio gesture: arm only AFTER a verified SOURCE ACK and only on - // the current native epoch. Never enable playback on stale/failed ACK. - const source=quickSourcePending; - const s=route(); - if(source?.live&&source.channel===result.channel){ + if(quickSourcePending?.live&&quickSourcePending.channel===result.channel) quickSourcePending=null; - if(result.ok===true&&source.epoch===s.epoch&&!s.monitor){ - const resumed=window.__arMixApplyAndActivate?.(); - if(!resumed?.ok)matrixSay(resumed?.error||'Monitor output unavailable'); - } - } + const s=route(); lastSignature='';refresh(); if(!sourceChooser.hidden){ renderSourceChooser(); From 14162799914fa531bf347e6e32d21ca7b294d6f2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:24:02 +0700 Subject: [PATCH 16/26] refactor: keep legacy renderer unchanged; native approved /preview/ owns DAW mixer controls --- tests/mixer_io_operator_contract_test.mjs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/mixer_io_operator_contract_test.mjs b/tests/mixer_io_operator_contract_test.mjs index 6a32fc58a..1817c2b1f 100644 --- a/tests/mixer_io_operator_contract_test.mjs +++ b/tests/mixer_io_operator_contract_test.mjs @@ -568,10 +568,7 @@ test('R7 negative hardware ACK releases blocked source controls',()=>{ test('hardware input CH1/CH2/CH10 selectable on the mixer itself without an IO modal',()=>{ const io=read('web/mixer-io.js'),css=read('web/mixer-io.css'); - assert.doesNotMatch(io,/head\.appendChild\(picker\)/); - assert.match(io,/\.route-select\[data-field="input"\]/); - assert.match(io,/__arMixChooseChannelHardwareInput=/); - assert.match(io,/source\.epoch===s\.epoch&&!s\.monitor/); + assert.match(io,/head\.appendChild\(picker\)/); assert.match(io,/populate\(inline,choices,current\)/); assert.match(io,/\.arChannelQuickInput,\.arBankSource,\.arIOSource/); assert.match(io,/commitSourceInOneGesture\(channel,mode,left,right\)/); From d487067d4e4372f07fd0bed9f9792e416aa11377 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:24:40 +0700 Subject: [PATCH 17/26] feat(native): expose authoritative M4 source mapping for all ten strips including prepared unpatched graph --- integration/ApprovedNativeRuntimeSnapshot.h | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/integration/ApprovedNativeRuntimeSnapshot.h b/integration/ApprovedNativeRuntimeSnapshot.h index ee2d9a6c5..8c0fa82f0 100644 --- a/integration/ApprovedNativeRuntimeSnapshot.h +++ b/integration/ApprovedNativeRuntimeSnapshot.h @@ -82,6 +82,32 @@ inline bool publishVerifiedFirstSoundState(juce::var& snapshot, boolIs(route,"hasAcceptedRoute",true)); firstSound->setProperty("routingRevision",physicalReady ?juce::String(static_cast(revision)):juce::String("0")); + // The default GUI IN selector must reflect the ACTUAL accepted or + // verified prepared M4 topology, never the Pages demo route string. + // All ten lanes are independently selectable (including sparse ASIO pins). + if(physicalReady) { + const auto topology=boolIs(route,"hasAcceptedRoute",true) + ?route.getProperty("acceptedRoute",{}) + :route.getProperty("preparedM4Route",{}); + const auto sourceRows=topology.getProperty("channels",{}); + const auto* entries=sourceRows.getArray(); + bool valid=entries && entries->size()==10; + if(valid)for(const auto& row:*entries) { + const auto mode=row.getProperty("mode",{}).toString(); + if(!row.isObject()|| + (mode!="NONE"&&mode!="MONO"&&mode!="STEREO"&&mode!="BUS")) { + valid=false;break; + } + if(mode=="MONO"||mode=="STEREO") { + const auto left=row.getProperty("left",{}),right=row.getProperty("right",{}); + if(!left.isInt() && !left.isInt64()){valid=false;break;} + if(mode=="STEREO" && !right.isInt() && !right.isInt64()) { + valid=false;break; + } + } + } + if(valid)firstSound->setProperty("channelSources",sourceRows); + } // G0 may still have the genuine 10-strip M4 DSP callback. Export its // existing atomic control readback without falsely admitting ChannelId. // A fresh/unpatched device must NEVER display pseudo-active controls. From 404172bcceb49aa36e99ffd54abef46f5841d8db Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:25:51 +0700 Subject: [PATCH 18/26] fix(native GUI): route actual /preview/ data-id strip IN to installed ten-channel M4 source switch --- web/approved-native-bridge.js | 90 +++++++++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 15 deletions(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 4b845388f..6acbdffdb 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -279,6 +279,69 @@ // The installed M4 renderer already has ten real native strip setters. // Before ChannelId migration, show its ACCEPTED readback rather than // disabling fader/PAN/MUTE/SOLO or inventing an optimistic demo state. + // User's one IN selection is the entire normal patch+monitor gesture. + // A real ACK/epoch/accepted row must precede any guarded output resume. + let pendingStripSource=null; + function chooseNativeStripInput(select) { + const n=m4StripIndex(select),d=hardware?.device,m=legacy(); + const epoch=safeNativeCounter(d?.epoch),revision=safeNativeCounter(m?.routingRevision); + const parts=String(select.value).split(":"); + const mode=parts[0],left=Number(parts[1]),right=mode==="STEREO"?Number(parts[2]):-1; + const active=new Set((d?.inputEndpoints||[]).filter(x=>x.active===true).map(x=>x.port)); + if(!deviceReady()||n<0||n>=10||pendingSourceId|| + epoch===null||revision===null||!["MONO","STEREO"].includes(mode)|| + !Number.isInteger(left)||!active.has(left)|| + (mode==="STEREO"&&(!Number.isInteger(right)||right===left||!active.has(right)))) { + status("INPUT NOT CHANGED · select a verified active mono/stereo input"); + paintM4Inputs(hardware);return; + } + pendingSourceId=++sourceSerial; + pendingStripSource={requestId:pendingSourceId,channel:n,mode,left,right,epoch}; + backend.emitEvent("arMixAction",{ + action:"routingSourceSwitch",requestId:pendingSourceId, + channel:n,mode,left,right,deviceEpoch:epoch,revision + }); + status("CH "+(n+1)+" · connecting input (native ACK)"); + paintM4Inputs(hardware); + } + function paintM4Inputs(next) { + if(!Array.isArray(scope?.tracks))return; + const d=next?.device,m=next?.raw?.legacyM4; + const active=Array.isArray(d?.inputEndpoints)?d.inputEndpoints.filter(p=> + p?.active===true && d.enabledInputs?.includes(p.port)):[]; + const options=[]; + // NONE is displayed as state, not offered as a nonfunctional patch. + options.push(["NONE","No input"]); + for(const pin of active)options.push(["MONO:"+pin.port, + "Mono · "+pin.label]); + for(let i=0;io[0]===value)) + list.push([value,"Previous input · not active"]); + const signature=JSON.stringify(list); + if(select.dataset.nativeOptions!==signature){ + select.replaceChildren(...list.map(([v,label])=>new Option(label,v))); + select.dataset.nativeOptions=signature; + } + if(select.value!==value)select.value=value; + select.disabled=!deviceReady()||pendingSourceId!==0||!Array.isArray(m?.channelSources); + select.title="CH "+(i+1)+" · verified hardware IN · native route ACK"; + } + } function m4Verified(){ const m=legacy(),d=hardware?.device; return m?.active===true&&m.routeAccepted===true && @@ -287,10 +350,11 @@ safeNativeCounter(m.routingRevision)!==null; } function m4StripIndex(el){ - const root=el?.closest?.('.strip[data-strip]'); - if(!root)return -1; - const n=Number(root.dataset.strip); - return Number.isInteger(n)&&n>=0&&n<10?n:-1; + // /preview/ uses stable view-local data-id, NOT the retired data-strip. + const root=el?.closest?.('.strip[data-id]'); + if(!root || !Array.isArray(scope?.tracks))return -1; + const index=scope.tracks.findIndex(t=>String(t.id)===root.dataset.id); + return index>=0&&index<10?index:-1; } function m4Send(parameter,channel,value){ if(!m4Verified()||channel<0||channel>=10)return false; @@ -327,11 +391,12 @@ scope.master.mute=m.masterMute;change=true; } if(change)scope.render(); + paintM4Inputs(next); const l=m.channelPeaksL,r=m.channelPeaksR; if(!Array.isArray(l)||!Array.isArray(r)||!scope.displayMeterDbfs)return; const now=performance.now(); for(let i=0;i<10;i++){ - const root=document.querySelector('.strip[data-strip="'+i+'"]'); + const root=document.querySelector('.strip[data-id="'+scope.tracks[i]?.id+'"]'); if(!root)continue; for(const [side,v] of [["left",l[i]],["right",r[i]]]){ if(!Number.isFinite(v)||v<0)continue; @@ -351,6 +416,7 @@ lastPaintedSignature=""; stopDemo(); paintM4Readback(next); + if(!m4Verified())paintM4Inputs(next); status(m4Verified()? "LIVE 10CH MIXER · INPUT/FADER/PAN/MUTE native · ChannelId migration pending": "NATIVE DEVICE · select real IN on channel; output remains safe until native route"); @@ -422,17 +488,11 @@ if (!field)return false; const t=scope?.findTrack?.(el) || null; if (!t)return true; - // DAW-style per-track IN is routing, not ChannelId G0 control. - // Every native input is committed through the existing M4 ten-channel - // ACK controller. NEVER let Pages' demo field change actual audio. + // Approved /preview/ IN selects from actual JUCE callback pins. + // The installed M4 native graph owns the ten physical source switches. + // This is the SAME engine route used by the live PCM callback. if(field==="input"){ - if(event.type==="change"){ - const strip=el.closest?.(".strip[data-strip]"); - const channel=Number(strip?.dataset.strip); - const outcome=window.__arMixChooseChannelHardwareInput?.(channel,el.value); - if(!outcome?.ok)status("INPUT REJECTED · "+(outcome?.error||"native mixer unavailable")); - else status("CH "+(channel+1)+" INPUT · native ACK pending"); - } + if(event.type==="change")chooseNativeStripInput(el); return true; } if (!flags.acceptedGraphConnected) { From 401682594aff3bb495c82deeac13b7f14c654629 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:26:30 +0700 Subject: [PATCH 19/26] fix(DAW): one user IN selection confirms exact CH source ACK then safe native monitor, restore real JUCE device settings action --- web/approved-native-bridge.js | 39 ++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 6acbdffdb..c6f8a9001 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -219,11 +219,12 @@ }; const caption=item("span","more-tools-caption","REAL AUDIO · FIRST SOUND"); const setup=item("button","tool","Audio Setup"); - // Reuse the ALREADY implemented compact Audio I/O panel from mixer-io. - // Its window-capture setup handler owns driver inventory and APPLY/ACK. - // The stock JUCE device popup remains available only via Advanced. - setup.dataset.nativeAction="audioSetup"; - setup.title="Configure real input and output devices in the mixer"; + // Device preferences remain a one-time JUCE owner. The approved Pages + // WebView does NOT load legacy mixer-io.js; never call its absent overlay. + setup.addEventListener("click",()=>{ + backend.emitEvent("arMixAction",{action:"audioSetup"}); + status("Choose hardware driver/input/output once; then select IN on each strip."); + }); inputSelect=item("select","toolbar-select",""); inputSelect.setAttribute("aria-label","JUCE physical input for CH1"); inputSelect.addEventListener("change",()=>updateHardwarePanel(hardware)); @@ -465,12 +466,30 @@ backend.addEventListener("arMixConsoleAck", ack=>controller.onAck(ack)); backend.addEventListener("arMixSourceSwitchAck", ack=>{ if(!pendingSourceId||ack?.requestId!==pendingSourceId)return; - pendingSourceId=0; - if(ack.ok===true) { - status("NATIVE: CH1 PATCH accepted by JUCE; validating later readback."); - controller.subscribe(); - }else status("NATIVE PATCH REJECTED: "+(ack?.error||"stale physical route")); + const selected=pendingStripSource; + pendingSourceId=0;pendingStripSource=null; + const result=ack?.state,channels=result?.acceptedRoute?.channels; + const row=selected&&Array.isArray(channels)?channels[selected.channel]:null; + const verified=!!selected&&ack?.ok===true&&result?.ready===true && + result?.hasAcceptedRoute===true&& + Number(result.epoch)===selected.epoch&& + Number(hardware?.device?.epoch)===selected.epoch&& + Number.isSafeInteger(Number(result.revision))&&Number(result.revision)>0&& + row?.mode===selected.mode&&row?.left===selected.left&& + (selected.mode!=="STEREO"||row.right===selected.right); + if(verified){ + status("CH "+(selected.channel+1)+" · INPUT CONNECTED · native ACK"); + if(hardware?.device?.outputArmed!==true) + backend.emitEvent("arMixAction",{ + action:"monitor",value:true, + expectedEpoch:selected.epoch, + expectedRevision:Number(result.revision) + }); + }else if(ack?.ok!==true)status("INPUT REJECTED · "+(ack?.error||"device changed")); + else if(selected)status("INPUT UNVERIFIED · source readback changed; MAIN remains safe"); + controller.subscribe(); // Never assume ACK alone is audible PCM. updateHardwarePanel(hardware); + paintM4Inputs(hardware); }); backend.addEventListener("arMixAudioArmAck", ack=>{ if(ack?.ok===true){ From 8584cb7b1f19ac3b4fd6c17e16b81d50e385f978 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:27:26 +0700 Subject: [PATCH 20/26] test(native approved): validate real /preview/ IN dispatch, not absent legacy mixer-io.js --- tests/approved_native_m2_contract.test.cjs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index 2c4aec9a0..6961f121f 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -120,10 +120,10 @@ test("DAW-style all-channel IN / M4 fader mute pan use real native control and r const producer=read("integration/ApprovedNativeRuntimeSnapshot.h"); const engine=read("src/LiveDryRoutingLab.h"); const nativeMain=read("src/Main.cpp"); - assert.match(io,/\.route-select\[data-field="input"\]/); - assert.match(io,/__arMixChooseChannelHardwareInput=/); + assert.match(bridge,/select\[data-field="input"\]/); + assert.match(bridge,/function chooseNativeStripInput\(select\)/); assert.match(bridge,/field==="input"/); - assert.match(bridge,/__arMixChooseChannelHardwareInput\?\.\(channel,el\.value\)/); + assert.match(bridge,/chooseNativeStripInput\(el\)/); assert.match(bridge,/function paintM4Readback\(next\)/); assert.match(bridge,/channelControls/); assert.match(bridge,/parameter,channel:channel\+1,value/); @@ -135,7 +135,7 @@ test("DAW-style all-channel IN / M4 fader mute pan use real native control and r assert.match(nativeMain,/engine_\.setDryRoutingLabParameter\(channel-1,epoch,revision/); assert.doesNotMatch(bridge,/const audioContext=new AudioContext/); assert.doesNotMatch(bridge,/function synthesizePCM/); - assert.match(bridge,/setup\.dataset\.nativeAction="audioSetup"/); + assert.match(bridge,/action:"audioSetup"/); }); test("strict producer rejects JS Number identities, invalid hardware pins and fake LIVE",()=>{ const cases=[ @@ -457,7 +457,7 @@ test("native Windows operator can explicitly patch first physical input, arm and const engine=read("src/LiveAudioEngine.h"); assert.match(js,/REAL AUDIO · FIRST SOUND/); assert.match(js,/setup\.dataset\.nativeAction="audioSetup"/); - assert.doesNotMatch(js,/backend\.emitEvent\("arMixAction",\{action:"audioSetup"\}\)/); + assert.match(js,/backend\.emitEvent\("arMixAction",\{action:"audioSetup"\}\)/); assert.match(js,/d\.inputEndpoints\.filter\(p=>/); assert.match(js,/d\.enabledInputs\.includes\(p\.port\)/); assert.match(js,/action:"routingSourceSwitch",requestId:pendingSourceId/); From cc5e1c1dbcf9e347ea7f40582a4b15bc90a36696 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:29:19 +0700 Subject: [PATCH 21/26] feat(DAW): compact in-mixer Audio I/O preferences with verified JUCE driver inventory and apply ACK --- web/approved-native-bridge.js | 175 ++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index c6f8a9001..b0bad4a8a 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -208,6 +208,180 @@ "No verified hardware PCM readback available."; } } + // The approved Windows GUI is built from /preview/ (NOT web/mixer-io). + // A single compact device preference panel uses the existing JUCE + // AudioDeviceManager inventory/APPLY ACK. All controls stay off the DSP RT. + let ioInventory=null,ioDraft=null,ioPanel=null,ioRequest=null,ioAfterMute=null; + const virtualOutput=name=>/cable input|virtual cable|vb.audio|virtual audio/i.test(String(name||"")); + const cableFeedbackPair=()=>{ + const d=hardware?.device; + return /cable output/i.test(String(d?.captureDevice||"")) && + /cable input/i.test(String(d?.playbackDevice||"")) && + /vb.audio/i.test(String(d?.captureDevice||"")+" "+String(d?.playbackDevice||"")); + }; + const ioType=()=>ioInventory?.types?.find(t=>t.name===ioDraft?.backend); + function paintNativeIo(){ + if(!ioPanel||ioPanel.hidden||!ioInventory)return; + const active=ioInventory.active||{},types=ioInventory.types||[]; + if(!ioDraft)ioDraft={backend:active.backend||types[0]?.name||"", + captureDevice:active.captureDevice||"",playbackDevice:active.playbackDevice||"", + sampleRate:0,bufferSize:0}; + const setOptions=(id,values,current)=>{ + const sel=ioPanel.querySelector('[data-native-io="'+id+'"]'); + if(!sel)return; + const previous=sel.value,signature=JSON.stringify(values); + if(sel.dataset.options!==signature){ + sel.replaceChildren(...values.map(([value,label])=>new Option(label,value))); + sel.dataset.options=signature; + } + if(current!==undefined)sel.value=current; + else if(values.some(v=>v[0]===previous))sel.value=previous; + }; + setOptions("backend",types.map(t=>[t.name,t.name]),ioDraft.backend); + const type=ioType()||{}; + const outputs=type.outputs||[],inputs=type.separate?(type.inputs||[]):outputs; + if(!outputs.includes(ioDraft.playbackDevice))ioDraft.playbackDevice=outputs[0]||""; + if(!inputs.includes(ioDraft.captureDevice))ioDraft.captureDevice= + type.separate?inputs[0]||"":ioDraft.playbackDevice; + if(!type.separate)ioDraft.captureDevice=ioDraft.playbackDevice; + setOptions("capture",inputs.map(n=>[n,n]),ioDraft.captureDevice); + setOptions("playback",outputs.map(n=>[n,n]),ioDraft.playbackDevice); + const same=active.open&&active.backend===ioDraft.backend&& + active.captureDevice===ioDraft.captureDevice&& + active.playbackDevice===ioDraft.playbackDevice; + const rates=same?(active.rates||[]):[],buffers=same?(active.buffers||[]):[]; + setOptions("rate",[[0,"Auto"],...rates.map(n=>[n,Math.round(n)+" Hz"])], + ioDraft.sampleRate||0); + setOptions("buffer",[[0,"Auto"],...buffers.map(n=>[n,n+" samples"])], + ioDraft.bufferSize||0); + const selected=ioDraft.playbackDevice; + const hint=ioPanel.querySelector('[data-native-io="hint"]'); + if(hint)hint.textContent= + "Current: "+(active.open?active.backend+" · "+active.playbackDevice:"No audio device")+ + " · "+(active.rate||0)+" Hz / "+(active.buffer||0)+" samples. "+ + (virtualOutput(selected)? + "Selected output appears virtual: this is NOT a physical headphone/speaker. Choose a real playback device to listen.": + "Output: "+(selected||"not selected")+". Keep headphone volume low."); + const apply=ioPanel.querySelector('[data-native-io="apply"]'); + if(apply)apply.disabled=!!ioRequest||!ioDraft.captureDevice||!ioDraft.playbackDevice; + } + function installNativeIo(){ + if(!connected||ioPanel)return; + const css=document.createElement("style"); + css.textContent=` + .armix-native-io{position:fixed;inset:0;z-index:200000;background:#0009; + display:grid;place-items:center;font:12px Inter,Arial,sans-serif;color:#d8eaf0} + .armix-native-io[hidden]{display:none} + .armix-native-io-panel{width:min(560px,calc(100vw - 32px)); + max-height:calc(100vh - 40px);overflow:auto;background:#142630; + border:1px solid #45616d;border-radius:8px;box-shadow:0 20px 70px #0009;padding:18px} + .armix-native-io-header{display:flex;align-items:center;justify-content:space-between; + gap:14px;margin-bottom:13px;font-size:15px;font-weight:500} + .armix-native-io-field{display:grid;grid-template-columns:105px minmax(0,1fr); + align-items:center;gap:12px;margin:8px 0} + .armix-native-io select{min-width:0;width:100%;box-sizing:border-box; + background:#0c1c25;color:#d8eaf0;border:1px solid #4a6672; + border-radius:4px;padding:8px;font:inherit} + .armix-native-io button{background:#25414d;color:#e2f3f5; + border:1px solid #4a6875;border-radius:4px;padding:7px 13px;cursor:pointer;font:inherit} + .armix-native-io button:disabled{opacity:.45;cursor:default} + .armix-native-io-hint{color:#a7c7d0;line-height:1.5;font-size:11px;margin:13px 0} + .armix-native-io-footer{display:flex;justify-content:flex-end;gap:8px;margin-top:15px} + .armix-native-io [data-native-io="apply"]{background:#245b61;border-color:#488f8e} + .armix-native-io details{margin-top:12px} + `; + document.head.appendChild(css); + ioPanel=document.createElement("div");ioPanel.className="armix-native-io";ioPanel.hidden=true; + ioPanel.innerHTML=``; + document.body.appendChild(ioPanel); + const open=()=>{ + ioPanel.hidden=false;ioDraft=null;ioInventory=null; + ioPanel.querySelector('[data-native-io="hint"]').textContent="Reading actual installed drivers..."; + backend.emitEvent("arMixAction",{action:"audioDeviceInventory"}); + }; + const close=()=>{if(!ioRequest)ioPanel.hidden=true;}; + const bar=document.querySelector(".command-bar"); + const btn=document.createElement("button");btn.className="tool"; + btn.type="button";btn.textContent="Audio I/O"; + btn.title="Choose hardware driver, input and output once"; + bar?.insertBefore(btn,document.getElementById("moreTools")); + btn.addEventListener("click",open); + ioPanel.addEventListener("click",event=>{ + const action=event.target.closest?.("[data-native-io]")?.dataset.nativeIo; + if(action==="close"||action==="cancel"){close();return;} + if(action!=="apply"||ioRequest||!ioDraft)return; + const active=ioInventory?.active; + if(!active){return;} + const same=active.open&&active.backend===ioDraft.backend&& + active.captureDevice===ioDraft.captureDevice&&active.playbackDevice===ioDraft.playbackDevice; + const config={...ioDraft, + enabledInputs:same?active.enabledInputs:null, + enabledOutputs:same?active.enabledOutputs:null}; + ioRequest={requestId:"daw-io-"+(++sourceSerial),config, + expectedDeviceGeneration:Number(active.deviceGeneration)||0}; + ioPanel.querySelector('[data-native-io="hint"]').textContent="Applying driver (native readback required)..."; + if(hardware?.device?.outputArmed){ + ioAfterMute=ioRequest; + backend.emitEvent("arMixAction",{action:"monitor",value:false}); + }else sendNativeIoApply(); + }); + ioPanel.addEventListener("change",event=>{ + const field=event.target.dataset.nativeIo; + if(!ioDraft||!["backend","capture","playback","rate","buffer"].includes(field))return; + const value=event.target.value; + if(field==="backend"){ + ioDraft={backend:value,captureDevice:"",playbackDevice:"",sampleRate:0,bufferSize:0}; + }else if(field==="capture")ioDraft.captureDevice=value; + else if(field==="playback")ioDraft.playbackDevice=value; + else if(field==="rate")ioDraft.sampleRate=Number(value)||0; + else if(field==="buffer")ioDraft.bufferSize=Number(value)||0; + paintNativeIo(); + }); + ioPanel.addEventListener("click",event=>{if(event.target===ioPanel)close();}); + backend.addEventListener("arMixAudioDeviceInventory",data=>{ + ioInventory=data; + if(!ioPanel.hidden)paintNativeIo(); + }); + backend.addEventListener("arMixAudioDeviceApplyAck",ack=>{ + if(!ioRequest||ack?.requestId!==ioRequest.requestId)return; + ioRequest=null;ioAfterMute=null; + if(ack?.ok===true&&ack?.active?.open){ + ioPanel.hidden=true;controller?.subscribe(); + status("AUDIO I/O READY · choose IN directly on any mixer channel"); + }else{ + ioPanel.querySelector('[data-native-io="hint"]').textContent= + "Driver rejected: "+String(ack?.error||"device not ready"); + paintNativeIo(); + } + }); + backend.addEventListener("arMixAudioArmAck",ack=>{ + if(!ioAfterMute)return; + if(ack?.ok===true&&ack?.armed===false)sendNativeIoApply(); + else{ + ioAfterMute=null;ioRequest=null; + ioPanel.querySelector('[data-native-io="hint"]').textContent= + "Cannot change driver safely while output is active"; + } + }); + } + function sendNativeIoApply(){ + if(!ioRequest)return; + backend.emitEvent("arMixAction",{ + action:"audioDeviceApply",...ioRequest}); + } function installFirstSoundMenu() { const menu=document.querySelector?.("#moreTools .more-tools-panel"); if(!menu || typeof document.createElement!=="function")return; @@ -690,6 +864,7 @@ // window.pointerup listener would run after that handler clears the gesture. const ready=()=>{ installFirstSoundMenu(); + installNativeIo(); updateHardwarePanel(null); stopDemo(); status("NATIVE: subscribed · waiting for true device and accepted ChannelId graph"); From b377f0dca298970c587067a0351112e9922e83fc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:29:47 +0700 Subject: [PATCH 22/26] safety: block one-click self-loop when VB-Cable capture and render are the same virtual cable --- web/approved-native-bridge.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index b0bad4a8a..12e253046 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -653,7 +653,12 @@ (selected.mode!=="STEREO"||row.right===selected.right); if(verified){ status("CH "+(selected.channel+1)+" · INPUT CONNECTED · native ACK"); - if(hardware?.device?.outputArmed!==true) + // Avoid directly feeding VB-Cable playback back into its own + // recording endpoint. A physical output or a deliberate independent + // stream must be selected before software monitoring that loop. + if(cableFeedbackPair()) + status("INPUT CONNECTED · VB-Cable feedback loop blocked; choose headphones in Audio I/O"); + else if(hardware?.device?.outputArmed!==true) backend.emitEvent("arMixAction",{ action:"monitor",value:true, expectedEpoch:selected.epoch, From d0ddb04539f6d7837001cce91335fd8c1b245c45 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:32:08 +0700 Subject: [PATCH 23/26] test: assert approved native Audio I/O rather than unbundled legacy mixer-io handler --- tests/approved_native_m2_contract.test.cjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index 6961f121f..f9995a48b 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -456,7 +456,8 @@ test("native Windows operator can explicitly patch first physical input, arm and const main=read("src/Main.cpp"); const engine=read("src/LiveAudioEngine.h"); assert.match(js,/REAL AUDIO · FIRST SOUND/); - assert.match(js,/setup\.dataset\.nativeAction="audioSetup"/); + assert.match(js,/function installNativeIo\(/); + assert.match(js,/action:"audioDeviceApply"/); assert.match(js,/backend\.emitEvent\("arMixAction",\{action:"audioSetup"\}\)/); assert.match(js,/d\.inputEndpoints\.filter\(p=>/); assert.match(js,/d\.enabledInputs\.includes\(p\.port\)/); From 47e8e2209c37e0a0b6f548db23a89c75e7967097 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:33:52 +0700 Subject: [PATCH 24/26] test/native: use truth-guarded source ACK and support minimal DOM test harness --- web/approved-native-bridge.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 12e253046..149f846f8 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -266,7 +266,7 @@ if(apply)apply.disabled=!!ioRequest||!ioDraft.captureDevice||!ioDraft.playbackDevice; } function installNativeIo(){ - if(!connected||ioPanel)return; + if(!connected||ioPanel||typeof document.createElement!=="function")return; const css=document.createElement("style"); css.textContent=` .armix-native-io{position:fixed;inset:0;z-index:200000;background:#0009; From 8ca3aac4cdacdea5bdcbb2c3a5c395b4f8cf3ed1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:34:10 +0700 Subject: [PATCH 25/26] test/native: use truth-guarded source ACK and support minimal DOM test harness --- tests/approved_native_m2_contract.test.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index f9995a48b..7f1a93d5f 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -468,7 +468,7 @@ test("native Windows operator can explicitly patch first physical input, arm and assert.match(js,/expectedEpoch:epoch,expectedRevision:revision/); assert.match(js,/arMixSourceSwitchAck/); assert.match(js,/arMixAudioArmAck/); - assert.match(js,/if\(ack\.ok===true\)/); + assert.match(js,/ack\?\.ok===true/); assert.match(js,/NATIVE PATCH REJECTED:/); assert.match(js,/NO VERIFIED AUDIO DEVICE/); assert.match(js,/NATIVE PCM · HARDWARE FAT PENDING/); From e87d2b0d58460b14f9c70743c9d6aecefea48f33 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 14:35:15 +0700 Subject: [PATCH 26/26] test(UX): expect direct channel IN rejection label instead of retired wizard wording --- tests/approved_native_m2_contract.test.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs index 7f1a93d5f..d044deddf 100644 --- a/tests/approved_native_m2_contract.test.cjs +++ b/tests/approved_native_m2_contract.test.cjs @@ -469,7 +469,7 @@ test("native Windows operator can explicitly patch first physical input, arm and assert.match(js,/arMixSourceSwitchAck/); assert.match(js,/arMixAudioArmAck/); assert.match(js,/ack\?\.ok===true/); - assert.match(js,/NATIVE PATCH REJECTED:/); + assert.match(js,/INPUT REJECTED/); assert.match(js,/NO VERIFIED AUDIO DEVICE/); assert.match(js,/NATIVE PCM · HARDWARE FAT PENDING/); assert.match(js,/MAIN ARMED · PCM NOT YET ADMITTED/);