diff --git a/AR-MIX-Live-FX-Host-Standalone-v0.3.html b/AR-MIX-Live-FX-Host-Standalone-v0.3.html
index be538ea4c..d9ac8f31f 100644
--- a/AR-MIX-Live-FX-Host-Standalone-v0.3.html
+++ b/AR-MIX-Live-FX-Host-Standalone-v0.3.html
@@ -3370,7 +3370,7 @@
let mode='FX', lastStatus={}, deviceInventory=null, ioTab='device', lastSignature='', focusedInput=2;
let monitorSendsExpanded=false;
// DEVICE1: staged selections are UI-only; only positive native ACK changes active hardware.
- let deviceDraft=null,deviceBusy=false,deviceNote='',deviceRequest='',deviceRequestSeq=0,lastDeviceRefresh=0,lastDeviceRescan=0;
+ let deviceDraft=null,deviceBusy=false,deviceNote='',deviceRequest='',deviceRequestSeq=0,lastDeviceRefresh=0,lastDeviceRescan=0,applyMutePending=false,applyAfterDevice=null,applyBaseEpoch=0;
let deviceMatrixView='inputs',deviceMatrixWaitEpoch=null; // Never display old hardware pins after an APPLY ACK.
// Pending SOURCE ACK is a UI projection only; monitor.js owns the native route.
let quickSourcePending=null;
@@ -3817,7 +3817,7 @@
overlay.innerHTML='
ArSonMiX · AUDIO HARDWARE
Audio Setup · Windows Devices & Routing
';
document.body.appendChild(overlay);
const audioPath=node('div','arIOAudioPath');audioPath.id='arIOAudioPath';
- audioPath.innerHTML='RAW INPUT · WAITROUTE · WAITMIXER · WAITOUTPUT · WAIT';
+ audioPath.innerHTML='CAPTURE · WAITROUTE · WAITMIXER · WAITOUTPUT · WAIT';
overlay.querySelector('.arIOWindow').insertBefore(audioPath,el('arIOBody'));
// Native first-sound capture truth: callback-order peaks are mapped to
// actual driver pin names ONLY if the hardware inventory belongs to the
@@ -3861,18 +3861,6 @@
const n=audioPath.querySelector('[data-audio-path-'+key+']');
if(n&&n.textContent!==value)n.textContent=value;
}
- // Same native START/ACK action as DEVICE/DRIVER. No duplicate host path,
- // automatic unmute, optimistic status or periodic full DOM rebuild.
- const start=audioPath.querySelector('[data-io-start-audio]');
- if(start){
- const pending=!!window.__arMixFastAudioState?.().pending;
- const label=lastStatus.monitor?'MUTE OUTPUT':pending?'STARTING…':'START AUDIO';
- if(start.textContent!==label)start.textContent=label;
- start.disabled=startAudioBlocked();
- start.setAttribute('aria-label',lastStatus.monitor?
- 'Mute hardware output immediately':
- 'Arm verified physical MAIN only after native route ACK');
- }
}
// G3: ONE floating inspector follows the selected source/AUX, no new
// DSP graph, no heavyweight matrix, no layout shifts in the MIX strips.
@@ -4221,7 +4209,7 @@
(s.ready?'E'+s.epoch+' / R'+(s.revision||0)+' · '+portList(s).length+' IN · '+(s.outputPorts?.length||0)+' OUT · '+(s.monitor?'OUTPUT ARMED':'OUTPUT MUTED'):'NO VERIFIED DEVICE · OUTPUT MUTED'):
'WEB PREVIEW · NO LIVE AUDIO';
if(info.textContent!==caption)info.textContent=caption;
- toolbar.querySelector('[data-mix-apply]').disabled=!isNative()||!s.ready||!!s.pending||!!s.monitor||(!overlay.hidden&&matrixDraft.size>0);
+ toolbar.querySelector('[data-mix-apply]').disabled=!isNative()||!s.ready||!!s.pending||(!overlay.hidden&&matrixDraft.size>0);
for(const strip of mixer.querySelectorAll('.strip[data-strip]'))refreshStrip(strip,s);
if(!overlay.hidden)refreshIO();
if(!sendEditor.hidden)drawSendEditor();
@@ -4568,16 +4556,6 @@
(deviceSameEndpoint(d)&&
(!pinsEqual(d.enabledInputs,a.enabledInputs)||!pinsEqual(d.enabledOutputs,a.enabledOutputs))));
}
- // Shared safety gate for BOTH visible START AUDIO buttons. The top
- // transport cannot bypass a staged device change, invalid hardware,
- // pending route/FX transaction or the existing native ACK handshake.
- function startAudioBlocked(){
- if(!isNative())return true;
- if(lastStatus.monitor)return false; // emergency physical MUTE always allowed
- const quick=window.__arMixFastAudioState?.()||{};
- return deviceBusy||!!quick.pending||!deviceInventory?.active?.open||
- !deviceSameEndpoint(deviceDraft)||deviceDirty()||!hardwareReady(route());
- }
function deviceRefresh(rescan=false){
if(!isNative()||deviceBusy)return;
const now=Date.now();
@@ -4601,7 +4579,7 @@
if(deviceBusy)return 'DEVICE SWITCH IN PROGRESS · wait for native readback';
if(!deviceDraft||!deviceInventory?.active)return 'REFRESH DEVICE INVENTORY';
if(lastStatus.secondaryOutputArmed)return 'STEP 1 · DISARM SECONDARY STREAM in SIGNAL CHECK before changing driver';
- if(s?.monitor||lastStatus.monitor)return 'STEP 1 · PRESS MUTE OUTPUT above before APPLY DEVICE';
+ // APPLY performs native MUTE first if the output is armed.
if(s?.pending)return 'WAIT · finish native routing APPLY/ACK before changing driver';
if(!deviceDraft.backend||!deviceDraft.captureDevice||!deviceDraft.playbackDevice)
return 'SELECT A VALID DUPLEX AUDIO INTERFACE';
@@ -4612,15 +4590,30 @@
if(!a.open||a.authorized===false)return 'SELECT ASIO/WINDOWS AUDIO, then APPLY DEVICE';
const maono=/maono/i.test(String(a.captureDevice||'')+' '+String(a.playbackDevice||''));
return /ASIO/i.test(a.backend||'')&&maono?
- 'ASIO OPEN · expand HARDWARE PIN ENABLE, select the actual Maono MIC or VC In 3+4 ports, then APPLY DEVICE again. Next select CH input sources, APPLY PATCH and START AUDIO.':
- 'DEVICE OPEN · verify enabled INPUT/OUTPUT pins, choose CH input sources, APPLY PATCH and START AUDIO.';
+ 'ASIO OPEN · expand HARDWARE PIN ENABLE, select the actual Maono MIC or VC In 3+4 ports, then APPLY DEVICE again. Next select CH input sources, APPLY.':
+ 'DEVICE OPEN · verify enabled INPUT/OUTPUT pins, choose CH input sources, APPLY.';
};
function deviceApply(){
if(!isNative()||deviceBusy||!deviceDraft||!deviceInventory?.active)return;
const d=deviceDraft,a=deviceInventory.active;
const blocked=deviceSwitchBlocker(route());
if(blocked){deviceNote=blocked;lastSignature='';refreshIO();return;}
- if(!deviceDirty())return;
+ if(!deviceDirty()){
+ const result=window.__arMixApplyAndActivate?.();
+ deviceNote=result?.ok?'APPLY ACCEPTED · NATIVE ACK PENDING':'APPLY REJECTED · '+(result?.error||'Route not ready');
+ lastSignature='';refreshIO();return;
+ }
+ if(lastStatus.monitor){
+ applyMutePending=true;
+ backend.emitEvent('arMixAction',{action:'monitor',value:false});
+ deviceNote='APPLY · WAITING FOR HARDWARE MUTE ACK';return;
+ }
+ sendDeviceRequest();
+ }
+ function sendDeviceRequest(){
+ if(!deviceDirty()||deviceBusy)return;
+ const d=deviceDraft,a=deviceInventory.active;
+ applyBaseEpoch=Number(route().epoch)||0;
// Changing hardware is a structural transaction, not a fader parameter.
deviceRequest='device-'+Date.now()+'-'+(++deviceRequestSeq);
deviceBusy=true;deviceNote='APPLYING · OUTPUT MUTED · waiting for native readback';
@@ -4671,19 +4664,21 @@
// stages the real native route then independently ARM-ACKs hardware.
const quick=window.__arMixFastAudioState?.()||{};
const start=node('button','btn-180 arIODeviceStartAudio',
- lastStatus.monitor?'MUTE OUTPUT':quick.pending?'STARTING…':'START AUDIO');
- start.type='button';start.dataset.ioStartAudio='1';
- start.disabled=startAudioBlocked();
+ 'MUTE OUTPUT');
+ start.type='button';start.dataset.ioStartAudio='1';start.hidden=!lastStatus.monitor;
+ start.disabled=!isNative()||(!lastStatus.monitor&&(
+ deviceBusy||!!quick.pending||!a.open||!deviceSameEndpoint(deviceDraft)||
+ deviceDirty()||!hardwareReady(route())));
start.setAttribute('aria-label',lastStatus.monitor?'Mute physical output':
'Start verified live routing and arm hardware output');
- activeLine.appendChild(start);
+ if(lastStatus.monitor)activeLine.appendChild(start);
const accepted=route().acceptedRoute?.channels||[];
const used=accepted.map((r,i)=>r.mode==='MONO'||r.mode==='STEREO'?
'CH'+String(i+1).padStart(2,'0'):null).filter(Boolean);
const firstSound=node('div','arIODeviceFirstSound',quick.message||(
lastStatus.monitor?'OUTPUT ARMED · '+used.join(' + ')+' → MAIN → HARDWARE':
- used.length?used.join(' + ')+' → MAIN ready · START AUDIO to hear sound':
- 'FIRST SOUND · START AUDIO maps CH01/CH02 to verified input pins, applies once, then arms MAIN'));
+ used.length?used.join(' + ')+' → MAIN ready · APPLY to hear sound':
+ 'FIRST SOUND · APPLY maps verified input pins, routes and arms MAIN'));
panel.appendChild(firstSound);
// Lightweight text-only 12 Hz live native meter. It remains truthful
// when OUTPUT MUTED and when no mixer patch has been created yet.
@@ -4692,6 +4687,7 @@
captureRow.setAttribute('aria-label','Verified raw input PCM before mixer routing');
panel.appendChild(captureRow);
+
if(!types.length&&!a.open)
panel.appendChild(node('p','arIODeviceEmpty',
'No reported Windows audio devices. Refresh driver list while all outputs are MUTED.'));
@@ -4828,7 +4824,7 @@
}else matrixSection.appendChild(makeMatrix(s,deviceMatrixView));
matrixSection.appendChild(node('p','arIODeviceMatrixNote',
deviceMatrixView==='inputs'?
- 'Named inputs are reusable SOURCES. START AUDIO builds a verified initial route; only native ACK confirms sound routing.':
+ 'Named inputs are reusable SOURCES. APPLY builds a verified initial route; only native ACK confirms sound routing.':
'MAIN / MONITOR outputs use muted APPLY PATCH and native ACK.'));
}
body.appendChild(matrixSection);
@@ -4846,17 +4842,18 @@
});
overlay.dataset.activeTab=ioTab;
const matrixInDevice=ioTab==='device'&&deviceSameEndpoint(deviceDraft)&&hardwareReady(s);
- overlay.querySelector('[data-mix-apply]').hidden=ioTab==='device'&&!matrixInDevice;
+ overlay.querySelector('[data-mix-apply]').hidden=ioTab==='device';
overlay.querySelector('[data-io-revert]').hidden=ioTab==='device'&&!matrixInDevice;
overlay.querySelector('[data-io-internal]').hidden=ioTab==='device';
overlay.querySelector('[data-io-device-apply]').hidden=ioTab!=='device';
overlay.querySelector('[data-io-device-revert]').hidden=ioTab!=='device';
const deviceBlocker=deviceSwitchBlocker(s);
- overlay.querySelector('[data-io-device-apply]').disabled=!deviceDirty()||!!deviceBlocker;
+ overlay.querySelector('[data-io-device-apply]').disabled=!!deviceBlocker||deviceBusy||applyMutePending||deviceMatrixWaitEpoch!==null||!!window.__arMixFastAudioState?.().pending||(!deviceDirty()&&(!hardwareReady(s)||!!lastStatus.monitor));
+ overlay.querySelector('[data-io-device-apply]').textContent=deviceBusy||applyMutePending?'APPLYING…':'APPLY';
overlay.querySelector('[data-io-device-apply]').title=deviceBlocker||
(deviceDirty()?'Commit selected device then verify physical pin readback':'No pending device edit');
overlay.querySelector('[data-io-device-revert]').disabled=deviceBusy||!deviceDirty();
- overlay.querySelector('[data-mix-apply]').disabled=!hardwareReady(s)||!!matrixDraft.size||s.monitor||
+ overlay.querySelector('[data-mix-apply]').disabled=!hardwareReady(s)||!!matrixDraft.size||
(ioTab==='device'&&deviceDirty());
overlay.querySelector('[data-io-revert]').disabled=!isNative()||s.pending;
const signature=ioTab+'|'+JSON.stringify([s.epoch,s.revision,s.pending,s.draftRoutes,
@@ -5095,7 +5092,7 @@
}
if(b.dataset.sendRevert!==undefined){e.preventDefault();sendMutation(()=>window.__arMixRevertMixerDraft?.());return;}
if(b.dataset.sendApply!==undefined){
- e.preventDefault();const result=window.__arMixApplyMixerDraft?.();
+ e.preventDefault();const result=window.__arMixApplyAndActivate?.();
sendFeedback=result?.ok?'SUBMITTED · WAIT FOR NATIVE ACK':result?.error||'APPLY failed';
drawSendEditor();return;
}
@@ -5108,8 +5105,8 @@
if(b.dataset.ioStartAudio!==undefined){
e.preventDefault();e.stopImmediatePropagation();
const result=window.__arMixStartLiveAudio?.();
- deviceNote=result?.ok?'START AUDIO requested · native ACK required':
- 'START REJECTED · '+(result?.error||'Native device not ready');
+ deviceNote=result?.ok?'APPLY requested · native ACK required':
+ 'APPLY REJECTED · '+(result?.error||'Native device not ready');
lastSignature='';refreshIO();return;
}
if(b.dataset.ioSoftwareAdd){
@@ -5220,7 +5217,7 @@
else window.__arMixOpenChannelPatch?.(channel,b.dataset.mixPatch);
return;
}
- if(b.dataset.mixApply!==undefined){e.preventDefault();e.stopImmediatePropagation();const response=window.__arMixApplyMixerDraft?.();if(response&&!response.ok)el('arIOFeedback').textContent=response.error;refresh();return;}
+ if(b.dataset.mixApply!==undefined){e.preventDefault();e.stopImmediatePropagation();const response=window.__arMixApplyAndActivate?.();if(response&&!response.ok)el('arIOFeedback').textContent=response.error;refresh();return;}
},true);
document.addEventListener('input',e=>{
if(e.target.matches('.arIOSoftwareNameEdit')&&softwareEdit)
@@ -5293,6 +5290,11 @@
focusFlow.hidden=mixer.classList.contains('hidden');
backend?.addEventListener?.('arMixStatus',d=>{
lastStatus=d;
+ if(applyAfterDevice && Number(d?.deviceGeneration)===applyAfterDevice.generation && d?.driver===applyAfterDevice.driver && d?.inputDevice===applyAfterDevice.capture && d?.outputDevice===applyAfterDevice.playback && Number(d?.dryRoutingLab?.epoch)>0 && d?.dryRoutingLab?.ready && d?.dryRoutingLab?.active){
+ applyAfterDevice=null;
+ const result=window.__arMixApplyAndActivate?.();
+ deviceNote=result?.ok?'APPLY · NATIVE ROUTE/ARM ACK PENDING':'APPLY REJECTED · '+(result?.error||'Source not ready');
+ }
// 12Hz native telemetry: update only when topology, epoch or safety changes.
const s=d.dryRoutingLab||{},key=JSON.stringify([s.epoch,s.revision,s.ready,s.ports,s.outputPorts,s.acceptedRoute,d.monitor,d.masterMute]);
if(window.__armixIoStatusKey!==key){window.__armixIoStatusKey=key;lastSignature='';refresh();}
@@ -5316,6 +5318,7 @@
// CACHED is a non-disruptive snapshot; do not erase pending operator notes.
lastSignature='';if(!overlay.hidden)refreshIO();
});
+ backend?.addEventListener?.('arMixAudioArmAck',ack=>{ if(applyMutePending){ applyMutePending=false; if(ack?.ok&&!ack.armed){lastStatus.monitor=false;sendDeviceRequest();}else deviceNote='APPLY MUTE REJECTED'; } });
backend?.addEventListener?.('arMixAudioDeviceApplyAck',ack=>{
if(!deviceBusy||ack?.requestId!==deviceRequest)return;
deviceBusy=false;deviceRequest='';
@@ -5326,6 +5329,7 @@
if(ack?.active?.open&&Number(ack.active.deviceGeneration)!==oldGeneration)
deviceMatrixWaitEpoch=route().epoch;
deviceDraft=makeDeviceDraft();
+ if(ack?.ok&&ack?.active?.open)applyAfterDevice={generation:Number(ack.active.deviceGeneration),capture:ack.active.captureDevice,playback:ack.active.playbackDevice,driver:ack.active.backend};
deviceNote=ack?.ok?'DEVICE ACCEPTED · OUTPUT MUTED · '+devicePinNextStep():
(ack?.state||'REJECTED')+' · '+(ack?.error||'Check driver and retry');
// Same real routing controller sees the new device epoch via normal status.
@@ -5366,7 +5370,7 @@
});
window.addEventListener('arMixRoutingDraftChanged',()=>{lastSignature='';refresh();});
window.addEventListener('arMixFastAudioResult',event=>{
- deviceNote=event.detail?.message||'START AUDIO';
+ deviceNote=event.detail?.message||'APPLY';
lastSignature='';if(!overlay.hidden)refreshIO();
});
window.addEventListener('arMixAuxMasterGainResult',event=>{
diff --git a/docs/FAST2_ONE_APPLY_NATIVE_AUDIO_20261031.md b/docs/FAST2_ONE_APPLY_NATIVE_AUDIO_20261031.md
new file mode 100644
index 000000000..d512b9ac3
--- /dev/null
+++ b/docs/FAST2_ONE_APPLY_NATIVE_AUDIO_20261031.md
@@ -0,0 +1,11 @@
+# FAST2 — one APPLY to live native audio (2026-10-31)
+
+Operator flow: **AUDIO I/O → ASIO/Windows Audio → actual capture + playback → verified pins → APPLY**. The separate START AUDIO control is removed. APPLY is a single explicit operator consent covering the already-existing native device transaction, native MUTE (if previous MAIN was armed), new hardware generation/route epoch verification, routing ACK, and native MAIN ARM ACK. No hidden auto-start on process boot, Show recall, device loss, or driver fallback. Emergency MUTE remains immediately available in SIGNAL CHECK and in the device header when armed.
+
+When only routing changed, APPLY performs native MUTE ACK (if needed), routing ACK, then guarded ARM ACK; never deploys a second DSP callback, WebAudio engine, or unverified physical pins. Native failures leave hardware safe-muted. New per-pin raw PCM diagnostics from merged #256 are preserved in both modular WebView and standalone.
+
+**P0 hardware evidence, supplied by operator 23:33 WIB**: VB-Cable CABLE Output 48k input → MAONO HP Out 48k WASAPI render, MAONO shared mix format reported 44.1k. 11,744 callbacks, zero VST3, worst DSP 289us/10ms, 0 late starts/over-budget, 23 WASAPI capture discontinuity flags, 22 candidate zero-head blocks (8,448 frames). Five-second glitch windows show 2–5 capture flags. This implicates capture continuity/dual endpoint clocks for A/B testing but does NOT prove render hardware underruns or that zero-head frames were lost samples.
+
+**FAT**: use real MAONO DIRECT ASIO vs CABLE Output → MAONO WASAPI 0FX at matched supported sample rate/buffer; test output-only tone; MARK CRACKLE and compare counters. A first-sound software test is not a clean 30-minute hardware pass. Do not auto-enable experimental #251 de-click (heuristic zero-head also occurs in legitimate silence).
+
+Studio Pro I/O reference: https://fenderstudiopromanual.fender.com/en/Content/Setup_Topics/Audio_Device_Input_Output.htm.
diff --git a/tests/mixer_io_operator_contract_test.mjs b/tests/mixer_io_operator_contract_test.mjs
index 3a17a3611..b21e1c4e8 100644
--- a/tests/mixer_io_operator_contract_test.mjs
+++ b/tests/mixer_io_operator_contract_test.mjs
@@ -7,7 +7,7 @@ const gui=read('web/mixer-io.js'),monitor=read('web/monitor.js');
const main=read('src/Main.cpp'),cmake=read('CMakeLists.txt'),html=read('web/index.html');
test('single native controller stages MONO/STEREO through muted APPLY + revision ACK',()=>{
assert.match(gui,/__arMixStageChannelInput/);
- assert.match(gui,/__arMixApplyMixerDraft/);
+ assert.match(gui,/__arMixApplyAndActivate/);
assert.match(monitor,/patchPreflight\(\)/);
assert.match(monitor,/window\.__arMixApplyMixerDraft/);
assert.match(monitor,/routingDryApply/);
@@ -279,7 +279,7 @@ test('P0 FIRST SOUND raw capture has per-pin native callback truth BEFORE route
assert.equal(html.slice(html.indexOf(cssTag)+cssTag.length,html.indexOf('',html.indexOf(cssTag))),
css,'WebView + standalone exact raw PCM style parity');
});
-test('P0 MAONO: staged ASIO switch never advertises live audio and cannot APPLY while output armed',()=>{
+test('P0 MAONO: one APPLY MUTE-ACKs before switching and native ARM',()=>{
const js=read('web/mixer-io.js');
const main=read('src/Main.cpp');
const engine=read('src/LiveAudioEngine.h');
@@ -288,14 +288,14 @@ test('P0 MAONO: staged ASIO switch never advertises live audio and cannot APPLY
assert.ok(start>0&&end>start,'device safety decision must be shared by render and action');
const guard=js.slice(start,end);
assert.match(guard,/lastStatus\.secondaryOutputArmed/);
- assert.match(guard,/s\?\.monitor\|\|lastStatus\.monitor/);
- assert.match(guard,/PRESS MUTE OUTPUT above before APPLY DEVICE/);
+ assert.match(js,/applyMutePending=true/);
+ assert.match(js,/action:'monitor',value:false/);
assert.match(guard,/s\?\.pending/);
assert.match(guard,/Maono MIC or VC In 3\+4/);
assert.match(js,/ASIO DEVICE SELECTED · NOT ACTIVE · current engine still uses/);
assert.match(js,/const blocked=deviceSwitchBlocker\(route\(\)\)/);
assert.match(js,/const deviceBlocker=deviceSwitchBlocker\(s\)/);
- assert.match(js,/disabled=!deviceDirty\(\)\|\|!!deviceBlocker/);
+ assert.match(js,/disabled=!!deviceBlocker\|\|deviceBusy\|\|applyMutePending/);
assert.match(js,/deviceNote=ack\?\.ok\?'DEVICE ACCEPTED · OUTPUT MUTED · '\+devicePinNextStep\(\)/);
assert.match(main,/!engine_\.allOutputsDisarmed\(\)/);
assert.match(main,/opened->getActiveInputChannels\(\)!=actual\.inputChannels/);
@@ -449,16 +449,16 @@ test('DEVICE4 Studio matrix names map actual JUCE pins, reuse SOURCE2/native ACK
});
-test('FAST1 one gesture uses native routing ACK then fenced physical ARM, with permanent panic MUTE',()=>{
+test('FAST2 one APPLY uses native ACK and emergency MUTE',()=>{
const io=read('web/mixer-io.js'),control=read('web/monitor.js');
const native=read('src/Main.cpp'),engine=read('src/LiveAudioEngine.h');
const html=read('AR-MIX-Live-FX-Host-Standalone-v0.3.html');
- assert.match(io,/START AUDIO/);
+ assert.doesNotMatch(io,/data-io-start-audio disabled/);
assert.match(io,/dataset\.ioStartAudio/);
assert.match(io,/LIVE ON /);
assert.match(io,/ASSIGN CH/);
- assert.match(io,/function startAudioBlocked\(\)/);
- assert.match(io,/start\.disabled=startAudioBlocked\(\)/);
+ assert.match(io,/applyMutePending/);
+ assert.match(io,/function sendDeviceRequest\(\)/);
assert.match(control,/window\.__arMixStartLiveAudio=/);
assert.match(control,/fastAudioPending=\{phase:"patch"/);
assert.match(control,/if\(verified\)fastAudioArm\(result\)/);
@@ -494,30 +494,25 @@ test('P0 actual raw PCM before MUTE and native route/output state remain indepen
});
-test('P0 First Sound separates RAW capture, post-fader PCM and physical output ARM',()=>{
- const css=read('web/mixer-io.css');
- const engine=read('src/LiveAudioEngine.h');
+test('FAST2 APPLY is the single operator action; native MUTE/route/ARM ACKs remain separate',()=>{
+ const io=read('web/mixer-io.js'),m=read('web/monitor.js');
+ const html=read('AR-MIX-Live-FX-Host-Standalone-v0.3.html');
+ const native=read('src/Main.cpp');
const core=read('engine/core/PreparedMixerBlock.h');
- const main=read('src/Main.cpp');
- assert.match(gui,/data-audio-path-mixer/);
- assert.match(gui,/data-io-start-audio disabled/);
- assert.match(gui,/function startAudioBlocked\(\)/);
- assert.match(gui,/start\.disabled=startAudioBlocked\(\)/);
- assert.match(gui,/start\.disabled=startAudioBlocked\(\)/);
- assert.match(gui,/window\.__arMixStartLiveAudio\?\.\(\)/);
- assert.match(monitor,/window\.__arMixStartLiveAudio=/);
- assert.match(monitor,/action:"monitor",value:true/);
- assert.match(monitor,/expectedEpoch:Number\(d\.epoch\),expectedRevision:Number\(d\.revision\)/);
- assert.match(main,/engine_\.liveOutputArmFault\(\)/);
- assert.match(monitor,/const mixed=patched\.some\(i=>Number\(meter\[i\]\)>0\.0002\)/);
- assert.match(monitor,/const mainPcm=Number\(d\.peak\)>0\.0002/);
- assert.match(monitor,/ArSonMix physical MAIN is SAFE-MUTED/);
- assert.match(monitor,/if sound persists|sound must stop|If sound persists/i);
- assert.match(engine,/const bool outputPermitted=outputGate\.renderMain/);
- assert.match(engine,/if\(!outputGate\.hardware\)/);
- assert.match(core,/observed->channelPeak\[strip\]=peak/);
assert.match(core,/observed->channelPeakL\[strip\]=peakL/);
assert.match(core,/observed->channelPeakR\[strip\]=peakR/);
- assert.match(css,/\.arIOAudioPath>\.arIOPathStart/);
- assert.doesNotMatch(gui,/new AudioContext|AudioWorklet|processBlock|createPluginInstance/);
+ assert.match(io,/capturePinSummary/);
+ assert.match(io,/applyMutePending/);
+ assert.match(io,/applyAfterDevice/);
+ assert.match(io,/deviceApply\(\)/);
+ assert.match(io,/function sendDeviceRequest\(\)/);
+ assert.match(io,/if\(lastStatus.monitor\)activeLine.appendChild\(start\)/);
+ assert.match(io,/window.__arMixApplyAndActivate\?\.\(\)/);
+ assert.match(m,/window.__arMixApplyAndActivate=/);
+ assert.match(m,/phase:"mute-custom"/);
+ assert.match(m,/phase:"custom-patch"/);
+ assert.match(m,/if\(verified\)fastAudioArm\(result\)/);
+ assert.match(m,/expectedEpoch:Number\(d.epoch\)/);
+ assert.match(native,/arMixAudioArmAck/);
+ assert.ok(html.includes(io),'WebView and standalone must share exact FAST2 UI');
});
diff --git a/tests/mixer_io_smoke.py b/tests/mixer_io_smoke.py
index 6a776047e..02f23942b 100644
--- a/tests/mixer_io_smoke.py
+++ b/tests/mixer_io_smoke.py
@@ -108,10 +108,8 @@ async def main():
assert await page.locator('#arIOAudioPath').is_visible()
assert await page.locator('#arIOAudioPath [data-io-signal-check]').is_visible()
assert await page.locator('#arIOAudioPath [data-audio-path-mixer]').is_visible()
- assert await page.locator('#arIOAudioPath [data-io-start-audio]').is_visible()
- # The test has no authorized device inventory. Top-level START must
- # remain disabled and cannot synthesize a hardware ARM.
- assert await page.locator('#arIOAudioPath [data-io-start-audio]').is_disabled()
+ # FAST2: one APPLY only. No second START AUDIO button is rendered.
+ assert await page.locator('#arIOAudioPath [data-io-start-audio]').count()==0
await page.locator('#arIOAudioPath [data-io-signal-check]').click()
assert await page.locator('#arSignalOverlay').evaluate("(e)=>e.classList.contains('open')")
await page.locator('#arSignalClose').click()
@@ -247,10 +245,10 @@ async def main():
assert await page.locator('.arIODeviceDriverButton[aria-pressed="true"]').inner_text()=='ASIO'
assert await page.locator('.arIODevicePatchMatrix').is_visible()
assert await page.locator('.arIODevicePatchMatrix .arIOMatrixCell').count()>0
- # FAST1: one gesture un-mutes a previously ACKed real input route;
+ # FAST2: a single APPLY arms previously ACKed real input routing;
# hardware action is still fenced to epoch/revision.
- assert await page.locator('#arIOAudioPath [data-io-start-audio]').is_visible()
- await page.locator('#arIOAudioPath [data-io-start-audio]').click()
+ assert await page.locator('#arIOAudioPath [data-io-start-audio]').count()==0
+ await page.locator('[data-io-device-apply]').click()
arm=await page.evaluate("""()=>window.__armixTestActions.filter(x=>
x.name==='arMixAction'&&x.data.action==='monitor'&&x.data.value===true)""")
assert len(arm)==1,arm
@@ -260,8 +258,8 @@ async def main():
ok:true,armed:true,deviceEpoch:4,error:''})""")
await page.evaluate("""status=>{status.monitor=true;
window.__armixTestEmit('arMixStatus',status)}""",status)
- assert await page.locator('#arIOAudioPath [data-io-start-audio]').inner_text()=='MUTE OUTPUT'
- await page.locator('#arIOAudioPath [data-io-start-audio]').click()
+ assert await page.locator('[data-io-start-audio]').inner_text()=='MUTE OUTPUT'
+ await page.locator('[data-io-start-audio]').click()
muted=await page.evaluate("""()=>window.__armixTestActions.filter(x=>
x.name==='arMixAction'&&x.data.action==='monitor'&&x.data.value===false)""")
assert len(muted)==1,muted
@@ -282,7 +280,8 @@ async def main():
assert await page.locator('.arIODevicePin').count()==8
assert await page.locator('.arIODeviceCapture').is_disabled()
assert await page.locator('.arIODeviceRate').input_value()=='48000'
- assert await page.locator('[data-io-device-apply]').is_disabled()
+ # FAST2: APPLY remains enabled on an accepted device to ARM real MAIN.
+ assert await page.locator('[data-io-device-apply]').is_enabled()
# Staging sample rate may not reopen any hardware automatically.
await page.locator('.arIODeviceBuffer').select_option('256')
assert await page.locator('[data-io-device-apply]').is_enabled()
@@ -723,6 +722,15 @@ async def main():
{ok:true,instanceId:'g5c-101'})""")
assert await page.evaluate("""()=>window.__armixTestActions.filter(x=>
x.name==='arMixAction'&&x.data.action==='routingFxEditor').length""")==before_editor+1
+ # The synthetic driver must ACK/REJECT any pending FAST2 hardware
+ # ARM before another structural route APPLY. Real native hosts send
+ # this event; the smoke fixture does not unless we explicitly emit it.
+ await page.evaluate("""()=>{
+ if(window.__arMixFastAudioState?.().pending)
+ window.__armixTestEmit('arMixAudioArmAck',{
+ ok:false,armed:false,deviceEpoch:4,error:'synthetic ARM rejection'});
+ }""")
+ assert not await page.evaluate("()=>window.__arMixFastAudioState?.().pending")
# MS3A: changing MAIN physical destination is one native APPLY,
# not a UI preview and never silently unmutes audio.
await page.evaluate("""status=>{
@@ -750,7 +758,13 @@ async def main():
await page.locator('#arIOOverlay [data-mix-apply]').click()
command=await page.evaluate("""()=>window.__armixTestActions.filter(x=>
x.name==='arMixAction'&&x.data.action==='routingDryApply').at(-1).data.value""")
- assert command['mainOutputs']==[4,5],command
+ debug=await page.evaluate("""()=>({
+ fast:window.__arMixFastAudioState?.(),
+ route:window.__arMixRouteView?.(),
+ feedback:document.querySelector('#arIOFeedback')?.textContent,
+ events:window.__armixTestActions.filter(x=>x.name==='arMixAction').slice(-6)
+ })""")
+ assert command['mainOutputs']==[4,5],(command,debug)
assert command['monitorOutputs']==[0,1],command
assert len(command['monitorSends'])==14 and command['monitorSends'][0]==.5,command
assert all(x==0 for x in command['monitorSends'][1:]),command
@@ -1019,7 +1033,7 @@ async def main():
types:[{name:'ASIO',active:true,separate:false,
inputs:['Mock Interface'],outputs:['Mock Interface']}]
})""")
- await qp.locator('#arIOAudioPath [data-io-start-audio]').click()
+ await qp.locator('[data-io-device-apply]').click()
requests=await qp.evaluate("""()=>window.__armixTestActions.filter(x=>
x.data?.action==='routingDryApply')""")
assert len(requests)==1,requests
diff --git a/web/mixer-io.js b/web/mixer-io.js
index 2397230ba..ded11d125 100644
--- a/web/mixer-io.js
+++ b/web/mixer-io.js
@@ -9,7 +9,7 @@
let mode='FX', lastStatus={}, deviceInventory=null, ioTab='device', lastSignature='', focusedInput=2;
let monitorSendsExpanded=false;
// DEVICE1: staged selections are UI-only; only positive native ACK changes active hardware.
- let deviceDraft=null,deviceBusy=false,deviceNote='',deviceRequest='',deviceRequestSeq=0,lastDeviceRefresh=0,lastDeviceRescan=0;
+ let deviceDraft=null,deviceBusy=false,deviceNote='',deviceRequest='',deviceRequestSeq=0,lastDeviceRefresh=0,lastDeviceRescan=0,applyMutePending=false,applyAfterDevice=null,applyBaseEpoch=0;
let deviceMatrixView='inputs',deviceMatrixWaitEpoch=null; // Never display old hardware pins after an APPLY ACK.
// Pending SOURCE ACK is a UI projection only; monitor.js owns the native route.
let quickSourcePending=null;
@@ -456,7 +456,7 @@
overlay.innerHTML='
ArSonMiX · AUDIO HARDWARE
Audio Setup · Windows Devices & Routing
';
document.body.appendChild(overlay);
const audioPath=node('div','arIOAudioPath');audioPath.id='arIOAudioPath';
- audioPath.innerHTML='RAW INPUT · WAITROUTE · WAITMIXER · WAITOUTPUT · WAIT';
+ audioPath.innerHTML='CAPTURE · WAITROUTE · WAITMIXER · WAITOUTPUT · WAIT';
overlay.querySelector('.arIOWindow').insertBefore(audioPath,el('arIOBody'));
// Native first-sound capture truth: callback-order peaks are mapped to
// actual driver pin names ONLY if the hardware inventory belongs to the
@@ -500,18 +500,6 @@
const n=audioPath.querySelector('[data-audio-path-'+key+']');
if(n&&n.textContent!==value)n.textContent=value;
}
- // Same native START/ACK action as DEVICE/DRIVER. No duplicate host path,
- // automatic unmute, optimistic status or periodic full DOM rebuild.
- const start=audioPath.querySelector('[data-io-start-audio]');
- if(start){
- const pending=!!window.__arMixFastAudioState?.().pending;
- const label=lastStatus.monitor?'MUTE OUTPUT':pending?'STARTING…':'START AUDIO';
- if(start.textContent!==label)start.textContent=label;
- start.disabled=startAudioBlocked();
- start.setAttribute('aria-label',lastStatus.monitor?
- 'Mute hardware output immediately':
- 'Arm verified physical MAIN only after native route ACK');
- }
}
// G3: ONE floating inspector follows the selected source/AUX, no new
// DSP graph, no heavyweight matrix, no layout shifts in the MIX strips.
@@ -860,7 +848,7 @@
(s.ready?'E'+s.epoch+' / R'+(s.revision||0)+' · '+portList(s).length+' IN · '+(s.outputPorts?.length||0)+' OUT · '+(s.monitor?'OUTPUT ARMED':'OUTPUT MUTED'):'NO VERIFIED DEVICE · OUTPUT MUTED'):
'WEB PREVIEW · NO LIVE AUDIO';
if(info.textContent!==caption)info.textContent=caption;
- toolbar.querySelector('[data-mix-apply]').disabled=!isNative()||!s.ready||!!s.pending||!!s.monitor||(!overlay.hidden&&matrixDraft.size>0);
+ toolbar.querySelector('[data-mix-apply]').disabled=!isNative()||!s.ready||!!s.pending||(!overlay.hidden&&matrixDraft.size>0);
for(const strip of mixer.querySelectorAll('.strip[data-strip]'))refreshStrip(strip,s);
if(!overlay.hidden)refreshIO();
if(!sendEditor.hidden)drawSendEditor();
@@ -1207,16 +1195,6 @@
(deviceSameEndpoint(d)&&
(!pinsEqual(d.enabledInputs,a.enabledInputs)||!pinsEqual(d.enabledOutputs,a.enabledOutputs))));
}
- // Shared safety gate for BOTH visible START AUDIO buttons. The top
- // transport cannot bypass a staged device change, invalid hardware,
- // pending route/FX transaction or the existing native ACK handshake.
- function startAudioBlocked(){
- if(!isNative())return true;
- if(lastStatus.monitor)return false; // emergency physical MUTE always allowed
- const quick=window.__arMixFastAudioState?.()||{};
- return deviceBusy||!!quick.pending||!deviceInventory?.active?.open||
- !deviceSameEndpoint(deviceDraft)||deviceDirty()||!hardwareReady(route());
- }
function deviceRefresh(rescan=false){
if(!isNative()||deviceBusy)return;
const now=Date.now();
@@ -1240,7 +1218,7 @@
if(deviceBusy)return 'DEVICE SWITCH IN PROGRESS · wait for native readback';
if(!deviceDraft||!deviceInventory?.active)return 'REFRESH DEVICE INVENTORY';
if(lastStatus.secondaryOutputArmed)return 'STEP 1 · DISARM SECONDARY STREAM in SIGNAL CHECK before changing driver';
- if(s?.monitor||lastStatus.monitor)return 'STEP 1 · PRESS MUTE OUTPUT above before APPLY DEVICE';
+ // APPLY performs native MUTE first if the output is armed.
if(s?.pending)return 'WAIT · finish native routing APPLY/ACK before changing driver';
if(!deviceDraft.backend||!deviceDraft.captureDevice||!deviceDraft.playbackDevice)
return 'SELECT A VALID DUPLEX AUDIO INTERFACE';
@@ -1251,15 +1229,30 @@
if(!a.open||a.authorized===false)return 'SELECT ASIO/WINDOWS AUDIO, then APPLY DEVICE';
const maono=/maono/i.test(String(a.captureDevice||'')+' '+String(a.playbackDevice||''));
return /ASIO/i.test(a.backend||'')&&maono?
- 'ASIO OPEN · expand HARDWARE PIN ENABLE, select the actual Maono MIC or VC In 3+4 ports, then APPLY DEVICE again. Next select CH input sources, APPLY PATCH and START AUDIO.':
- 'DEVICE OPEN · verify enabled INPUT/OUTPUT pins, choose CH input sources, APPLY PATCH and START AUDIO.';
+ 'ASIO OPEN · expand HARDWARE PIN ENABLE, select the actual Maono MIC or VC In 3+4 ports, then APPLY DEVICE again. Next select CH input sources, APPLY.':
+ 'DEVICE OPEN · verify enabled INPUT/OUTPUT pins, choose CH input sources, APPLY.';
};
function deviceApply(){
if(!isNative()||deviceBusy||!deviceDraft||!deviceInventory?.active)return;
const d=deviceDraft,a=deviceInventory.active;
const blocked=deviceSwitchBlocker(route());
if(blocked){deviceNote=blocked;lastSignature='';refreshIO();return;}
- if(!deviceDirty())return;
+ if(!deviceDirty()){
+ const result=window.__arMixApplyAndActivate?.();
+ deviceNote=result?.ok?'APPLY ACCEPTED · NATIVE ACK PENDING':'APPLY REJECTED · '+(result?.error||'Route not ready');
+ lastSignature='';refreshIO();return;
+ }
+ if(lastStatus.monitor){
+ applyMutePending=true;
+ backend.emitEvent('arMixAction',{action:'monitor',value:false});
+ deviceNote='APPLY · WAITING FOR HARDWARE MUTE ACK';return;
+ }
+ sendDeviceRequest();
+ }
+ function sendDeviceRequest(){
+ if(!deviceDirty()||deviceBusy)return;
+ const d=deviceDraft,a=deviceInventory.active;
+ applyBaseEpoch=Number(route().epoch)||0;
// Changing hardware is a structural transaction, not a fader parameter.
deviceRequest='device-'+Date.now()+'-'+(++deviceRequestSeq);
deviceBusy=true;deviceNote='APPLYING · OUTPUT MUTED · waiting for native readback';
@@ -1310,19 +1303,21 @@
// stages the real native route then independently ARM-ACKs hardware.
const quick=window.__arMixFastAudioState?.()||{};
const start=node('button','btn-180 arIODeviceStartAudio',
- lastStatus.monitor?'MUTE OUTPUT':quick.pending?'STARTING…':'START AUDIO');
- start.type='button';start.dataset.ioStartAudio='1';
- start.disabled=startAudioBlocked();
+ 'MUTE OUTPUT');
+ start.type='button';start.dataset.ioStartAudio='1';start.hidden=!lastStatus.monitor;
+ start.disabled=!isNative()||(!lastStatus.monitor&&(
+ deviceBusy||!!quick.pending||!a.open||!deviceSameEndpoint(deviceDraft)||
+ deviceDirty()||!hardwareReady(route())));
start.setAttribute('aria-label',lastStatus.monitor?'Mute physical output':
'Start verified live routing and arm hardware output');
- activeLine.appendChild(start);
+ if(lastStatus.monitor)activeLine.appendChild(start);
const accepted=route().acceptedRoute?.channels||[];
const used=accepted.map((r,i)=>r.mode==='MONO'||r.mode==='STEREO'?
'CH'+String(i+1).padStart(2,'0'):null).filter(Boolean);
const firstSound=node('div','arIODeviceFirstSound',quick.message||(
lastStatus.monitor?'OUTPUT ARMED · '+used.join(' + ')+' → MAIN → HARDWARE':
- used.length?used.join(' + ')+' → MAIN ready · START AUDIO to hear sound':
- 'FIRST SOUND · START AUDIO maps CH01/CH02 to verified input pins, applies once, then arms MAIN'));
+ used.length?used.join(' + ')+' → MAIN ready · APPLY to hear sound':
+ 'FIRST SOUND · APPLY maps verified input pins, routes and arms MAIN'));
panel.appendChild(firstSound);
// Lightweight text-only 12 Hz live native meter. It remains truthful
// when OUTPUT MUTED and when no mixer patch has been created yet.
@@ -1331,6 +1326,7 @@
captureRow.setAttribute('aria-label','Verified raw input PCM before mixer routing');
panel.appendChild(captureRow);
+
if(!types.length&&!a.open)
panel.appendChild(node('p','arIODeviceEmpty',
'No reported Windows audio devices. Refresh driver list while all outputs are MUTED.'));
@@ -1467,7 +1463,7 @@
}else matrixSection.appendChild(makeMatrix(s,deviceMatrixView));
matrixSection.appendChild(node('p','arIODeviceMatrixNote',
deviceMatrixView==='inputs'?
- 'Named inputs are reusable SOURCES. START AUDIO builds a verified initial route; only native ACK confirms sound routing.':
+ 'Named inputs are reusable SOURCES. APPLY builds a verified initial route; only native ACK confirms sound routing.':
'MAIN / MONITOR outputs use muted APPLY PATCH and native ACK.'));
}
body.appendChild(matrixSection);
@@ -1485,17 +1481,18 @@
});
overlay.dataset.activeTab=ioTab;
const matrixInDevice=ioTab==='device'&&deviceSameEndpoint(deviceDraft)&&hardwareReady(s);
- overlay.querySelector('[data-mix-apply]').hidden=ioTab==='device'&&!matrixInDevice;
+ overlay.querySelector('[data-mix-apply]').hidden=ioTab==='device';
overlay.querySelector('[data-io-revert]').hidden=ioTab==='device'&&!matrixInDevice;
overlay.querySelector('[data-io-internal]').hidden=ioTab==='device';
overlay.querySelector('[data-io-device-apply]').hidden=ioTab!=='device';
overlay.querySelector('[data-io-device-revert]').hidden=ioTab!=='device';
const deviceBlocker=deviceSwitchBlocker(s);
- overlay.querySelector('[data-io-device-apply]').disabled=!deviceDirty()||!!deviceBlocker;
+ overlay.querySelector('[data-io-device-apply]').disabled=!!deviceBlocker||deviceBusy||applyMutePending||deviceMatrixWaitEpoch!==null||!!window.__arMixFastAudioState?.().pending||(!deviceDirty()&&(!hardwareReady(s)||!!lastStatus.monitor));
+ overlay.querySelector('[data-io-device-apply]').textContent=deviceBusy||applyMutePending?'APPLYING…':'APPLY';
overlay.querySelector('[data-io-device-apply]').title=deviceBlocker||
(deviceDirty()?'Commit selected device then verify physical pin readback':'No pending device edit');
overlay.querySelector('[data-io-device-revert]').disabled=deviceBusy||!deviceDirty();
- overlay.querySelector('[data-mix-apply]').disabled=!hardwareReady(s)||!!matrixDraft.size||s.monitor||
+ overlay.querySelector('[data-mix-apply]').disabled=!hardwareReady(s)||!!matrixDraft.size||
(ioTab==='device'&&deviceDirty());
overlay.querySelector('[data-io-revert]').disabled=!isNative()||s.pending;
const signature=ioTab+'|'+JSON.stringify([s.epoch,s.revision,s.pending,s.draftRoutes,
@@ -1734,7 +1731,7 @@
}
if(b.dataset.sendRevert!==undefined){e.preventDefault();sendMutation(()=>window.__arMixRevertMixerDraft?.());return;}
if(b.dataset.sendApply!==undefined){
- e.preventDefault();const result=window.__arMixApplyMixerDraft?.();
+ e.preventDefault();const result=window.__arMixApplyAndActivate?.();
sendFeedback=result?.ok?'SUBMITTED · WAIT FOR NATIVE ACK':result?.error||'APPLY failed';
drawSendEditor();return;
}
@@ -1747,8 +1744,8 @@
if(b.dataset.ioStartAudio!==undefined){
e.preventDefault();e.stopImmediatePropagation();
const result=window.__arMixStartLiveAudio?.();
- deviceNote=result?.ok?'START AUDIO requested · native ACK required':
- 'START REJECTED · '+(result?.error||'Native device not ready');
+ deviceNote=result?.ok?'APPLY requested · native ACK required':
+ 'APPLY REJECTED · '+(result?.error||'Native device not ready');
lastSignature='';refreshIO();return;
}
if(b.dataset.ioSoftwareAdd){
@@ -1859,7 +1856,7 @@
else window.__arMixOpenChannelPatch?.(channel,b.dataset.mixPatch);
return;
}
- if(b.dataset.mixApply!==undefined){e.preventDefault();e.stopImmediatePropagation();const response=window.__arMixApplyMixerDraft?.();if(response&&!response.ok)el('arIOFeedback').textContent=response.error;refresh();return;}
+ if(b.dataset.mixApply!==undefined){e.preventDefault();e.stopImmediatePropagation();const response=window.__arMixApplyAndActivate?.();if(response&&!response.ok)el('arIOFeedback').textContent=response.error;refresh();return;}
},true);
document.addEventListener('input',e=>{
if(e.target.matches('.arIOSoftwareNameEdit')&&softwareEdit)
@@ -1932,6 +1929,11 @@
focusFlow.hidden=mixer.classList.contains('hidden');
backend?.addEventListener?.('arMixStatus',d=>{
lastStatus=d;
+ if(applyAfterDevice && Number(d?.deviceGeneration)===applyAfterDevice.generation && d?.driver===applyAfterDevice.driver && d?.inputDevice===applyAfterDevice.capture && d?.outputDevice===applyAfterDevice.playback && Number(d?.dryRoutingLab?.epoch)>0 && d?.dryRoutingLab?.ready && d?.dryRoutingLab?.active){
+ applyAfterDevice=null;
+ const result=window.__arMixApplyAndActivate?.();
+ deviceNote=result?.ok?'APPLY · NATIVE ROUTE/ARM ACK PENDING':'APPLY REJECTED · '+(result?.error||'Source not ready');
+ }
// 12Hz native telemetry: update only when topology, epoch or safety changes.
const s=d.dryRoutingLab||{},key=JSON.stringify([s.epoch,s.revision,s.ready,s.ports,s.outputPorts,s.acceptedRoute,d.monitor,d.masterMute]);
if(window.__armixIoStatusKey!==key){window.__armixIoStatusKey=key;lastSignature='';refresh();}
@@ -1955,6 +1957,7 @@
// CACHED is a non-disruptive snapshot; do not erase pending operator notes.
lastSignature='';if(!overlay.hidden)refreshIO();
});
+ backend?.addEventListener?.('arMixAudioArmAck',ack=>{ if(applyMutePending){ applyMutePending=false; if(ack?.ok&&!ack.armed){lastStatus.monitor=false;sendDeviceRequest();}else deviceNote='APPLY MUTE REJECTED'; } });
backend?.addEventListener?.('arMixAudioDeviceApplyAck',ack=>{
if(!deviceBusy||ack?.requestId!==deviceRequest)return;
deviceBusy=false;deviceRequest='';
@@ -1965,6 +1968,7 @@
if(ack?.active?.open&&Number(ack.active.deviceGeneration)!==oldGeneration)
deviceMatrixWaitEpoch=route().epoch;
deviceDraft=makeDeviceDraft();
+ if(ack?.ok&&ack?.active?.open)applyAfterDevice={generation:Number(ack.active.deviceGeneration),capture:ack.active.captureDevice,playback:ack.active.playbackDevice,driver:ack.active.backend};
deviceNote=ack?.ok?'DEVICE ACCEPTED · OUTPUT MUTED · '+devicePinNextStep():
(ack?.state||'REJECTED')+' · '+(ack?.error||'Check driver and retry');
// Same real routing controller sees the new device epoch via normal status.
@@ -2005,7 +2009,7 @@
});
window.addEventListener('arMixRoutingDraftChanged',()=>{lastSignature='';refresh();});
window.addEventListener('arMixFastAudioResult',event=>{
- deviceNote=event.detail?.message||'START AUDIO';
+ deviceNote=event.detail?.message||'APPLY';
lastSignature='';if(!overlay.hidden)refreshIO();
});
window.addEventListener('arMixAuxMasterGainResult',event=>{
diff --git a/web/monitor.js b/web/monitor.js
index c9eecda41..17c7d643d 100644
--- a/web/monitor.js
+++ b/web/monitor.js
@@ -1759,8 +1759,41 @@
fastAudioNotify("CH01"+(pins.length>1?"/CH02":"")+" → MAIN · WAITING FOR NATIVE PATCH ACK");
return {ok:true,pending:true,phase:"patch"};
};
+ // One explicit APPLY owns patch ACK -> physical ARM, no second START.
+ const submitFastCustomPatch=()=>{
+ const d=state.dryRoutingLab||{};
+ fastAudioPending={phase:"custom-patch",epoch:Number(d.epoch)};
+ const result=window.__arMixApplyMixerDraft();
+ if(!result?.ok){fastAudioPending=null;return result;}
+ fastAudioNotify("APPLY · WAIT FOR NATIVE ROUTING ACK");
+ return {ok:true,pending:true};
+ };
+ window.__arMixApplyAndActivate=()=>{
+ const d=state.dryRoutingLab||{};
+ if(fastAudioPending||patchPending||nativeShowBusy||liveSendPending.size)
+ return {ok:false,error:"Native transaction still pending."};
+ if(mixerDraftActive||rackFxDraft){
+ if(state.monitor){
+ fastAudioPending={phase:"mute-custom",epoch:Number(d.epoch)};
+ api.emitEvent("arMixAction",{action:"monitor",value:false});
+ fastAudioNotify("APPLY · SAFE MUTE → ROUTE → ARM");
+ return {ok:true,pending:true};
+ }
+ return submitFastCustomPatch();
+ }
+ if(state.monitor)return {ok:true,pending:false,message:"OUTPUT ALREADY LIVE"};
+ return window.__arMixStartLiveAudio();
+ };
window.__arMixFastAudioState=()=>({pending:!!fastAudioPending,message:fastAudioMessage});
api.addEventListener("arMixAudioArmAck",ack=>{
+ if(fastAudioPending?.phase==="mute-custom"){
+ const p=fastAudioPending;fastAudioPending=null;
+ if(!ack?.ok||ack?.armed||Number(ack.deviceEpoch)!==p.epoch)return fastAudioNotify("APPLY MUTE ACK REJECTED");
+ state.monitor=false;
+ const next=submitFastCustomPatch();
+ if(!next?.ok)fastAudioNotify("APPLY REJECTED · "+next.error);
+ return;
+ }
if(fastAudioPending?.phase!=="arm")return;
const expected=fastAudioPending;
fastAudioPending=null;
@@ -1796,12 +1829,12 @@
:result.active&&result.ready?"NATIVE ACK: INPUT PATCH CLEARED · 10CH+4AUX engine ready, output MUTED"
:"NATIVE ROUTE UNAVAILABLE · output remains SILENT";
updateRouteLabIdentity();
- if(fastAudioPending?.phase==="patch"){
+ if(fastAudioPending?.phase==="patch"||fastAudioPending?.phase==="custom-patch"){
const pending=fastAudioPending;fastAudioPending=null;
const routes=result?.acceptedRoute?.channels||[];
const verified=reply?.ok===true&&result.ready===true&&
result.hasAcceptedRoute===true&&Number(result.epoch)===pending.epoch&&
- pending.pins.every((pin,i)=>routes[i]?.mode==="MONO"&&routes[i]?.left===pin);
+ (pending.phase==="custom-patch"?routes.some(r=>r.mode==="MONO"||r.mode==="STEREO"):pending.pins.every((pin,i)=>routes[i]?.mode==="MONO"&&routes[i]?.left===pin));
if(verified)fastAudioArm(result);
else fastAudioNotify("START STOPPED · route ACK failed or device changed. OUTPUT remains MUTED.");
}
@@ -1832,18 +1865,10 @@
const routed=normal&&!!r.ready&&!!r.hasAcceptedRoute&&!r.topologyFault;
const input=!d.connected?"DEVICE CLOSED":!callback?"NO CAPTURE CALLBACK":captured?"RAW CAPTURE PCM":"NO RAW CAPTURE PCM";
const route=!normal?"DIAGNOSTIC MODE":!r.ready?"UNPATCHED / STALE":r.hasAcceptedRoute?"NATIVE ROUTE ACK":"INPUT PATCH REQUIRED";
- // Capture peak is BEFORE the mixer. Native channel peaks are after
- // source selection, inserts and the fader; never label raw PCM as mixed.
- const acceptedChannels=Array.isArray(r.acceptedRoute?.channels)?r.acceptedRoute.channels:[];
- const patched=acceptedChannels.map((row,i)=>
- row?.mode==="MONO"||row?.mode==="STEREO"?i:-1).filter(i=>i>=0);
- const meter=Array.isArray(r.channelPeaks)?r.channelPeaks:[];
- const mixed=patched.some(i=>Number(meter[i])>0.0002);
- const mainPcm=Number(d.peak)>0.0002;
- const mixer=!routed?"MIXER · NOT READY":!d.monitor?"MIXER · WAIT ARM":
- mixed?"POST-FADER PCM":"POST-FADER SILENT";
- const output=!d.monitor?"OUTPUT SAFE-MUTED":d.masterMute?"MASTER MUTED":
- !routed?"OUTPUT BLOCKED":mainPcm?"MAIN PCM · ARMED":"OUTPUT ARMED · SILENT";
+ const peaks=Array.isArray(r.channelPeaks)?r.channelPeaks:[];
+ const mixed=peaks.some(x=>Number(x)>0.0002);
+ const mixer=mixed?"POST-FADER PCM":d.monitor?"MIXER · NO PCM":"MIXER · WAIT ARM";
+ const output=!d.monitor?"OUTPUT SAFE-MUTED":d.masterMute?"MASTER MUTED":!routed?"OUTPUT BLOCKED":Number(d.peak)>0.0002?"MAIN PCM · ARMED":"OUTPUT ARMED · NO MAIN PCM";
let message;
if(d.error)message="Audio driver error: "+d.error;
else if(!d.connected)message="No device connected. Select real capture and render endpoints in AUDIO I/O.";
@@ -1856,12 +1881,12 @@
message=/cable output/i.test(String(d.inputDevice||""))
?"No input PCM in this block. VB-Cable CABLE Output is the recording endpoint: the player must send to Windows playback CABLE Input, not Realtek Speakers."
:"No capture PCM in this block. Send a steady source signal and inspect the selected input and enabled physical pins.";
- if(!d.monitor)message+=" MAIN is also SAFE-MUTED. Press START AUDIO in AUDIO SETUP at low volume after verifying input.";
- }else if(!d.monitor)message="Raw capture detected, but ArSonMix physical MAIN is SAFE-MUTED: this headphone sound is NOT proof of mixer playback. Check MAONO direct monitor/loopback or Windows Listen to this device, then press START AUDIO at low volume.";
- else if(d.masterMute)message="Capture present but MASTER MUTE is active. If sound persists, check interface direct monitoring or another Windows playback route.";
- else if(!mixed)message="Raw capture detected but no PCM after an accepted channel fader. Check patched channel SOURCE, MUTE, fader and native FX.";
- else if(!mainPcm)message="Post-fader channel PCM exists but native MAIN is silent. Check bus/sends, MASTER fader, mute, and physical pin routing.";
- else message="Native post-fader and MAIN PCM detected with output armed. To prove the sound is from ArSonMix, MUTE the active channel or MASTER: sound must stop. If not, disable direct monitoring/Windows parallel playback.";
+ if(!d.monitor)message+=" MAIN is also SAFE-MUTED. Press APPLY in AUDIO I/O at low volume after verifying input.";
+ }else if(!d.monitor)message="Capture PCM detected but physical MAIN is SAFE-MUTED. Press APPLY in AUDIO I/O to arm at low headphone volume; disable hardware direct monitor if doubling the signal.";
+ else if(d.masterMute)message="Capture PCM detected but MASTER MUTE is active.";
+ else if((Number(d.postFxPeak ?? d.peak)||0)<0.0002)message="Capture PCM present, but routed audio is silent. Check channel SOURCE, fader, mute and FX.";
+ else if((Number(d.peak)||0)<0.0002)message="Post-FX PCM present but hardware MAIN is silent. Check MASTER fader and output pin patch.";
+ else message="Input and MAIN PCM measured. Press MUTE OUTPUT: sound must stop; otherwise audio bypasses ArSonMix. If silent, inspect Windows output and cables.";
return {input,route,mixer,output,message,inputPeak:peak,captureSignalBlocks:Number(d.captureSignalBlocks)||0};
};
function diagnosis(d) {
@@ -1933,7 +1958,7 @@
" / overflow "+(d.secondaryOutputOverflow||0)+
". For external apps choose their corresponding capture device if applicable.");
if (!overlay.classList.contains("open")) return;
- el("arInputName").textContent=d.dryRoutingLab?.active?"RAW CAPTURE · NOT FADER PCM":d.diagnosticRoute==="OUTPUT_ONLY_TONE"?"INTERNAL TEST TONE":d.inputDevice||"Input device";
+ el("arInputName").textContent=d.dryRoutingLab?.active?"NATIVE 10 CH INPUTS":d.diagnosticRoute==="OUTPUT_ONLY_TONE"?"INTERNAL TEST TONE":d.inputDevice||"Input device";
el("arFxName").textContent=d.dryRoutingLab?.active?(String(d.dryRoutingLab.fxCount||0)+" NATIVE VST3"):d.diagnosticRoute==="OUTPUT_ONLY_TONE"?"NO INPUT / NO FX":d.diagnosticRoute!=="NORMAL"?"NO FX":d.dryTest?"DRY BYPASS":"VST3 Chain";
el("arOutputName").textContent=d.outputDevice||"Output device";
el("arInputBar").style.width=percent(d.inputPeak)+"%";