diff --git a/AR-MIX-Live-FX-Host-Standalone-v0.3.html b/AR-MIX-Live-FX-Host-Standalone-v0.3.html index 0a766cdf7..9dc2a7329 100644 --- a/AR-MIX-Live-FX-Host-Standalone-v0.3.html +++ b/AR-MIX-Live-FX-Host-Standalone-v0.3.html @@ -2073,6 +2073,58 @@ .arIOOverlay[data-active-tab="device"] .arIOWindow footer [data-io-internal], .arIOOverlay[data-active-tab="device"] .arIOWindow footer [data-io-advanced]{display:none!important} +/* M1 CHANNEL FOCUS: one thin native-ACK signal-flow header across the workbench, + never packed into RAIL3/sidebar. No blur, animations or per-pointer redraw. */ +#app .workbench .arChannelSignalFlow{ + box-sizing:border-box;flex:none;display:flex;align-items:stretch;gap:4px; + width:100%;height:35px;padding:3px 5px;min-width:0; + border-bottom:1px solid #425966;background:linear-gradient(#23353e,#15242d); + color:#d3e6eb;font:500 10px/1.2 "ArSonMix Inter","Segoe UI",sans-serif; +} +#app .workbench .arChannelSignalFlow[hidden]{display:none!important} +#app .arChannelSignalFlow .arFocusIndex{ + flex:0 0 51px;display:grid;place-items:center; + background:#14272f;border:1px solid #37535f;color:#b8edf0; + font:600 10px Consolas,monospace; +} +#app .arChannelSignalFlow button{ + flex:1 1 0;min-width:0;max-width:none;display:flex;align-items:center;gap:6px; + background:#10232d;border:1px solid #38505d;padding:0 7px; + color:#a2c4ce;font:600 9px "ArSonMix Inter","Segoe UI",sans-serif; + cursor:pointer;white-space:nowrap;text-align:left; +} +#app .arChannelSignalFlow button span{ + flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis; + white-space:nowrap;color:#e1ebef;font:500 9px Consolas,monospace; +} +#app .arChannelSignalFlow[data-native-state="unverified"] button span{ + color:#baa88c; +} +#app .arChannelSignalFlow button:hover{background:#203b48;border-color:#4c8894} +#app .arChannelSignalFlow button:focus-visible{ + outline:2px solid #81dfe5;outline-offset:-2px; +} +/* Existing MS5 rail lives in a strict two-column grid. AUX MASTER occupies one + additional short row, preserving the existing mode buttons and RAIL3. */ +#app .left-rail .arSofControls .arAuxMasterInline{ + grid-column:1/-1;display:flex;align-items:center;gap:5px;min-width:0; + height:29px;padding:0 5px;background:#0e2530;border:1px solid #3d6676; + color:#a9d5de;font:550 8px "ArSonMix Inter","Segoe UI",sans-serif; +} +#app .left-rail .arAuxMasterInline input{ + flex:1 1 auto;width:36px;min-width:0;accent-color:#52b5c2; +} +#app .left-rail .arAuxMasterInline input:disabled{opacity:.38} +#app .left-rail .arAuxMasterInline output{ + flex:0 0 43px;text-align:right;color:#d5edf2; + font:9px Consolas,monospace;white-space:nowrap; +} +@media(max-width:1080px){ + #app .arChannelSignalFlow button{padding:0 4px;gap:3px;font-size:8px} + #app .arChannelSignalFlow button span{font-size:8px} + #app .arChannelSignalFlow .arFocusIndex{flex-basis:45px} +} + /* DEVICE1 — compact, hardware-truthful, one native device manager. No blur, animated glow or per-pointer layout work. */ @@ -3225,10 +3277,68 @@ const toolbar=node('div','arMixerBankBar'); toolbar.innerHTML='
NO HARDWARE · PREVIEW
'; host.insertBefore(toolbar,mixer); + // One genuinely selected-channel journey, NOT another DSP or source registry. + // Four compact steps show ACKNOWLEDGED state, never stage a hidden graph. + const focusFlow=node('div','arChannelSignalFlow'); + focusFlow.setAttribute('aria-label','Selected live mixer channel signal flow'); + focusFlow.innerHTML='CH 01'+ + ''+ + ''+ + ''+ + ''; + // mixer-layout.js moves the whole toolbar into the LEFT RAIL. + // The selected channel overview is therefore a separate compact WORKBENCH + // row; placing it in toolbar would jam 4 steps into 168px of sidebar. + host.insertBefore(focusFlow,mixer); + let focusIndex=0,focusSignature=''; + const focusSet=(q,value)=>{ + const target=focusFlow.querySelector(q); + if(target&&target.textContent!==value)target.textContent=value; + }; + const selectedInputChannel=()=>{ + const chosen=mixer.querySelector('.strip[data-strip].selected'); + const i=chosen?Number(chosen.dataset.strip):focusIndex; + return Number.isInteger(i)&&i>=0&&i<10?i:0; + }; + function refreshFocus(s){ + const i=selectedInputChannel(),r=s.acceptedRoute?.channels?.[i]; + const ack=!!s.ready&&!!s.active&&!!r&&Number(s.acceptedRoute.deviceEpoch)===Number(s.epoch); + const driverPins=portList(s); + const names=id=>driverPins.find(p=>p.port===id)?.label; + let source='UNPATCHED'; + if(ack&&r.mode==='MONO') + source=names(r.left)||'PIN '+(Number(r.left)+1)+' · VERIFY'; + if(ack&&r.mode==='STEREO') + source=(names(r.left)||'L'+(Number(r.left)+1))+' / '+ + (names(r.right)||'R'+(Number(r.right)+1)); + if(ack&&r.mode==='BUS')source='INTERNAL BUS'; + if(!ack)source='NO NATIVE ACK'; + const routed=ack?lastStatus.dryRoutingLab?.fxInstances?.[i]:null; + const inserts=Array.isArray(routed)?routed.length:0; + const legacy=i===0?Math.max(0,Number(lastStatus.chainCount)||0):0; + const fx=(inserts+legacy)+' VST3'+(legacy&&inserts?' · SPLIT OWNERS':''); + const sends=ack&&Array.isArray(s.acceptedRoute.sends)? + s.acceptedRoute.sends.filter(x=>x.from===i&&x.to>=10&&x.to<14):[]; + const sendsText=sends.length?sends.map(x=>'AUX'+(x.to-9)+' '+x.tap).join(' / '):'NO AUX'; + const outputs=s.mainOutputs?.length===2?s.mainOutputs:[]; + const dest=ack&&r.main&&outputs.length===2? + 'MAIN HW '+(outputs[0]+1)+'/'+(outputs[1]+1): + ack&&r.main?'MAIN · NO PIN':ack?'SEND ONLY':'NO OUTPUT'; + const sig=JSON.stringify([i,source,fx,sendsText,dest,ack,s.pending]); + if(sig!==focusSignature){ + focusIndex=i;focusSignature=sig; + focusSet('[data-focus-channel]','CH '+String(i+1).padStart(2,'0')); + focusSet('[data-focus-source]',source); + focusSet('[data-focus-fx]',fx); + focusSet('[data-focus-sends]',sendsText); + focusSet('[data-focus-out]',dest); + focusFlow.dataset.nativeState=ack&&!s.pending?'accepted':'unverified'; + } + } // MS5: explicit Sends-on-Faders control, scoped to a single real AUX return. // MAIN fader DOM and all audio controls remain resident and unmodified. const sofControls=node('div','arSofControls'); - sofControls.innerHTML=''; + sofControls.innerHTML=''; sofControls.hidden=true;toolbar.appendChild(sofControls); const overlay=node('div','arIOOverlay'); overlay.id='arIOOverlay';overlay.hidden=true; @@ -3346,6 +3456,18 @@ sofControls.hidden=mode!=='SENDS'; const selector=sofControls.querySelector('[data-sof-bus]'); const toggle=sofControls.querySelector('[data-sof-toggle]'); + const auxLevel=sofControls.querySelector('[data-aux-master]'); + const auxRead=sofControls.querySelector('[data-aux-master-read]'); + const busSelected=Number(selector.value); + const acceptedBus=s.acceptedRoute?.auxes?.[busSelected]; + const enabled=!!acceptedBus?.enabled&&!s.pending&&s.ready&&isNative(); + const currentGain=Number(acceptedBus?.gain); + const db=Number.isFinite(currentGain)&¤tGain>0 + ?Math.max(-60,Math.min(6,20*Math.log10(currentGain))):-60; + auxLevel.disabled=!enabled; + if(document.activeElement!==auxLevel)auxLevel.value=String(db); + const readText=enabled?(db<=-60?'OFF':db.toFixed(1)+' dB'):'AUX OFF'; + if(auxRead.textContent!==readText)auxRead.textContent=readText; if(sofBus>=0&&(!isNative()||!s.ready||!s.active||s.epoch!==sofEpoch)){ leaveSof();sofStatus('SEND FADERS EXITED · DEVICE CHANGED'); } @@ -3557,6 +3679,7 @@ if(!overlay.hidden)refreshIO(); if(!sendEditor.hidden)drawSendEditor(); sofRefresh(s); + refreshFocus(s); } // IO-MATRIX: reusable presentation of the existing native 10-channel graph. @@ -4161,6 +4284,50 @@ lastSignature='';refresh(); } },true); + // AUX return fader updates only after release/keyboard change; native + // DSP ramps it inside one callback. Never touch the MAIN fader or rack. + sofControls.addEventListener('change',event=>{ + if(event.target.matches('[data-sof-bus]')){sofMessage='';refresh();return;} + if(!event.target.matches('[data-aux-master]'))return; + const bus=Number(sofControls.querySelector('[data-sof-bus]').value); + const db=Number(event.target.value); + const gain=db<=-60?0:Math.pow(10,db/20); + const answer=window.__arMixSetLiveAuxMasterGain?.(bus,+gain.toFixed(7)); + sofMessage=answer?.ok?'AUX MASTER · WAIT NATIVE ACK': + answer?.error||'AUX master unavailable'; + refresh(); + }); + // Channel focus is intentionally lightweight: point into existing MIX + // modes and native controller, never create a parallel mixer/FX model. + focusFlow.addEventListener('click',event=>{ + const button=event.target.closest('[data-focus-step]'); + if(!button)return; + event.preventDefault(); + const index=selectedInputChannel(); + const strip=mixer.querySelector('[data-strip="'+index+'"]'); + const step=button.dataset.focusStep; + if(step==='source'){ + if(!route().ready)openIO('device'); + else { + setMode('ROUTE'); + strip?.querySelector('.arBankSource')?.focus(); + } + } else if(step==='fx'){ + setMode('FX'); + if(typeof chooseChannel==='function')chooseChannel(index); + strip?.querySelector('.rack')?.scrollIntoView?.({block:'nearest',inline:'nearest'}); + } else if(step==='sends'){ + setMode('SENDS'); + const sends=route().acceptedRoute?.sends||[]; + const found=sends.find(x=>x.from===index&&x.to>=10&&x.to<14); + editSend(index,found?found.to-10:0,button); + } else if(step==='output')openIO('outputs',index); + }); + document.addEventListener('click',event=>{ + if(event.target.closest?.('#arChannelFocus,[data-focus-step]'))return; + const strip=event.target.closest?.('.strip[data-strip],[data-choose],[data-chanselect]'); + if(strip)refreshFocus(route()); + }); // The legacy native VST3 bridge registers document capture before this module. // Window capture intercepts only AUDIO SETUP, without changing FX/Orbit ownership. window.addEventListener('click',e=>{ @@ -4301,8 +4468,13 @@ if(!sendEditor.hidden){closeSendEditor();e.stopImmediatePropagation();} else if(!overlay.hidden){closeIO();e.stopImmediatePropagation();} },true); - const observer=new MutationObserver(records=>{if(records.some(r=>r.type==='childList'))refresh();}); - observer.observe(mixer,{childList:true}); + const observer=new MutationObserver(records=>{ + if(records.some(r=>r.type==='childList'))refresh(); + if(records.some(r=>r.attributeName==='class')) + focusFlow.hidden=mixer.classList.contains('hidden'); + }); + observer.observe(mixer,{childList:true,attributes:true,attributeFilter:['class']}); + focusFlow.hidden=mixer.classList.contains('hidden'); backend?.addEventListener?.('arMixStatus',d=>{ lastStatus=d; // 12Hz native telemetry: update only when topology, epoch or safety changes. @@ -4342,6 +4514,12 @@ refresh(); }); window.addEventListener('arMixRoutingDraftChanged',()=>{lastSignature='';refresh();}); + window.addEventListener('arMixAuxMasterGainResult',event=>{ + const ack=event.detail||{}; + sofMessage=ack.ok?'AUX '+(ack.bus+1)+' MASTER · LIVE NATIVE ACK': + 'AUX MASTER REJECTED · '+(ack.error||'Stale device'); + refresh(); + }); window.addEventListener('arMixAuxSendGainResult',event=>{ const a=event.detail||{}; if(sofBus>=0&&a.bus===sofBus){ diff --git a/docs/M1B_SELECTED_CHANNEL_AND_AUX_MASTER_20261031.md b/docs/M1B_SELECTED_CHANNEL_AND_AUX_MASTER_20261031.md new file mode 100644 index 000000000..3b31fdd8e --- /dev/null +++ b/docs/M1B_SELECTED_CHANNEL_AND_AUX_MASTER_20261031.md @@ -0,0 +1,19 @@ +# M1B — Selected CHANNEL signal-flow + real native AUX MASTER +31 October 2026 | base main after #224 | independent follow-on to #223 (POST send gain) and #224 (real audio-device/source patch). + +## Operator acceptance (single source, not another routing controller) +In MIX, select CH03 or CH06: one **35 px** compact CHANNEL FOCUS ribbon across the workspace shows CH number and native accepted SOURCE, current native routed VST3 count (plus CH1 legacy owner where present), acknowledged CH→AUX sends and real physical MAIN output pair. Buttons SOURCE, FX, SEND, OUT enter existing MIX ROUTE, native insert rack, source-specific AUX send inspector and Audio I/O OUTPUT. Each new view refers to `window.__arMixRouteView()` and the JUCE `arMixStatus` snapshot, not browser-only telemetry, fake plugin controls, or invented device pins. A pending/stale graph cannot show LIVE. The left RAIL3 mode selector and floating FX editor remain untouched; there are no animations, heavy blur layers, per-frame graph rebuilds, or duplicate audio models. + +## AUX return master fader — after FX, affects MAIN and MONITOR +In SENDS mode, select AUX1-4. The AUX MASTER slider on the existing slim rail section displays -60..+6 dB, with 0 dB at native gain 1.0. Release/keyboard changes dispatch `routingAuxBusGain` with exact native device epoch/revision and requestId. Only an **existing enabled** AUX bus allows 0..4 finite gain (UI deliberately caps at +6 dB); invalid/disabled bus, stale revision, unexpected device, active Show/backup, pending structural DRAFT and duplicate requests reject without a UI optimistic LIVE state. + +The native single writer uses `RealtimeRoutePublisher::updateActiveControl` on the existing immutable FX graph; `LiveChannelFxGraph::setAuxBusGain` accesses one of four atomic targets stored in its pre-allocated `PreparedMixerBlock`. The single JUCE callback uses <=64-sample interpolation **after AUX FX**, before summing to MAIN and physical MONITOR. No second callback, FX recreation, heap allocation, lock, device reopen, plugin state capture, graph recompilation or manual global mute. The accepted route gain updates only on success and is retained by the next STRUCTURAL APPLY. AUX enable, mute, FX changes, PRE/PAN sends, SOURCE hot-switch, physical output setup and Show structural recall remain separate guarded transactions. + +## Test and merge gates +- Native `ARMixMixerRoutingTests`: real mono mic -> POST send -> enabled AUX return -> MAIN+MONITOR; test 1.0→2.0→0.0 gain, callback-boundary ramp, steady state, rejection of missing AUX2/bad/NaN gain, immutable plan and legacy graph behavior when live control is absent. +- Chromium `mixer_io_smoke.py`: show Channel Focus readback BEFORE and AFTER positive SOURCE ACK; use FX/SOURCE navigation without remounting racks; send AUX MASTER while OUTPUT may remain ARMED; accepted route remains unchanged before native ACK, then reads updated value, then restores unity; no new `routingDryApply`; preserve G1/G3/MS5 and 11-fader layout. `mixer_io_operator_contract_test.mjs` asserts wiring/one prepared owner and no blur. +- One exact-head Windows MSVC/CTest/package and Chromium smoke run per branch; release/merge requires both SUCCESS. Standalone HTML CSS+JS embedded scripts must match modular files byte-for-byte. +- FAT on a REAL ASIO/WASAPI audio interface: baseline 0FX dry path first; then CH→AUX FX return and independent 4-output MAIN/MONITOR where available; move AUX MASTER while audio runs; listen for clicks, verify MAIN, MONITOR and accepted gain after ACK. Save native report if crackle occurs. **CI PASS is not hardware certification.** No new user hardware test request until integrated M1 operator slice and engineering gates meet release criteria. + +## Truthful remaining full-product gaps +PATCH2 seamless source change with output armed still NOT implemented (#224 deliberately fails closed), actual flexible GROUP/DCA/MATRIX and arbitrary live dynamic channels not done, genuine MASTER FX/PDC unfinished, factory VST3 distribution lock may remain empty. The user requested a finished realtime mixer, so call this an integrated operator milestone, not a full Studio One/eMotion LV1 release. diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index b1092fcd1..4083c7051 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -167,6 +167,9 @@ class LiveChannelFxGraph final { const std::array& monitorGains() const noexcept{return monitorGains_;} // M1: native realtime send fader on an EXISTING validated AUX POST edge. // Same prepared graph, no VST instance change or global mute. + bool setAuxBusGain(int bus,float gain) noexcept { + return block_&&block_->setAuxBusGain(bus,gain); + } bool setAuxSendGain(int source,int bus,float gain) noexcept { return block_ && block_->setAuxSendGain( source,bus,SendTap::postFader,gain); diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index db3585e52..9f685b40d 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -180,6 +180,11 @@ class PreparedMixerBlock final { auxTarget_[e].store(v,std::memory_order_relaxed); auxApplied_[e]=v; } + for(int b=0;b(2*i)*capacity_; @@ -217,6 +222,19 @@ class PreparedMixerBlock final { } return false; } + // AUX master is a live fader, never a topology change. It scales the + // already-rendered AUX FX return for both MAIN and MONITOR after inserts. + bool setAuxBusGain(int bus,float gain) noexcept { + if(bus<0||bus>=auxBusCount||!plan_.aux.active|| + !plan_.aux.buses[bus].enabled||!std::isfinite(gain)|| + gain<0.f||gain>4.f)return false; + auxBusTarget_[bus].store(gain,std::memory_order_release); + return true; + } + float auxBusGain(int bus) const noexcept { + return bus>=0&&bus=stripCount||bus<0||bus>=auxBusCount)return -1.f; for(int e=plan_.aux.offset[source];e(ramp); + float current=start; for(int f=0;f0.f) { monitorL[f]+=vl*monitorGain; monitorR[f]+=vr*monitorGain; @@ -409,6 +434,7 @@ class PreparedMixerBlock final { masterR_[f]+=vr; } } + if(live)auxBusApplied_[b]=target; if(observed)observed->auxPeak[b]=peak; } processFx(-1,masterL_,masterR_,frames); @@ -463,6 +489,8 @@ class PreparedMixerBlock final { std::array preGate_{},lastGainL_{},lastGainR_{}; std::array,maxAuxSends> auxTarget_{}; std::array auxApplied_{}; // callback thread exclusive + std::array,auxBusCount> auxBusTarget_{}; + std::array auxBusApplied_{}; // callback thread exclusive std::array rampPrimed_{}; float* masterL_=nullptr; float* masterR_=nullptr; diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index a5c9ed2a6..b7d07a3c9 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1033,6 +1033,15 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback float value) noexcept { return dryRoutingLab_.setChannelParameter(strip,epoch,revision,parameter,value); } + bool setDryRoutingLabAuxBusGain(int bus,std::uint64_t epoch, + std::uint64_t revision,float gain) noexcept { + if(independent_.active()||routeReconfiguring_.load(std::memory_order_acquire)|| + diagnosticRoute_.load(std::memory_order_acquire) + !=armix::diagnostics::Route::normal|| + !directFence_.permitted()||savedDirectSetup_||savedLiveSetup_) + return false; + return dryRoutingLab_.setAuxBusGain(bus,epoch,revision,gain); + } bool setDryRoutingLabAuxSendGain(int source,int bus,std::uint64_t epoch, std::uint64_t revision,float gain) noexcept { if(independent_.active()||routeReconfiguring_.load(std::memory_order_acquire)|| diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index ad0c28261..fb0437c13 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -496,6 +496,26 @@ class LiveDryRoutingLab final { return true; } + // M1: an existing ENABLED AUX FX return has its own realtime master + // fader, applied after AUX inserts and before both MAIN and MONITOR. + // Only one GUI/control writer, never plugin/graph changes in the callback. + bool setAuxBusGain(int bus,std::uint64_t expectedEpoch, + std::uint64_t expectedRevision,float gain) noexcept { + if(bus<0||bus>=auxCount||!std::isfinite(gain)||gain<0.f||gain>4.f|| + !ready()||!hasExplicitRoute()||expectedEpoch!=epoch()|| + expectedRevision!=revision())return false; + auto auxes=acceptedRoute_.getProperty("auxes",juce::var()); + auto* arr=auxes.getArray(); + if(!arr||bus>=arr->size()||!(*arr)[bus].getProperty("enabled",false)) + return false; + if(!publisher_.updateActiveControl(expectedEpoch,expectedRevision, + [&](FxGraph& fx) noexcept {return fx.setAuxBusGain(bus,gain);})) + return false; + if(auto* obj=(*arr)[bus].getDynamicObject()) + obj->setProperty("gain",static_cast(gain)); + return true; + } + // Live, nonstructural FX power control; all guards bound to a real ACK. bool setFxBypass(int lane,int slot,std::uint64_t expectedEpoch, std::uint64_t expectedRevision,const juce::String& token, diff --git a/src/Main.cpp b/src/Main.cpp index 7ba2c19b8..10938bf68 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1348,6 +1348,31 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr "Existing CH1 FX Rack and Orbit stay bound to their original processors. " "Structural CH1 FX changes remain gated until the next production lifecycle milestone."); } + // M1 BUS MASTER: an acknowledged AUX return level is a live parameter, + // not an FX graph mutation. Positive native ACK is the UI authority. + if(action=="routingAuxBusGain") { + const int bus=static_cast(args.getProperty("bus",-1)); + const int requestId=static_cast(args.getProperty("requestId",0)); + const auto ep=args.getProperty("deviceEpoch",juce::var()); + const auto rv=args.getProperty("revision",juce::var()); + const bool numeric=value.isDouble()||value.isInt(); + const float gain=numeric?static_cast(static_cast(value)):-1.f; + const bool ok=!nativeShowBusy_&&!studioBackupBusy_&&!ep.isVoid()&&!rv.isVoid()&& + numeric&&requestId>0&&engine_.setDryRoutingLabAuxBusGain( + bus,static_cast(static_cast(ep)), + static_cast(static_cast(rv)),gain); + auto ack=std::make_unique(); + ack->setProperty("ok",ok); + ack->setProperty("bus",bus); + ack->setProperty("requestId",requestId); + ack->setProperty("gain",static_cast(gain)); + ack->setProperty("error",ok?juce::String(): + "AUX master rejected: device/route changed, bus disabled or invalid gain"); + ack->setProperty("state",engine_.status().getProperty("dryRoutingLab",{})); + if(browser_.loaded)browser_.emitEventIfBrowserIsVisible( + "arMixAuxBusGainAck",juce::var(ack.release())); + return; + } // M1 operator realtime PARAM: existing AUX POST gain changes while // audio is running. Structural sends remain guarded MUTE/APPLY. if(action=="routingAuxSendGain") { diff --git a/tests/mixer_io_operator_contract_test.mjs b/tests/mixer_io_operator_contract_test.mjs index 85fb52603..7f6187b9f 100644 --- a/tests/mixer_io_operator_contract_test.mjs +++ b/tests/mixer_io_operator_contract_test.mjs @@ -78,6 +78,29 @@ test('G3 is computed from authoritative PRE/POST native renderer, not a visual-o assert.doesNotMatch(css,/backdrop-filter\s*:|filter\s*:\s*blur/); }); +test('M1 AUX MASTER and selected-channel workflow share one native graph and ACK',()=>{ + const native=read('engine/core/PreparedMixerBlock.h'); + const graph=read('engine/core/LiveChannelFxGraph.h'); + const lab=read('src/LiveDryRoutingLab.h'); + const engine=read('src/LiveAudioEngine.h'); + const css=read('web/mixer-io.css'); + assert.match(native,/bool setAuxBusGain\(int bus,float gain\)/); + assert.match(native,/auxBusTarget_\[b\]\.load\(std::memory_order_acquire\)/); + assert.match(graph,/block_->setAuxBusGain\(bus,gain\)/); + assert.match(lab,/publisher_\.updateActiveControl\(expectedEpoch,expectedRevision/); + assert.match(engine,/setDryRoutingLabAuxBusGain/); + assert.match(main,/routingAuxBusGain/); + assert.match(monitor,/arMixAuxBusGainAck/); + assert.match(gui,/__arMixSetLiveAuxMasterGain/); + assert.match(gui,/arChannelSignalFlow/); + assert.match(gui,/refreshFocus\(s\)/); + assert.match(gui,/data-focus-step="source"/); + assert.match(gui,/data-focus-step="fx"/); + assert.match(gui,/data-focus-step="sends"/); + assert.match(gui,/data-focus-step="output"/); + assert.match(css,/\.arChannelSignalFlow/); + assert.doesNotMatch(css,/backdrop-filter\s*:|filter\s*:\s*blur/); +}); test('MS5/M1 Sends-on-Faders live POST gain uses native ACK; topology remains guarded',()=>{ const css=read('web/mixer-io.css'); assert.match(gui,/data-sof-bus/); diff --git a/tests/mixer_io_smoke.py b/tests/mixer_io_smoke.py index 870a4cee7..40ce2ffdc 100644 --- a/tests/mixer_io_smoke.py +++ b/tests/mixer_io_smoke.py @@ -22,6 +22,8 @@ async def main(): await page.goto((root/"web/index.html").as_uri()) assert await page.locator("#mixer .rack").count()==10 assert await page.locator("#mixer .arChannelBank").count()==10 + assert await page.locator('.arChannelSignalFlow [data-focus-step]').count()==4 + assert 'NO NATIVE ACK' in await page.locator('[data-focus-source]').inner_text() assert await page.locator("[data-mix-mode]").count()==3 status=await page.evaluate("""() => { const ch=Array.from({length:10},()=>({mode:'NONE',left:-1,right:-1,gain:.25,pan:0,main:true,mute:false,solo:false,fxId:''})); @@ -73,6 +75,12 @@ async def main(): return status; }""",status) assert "LIVE" in await page.locator('[data-strip="0"] .arBankStage').inner_text() + assert 'Microphone 1' in await page.locator('[data-focus-source]').inner_text() + assert 'MAIN' in await page.locator('[data-focus-out]').inner_text() + await page.locator('[data-focus-step="fx"]').click() + assert await page.locator('#mixer').get_attribute('data-io-mode')=='FX' + await page.locator('[data-focus-step="source"]').click() + assert await page.locator('#mixer').get_attribute('data-io-mode')=='ROUTE' # Physical SOURCE changes while output is ARMED must fail closed: # no silent MUTE, graph mutation, or fake LIVE acknowledgement. await page.evaluate("""status=>{ @@ -228,6 +236,37 @@ async def main(): return status; }""",status) assert "NATIVE ACK" in await page.locator('#arSendFeedback').inner_text() + # The AUX master is a separate native realtime parameter on the same + # prepared graph, after AUX VST3 and before BOTH physical sinks. + master=page.locator('[data-aux-master]') + assert await master.is_enabled() + await master.evaluate("(e)=>{e.value='-6';e.dispatchEvent(new Event('change',{bubbles:true}))}") + param=await page.evaluate("""()=>window.__armixTestActions.filter( + x=>x.name==='arMixAction'&&x.data.action==='routingAuxBusGain')""") + assert len(param)==1,param + assert param[0]['data']['bus']==0 and param[0]['data']['revision']==5,param + assert abs(param[0]['data']['value']-10**(-6/20))<.00001,param + assert status['dryRoutingLab']['acceptedRoute']['auxes'][0]['gain']==1 + status=await page.evaluate("""status=>{ + const d=status.dryRoutingLab; + d.acceptedRoute.auxes[0].gain=Math.pow(10,-6/20); + window.__armixTestEmit('arMixAuxBusGainAck',{ + ok:true,bus:0,requestId:1,gain:d.acceptedRoute.auxes[0].gain,state:d}); + window.__armixTestEmit('arMixStatus',status); + return status; + }""",status) + assert '-6.0' in await page.locator('[data-aux-master-read]').inner_text() + assert await page.evaluate("""()=>window.__armixTestActions.filter( + x=>x.name==='arMixAction'&&x.data.action==='routingDryApply').length""")==2 + # Return AUX master to unity for the remaining legacy G3 tests. + await master.evaluate("(e)=>{e.value='0';e.dispatchEvent(new Event('change',{bubbles:true}))}") + status=await page.evaluate("""status=>{ + const d=status.dryRoutingLab;d.acceptedRoute.auxes[0].gain=1; + window.__armixTestEmit('arMixAuxBusGainAck',{ + ok:true,bus:0,requestId:2,gain:1,state:d}); + window.__armixTestEmit('arMixStatus',status); + return status; + }""",status) assert await page.locator('#mixer [data-strip="0"] .rack .insert-slot').count()==6 # MS5 operator journey: select one real AUX and flip visible channel # faders to POST sends without moving MAIN faders or remounting FX. diff --git a/tests/mixer_routing_plan_test.cpp b/tests/mixer_routing_plan_test.cpp index a2f3ea704..30b77b98f 100644 --- a/tests/mixer_routing_plan_test.cpp +++ b/tests/mixer_routing_plan_test.cpp @@ -488,7 +488,67 @@ static void verifyRealtimeAuxPostGainWithoutGraphRebuild() { assert(close(l[63],0.f)); } + +static void verifyRealtimeAuxMasterPcmBothOutputs() { + using namespace armix::mixer; + constexpr std::array pins{0,1}; + ChannelRoutingConfig routing; + routing.stripsAndMaster.strips[0]= + {SourceMode::mono,0,-1,1.f,0.f,false,false}; + SendRequest sends; + sends.toMaster[0]=false; + AuxBusRequest aux; + aux.buses[0]={true,true,false,1.f}; + aux.count=1; + aux.sends[0]={0,0,SendTap::postFader,.25f,0.f,true}; + PreparedRenderGraph graph; + RenderError error; + assert(PreparedRenderGraph::compile(routing,pins,sends,graph,error,aux)); + PreparedMixerBlock block(graph,64); + RealtimeStripControls controls; + assert(controls.set(0,1.f,0.f,true,false,false)); + std::array mic{},silence{},left{},right{},monitorL{},monitorR{}; + mic.fill(.8f); + const float* inputs[]={mic.data(),silence.data()}; + std::array monitor{}; + monitor[stripCount]=.5f; + const auto noFx=[](int,float*,float*,int) noexcept {}; + const auto render=[&]{ + return block.process(inputs,2,left.data(),right.data(),64,noFx, + nullptr,&controls,&monitor,monitorL.data(),monitorR.data()); + }; + const float initial=.8f*.7071067811865475f*.25f; + assert(render()); + assert(close(left[0],initial) && close(right[63],initial)); + assert(close(monitorL[63],initial*.5f)); + assert(close(block.auxBusGain(0),1.f)); + assert(block.setAuxBusGain(0,2.f)); + assert(render()); + assert(left[0]>initial && left[0]0.f && close(left[63],0.f)); + assert(close(monitorR[63],0.f)); + assert(render()); + assert(close(left[0],0.f)); + assert(!block.setAuxBusGain(-1,1.f)); + assert(!block.setAuxBusGain(1,1.f)); // nonexistent AUX2 + assert(!block.setAuxBusGain(0,-.01f)); + assert(!block.setAuxBusGain(0,4.1f)); + assert(!block.setAuxBusGain(0,std::numeric_limits::quiet_NaN())); + assert(close(block.auxBusGain(0),0.f)); + assert(close(block.plan().aux.buses[0].gain,1.f)); // topology immutable + // Legacy offline/no-live-control path still uses immutable compiled gain. + assert(block.process(inputs,2,left.data(),right.data(),64,noFx)); + assert(close(left[0],initial)); +} + int main() { + verifyRealtimeAuxMasterPcmBothOutputs(); verifyRealtimeAuxPostGainWithoutGraphRebuild(); verifyLegacyToDynamicProductionPcmParity(); verifyDynamicDualBusPcm(); diff --git a/web/mixer-io.css b/web/mixer-io.css index e6446082c..eef50e9a8 100644 --- a/web/mixer-io.css +++ b/web/mixer-io.css @@ -416,6 +416,58 @@ .arIOOverlay[data-active-tab="device"] .arIOWindow footer [data-io-internal], .arIOOverlay[data-active-tab="device"] .arIOWindow footer [data-io-advanced]{display:none!important} +/* M1 CHANNEL FOCUS: one thin native-ACK signal-flow header across the workbench, + never packed into RAIL3/sidebar. No blur, animations or per-pointer redraw. */ +#app .workbench .arChannelSignalFlow{ + box-sizing:border-box;flex:none;display:flex;align-items:stretch;gap:4px; + width:100%;height:35px;padding:3px 5px;min-width:0; + border-bottom:1px solid #425966;background:linear-gradient(#23353e,#15242d); + color:#d3e6eb;font:500 10px/1.2 "ArSonMix Inter","Segoe UI",sans-serif; +} +#app .workbench .arChannelSignalFlow[hidden]{display:none!important} +#app .arChannelSignalFlow .arFocusIndex{ + flex:0 0 51px;display:grid;place-items:center; + background:#14272f;border:1px solid #37535f;color:#b8edf0; + font:600 10px Consolas,monospace; +} +#app .arChannelSignalFlow button{ + flex:1 1 0;min-width:0;max-width:none;display:flex;align-items:center;gap:6px; + background:#10232d;border:1px solid #38505d;padding:0 7px; + color:#a2c4ce;font:600 9px "ArSonMix Inter","Segoe UI",sans-serif; + cursor:pointer;white-space:nowrap;text-align:left; +} +#app .arChannelSignalFlow button span{ + flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis; + white-space:nowrap;color:#e1ebef;font:500 9px Consolas,monospace; +} +#app .arChannelSignalFlow[data-native-state="unverified"] button span{ + color:#baa88c; +} +#app .arChannelSignalFlow button:hover{background:#203b48;border-color:#4c8894} +#app .arChannelSignalFlow button:focus-visible{ + outline:2px solid #81dfe5;outline-offset:-2px; +} +/* Existing MS5 rail lives in a strict two-column grid. AUX MASTER occupies one + additional short row, preserving the existing mode buttons and RAIL3. */ +#app .left-rail .arSofControls .arAuxMasterInline{ + grid-column:1/-1;display:flex;align-items:center;gap:5px;min-width:0; + height:29px;padding:0 5px;background:#0e2530;border:1px solid #3d6676; + color:#a9d5de;font:550 8px "ArSonMix Inter","Segoe UI",sans-serif; +} +#app .left-rail .arAuxMasterInline input{ + flex:1 1 auto;width:36px;min-width:0;accent-color:#52b5c2; +} +#app .left-rail .arAuxMasterInline input:disabled{opacity:.38} +#app .left-rail .arAuxMasterInline output{ + flex:0 0 43px;text-align:right;color:#d5edf2; + font:9px Consolas,monospace;white-space:nowrap; +} +@media(max-width:1080px){ + #app .arChannelSignalFlow button{padding:0 4px;gap:3px;font-size:8px} + #app .arChannelSignalFlow button span{font-size:8px} + #app .arChannelSignalFlow .arFocusIndex{flex-basis:45px} +} + /* DEVICE1 — compact, hardware-truthful, one native device manager. No blur, animated glow or per-pointer layout work. */ diff --git a/web/mixer-io.js b/web/mixer-io.js index dd152f17e..f53b1e8d8 100644 --- a/web/mixer-io.js +++ b/web/mixer-io.js @@ -36,10 +36,68 @@ const toolbar=node('div','arMixerBankBar'); toolbar.innerHTML='
NO HARDWARE · PREVIEW
'; host.insertBefore(toolbar,mixer); + // One genuinely selected-channel journey, NOT another DSP or source registry. + // Four compact steps show ACKNOWLEDGED state, never stage a hidden graph. + const focusFlow=node('div','arChannelSignalFlow'); + focusFlow.setAttribute('aria-label','Selected live mixer channel signal flow'); + focusFlow.innerHTML='CH 01'+ + ''+ + ''+ + ''+ + ''; + // mixer-layout.js moves the whole toolbar into the LEFT RAIL. + // The selected channel overview is therefore a separate compact WORKBENCH + // row; placing it in toolbar would jam 4 steps into 168px of sidebar. + host.insertBefore(focusFlow,mixer); + let focusIndex=0,focusSignature=''; + const focusSet=(q,value)=>{ + const target=focusFlow.querySelector(q); + if(target&&target.textContent!==value)target.textContent=value; + }; + const selectedInputChannel=()=>{ + const chosen=mixer.querySelector('.strip[data-strip].selected'); + const i=chosen?Number(chosen.dataset.strip):focusIndex; + return Number.isInteger(i)&&i>=0&&i<10?i:0; + }; + function refreshFocus(s){ + const i=selectedInputChannel(),r=s.acceptedRoute?.channels?.[i]; + const ack=!!s.ready&&!!s.active&&!!r&&Number(s.acceptedRoute.deviceEpoch)===Number(s.epoch); + const driverPins=portList(s); + const names=id=>driverPins.find(p=>p.port===id)?.label; + let source='UNPATCHED'; + if(ack&&r.mode==='MONO') + source=names(r.left)||'PIN '+(Number(r.left)+1)+' · VERIFY'; + if(ack&&r.mode==='STEREO') + source=(names(r.left)||'L'+(Number(r.left)+1))+' / '+ + (names(r.right)||'R'+(Number(r.right)+1)); + if(ack&&r.mode==='BUS')source='INTERNAL BUS'; + if(!ack)source='NO NATIVE ACK'; + const routed=ack?lastStatus.dryRoutingLab?.fxInstances?.[i]:null; + const inserts=Array.isArray(routed)?routed.length:0; + const legacy=i===0?Math.max(0,Number(lastStatus.chainCount)||0):0; + const fx=(inserts+legacy)+' VST3'+(legacy&&inserts?' · SPLIT OWNERS':''); + const sends=ack&&Array.isArray(s.acceptedRoute.sends)? + s.acceptedRoute.sends.filter(x=>x.from===i&&x.to>=10&&x.to<14):[]; + const sendsText=sends.length?sends.map(x=>'AUX'+(x.to-9)+' '+x.tap).join(' / '):'NO AUX'; + const outputs=s.mainOutputs?.length===2?s.mainOutputs:[]; + const dest=ack&&r.main&&outputs.length===2? + 'MAIN HW '+(outputs[0]+1)+'/'+(outputs[1]+1): + ack&&r.main?'MAIN · NO PIN':ack?'SEND ONLY':'NO OUTPUT'; + const sig=JSON.stringify([i,source,fx,sendsText,dest,ack,s.pending]); + if(sig!==focusSignature){ + focusIndex=i;focusSignature=sig; + focusSet('[data-focus-channel]','CH '+String(i+1).padStart(2,'0')); + focusSet('[data-focus-source]',source); + focusSet('[data-focus-fx]',fx); + focusSet('[data-focus-sends]',sendsText); + focusSet('[data-focus-out]',dest); + focusFlow.dataset.nativeState=ack&&!s.pending?'accepted':'unverified'; + } + } // MS5: explicit Sends-on-Faders control, scoped to a single real AUX return. // MAIN fader DOM and all audio controls remain resident and unmodified. const sofControls=node('div','arSofControls'); - sofControls.innerHTML=''; + sofControls.innerHTML=''; sofControls.hidden=true;toolbar.appendChild(sofControls); const overlay=node('div','arIOOverlay'); overlay.id='arIOOverlay';overlay.hidden=true; @@ -157,6 +215,18 @@ sofControls.hidden=mode!=='SENDS'; const selector=sofControls.querySelector('[data-sof-bus]'); const toggle=sofControls.querySelector('[data-sof-toggle]'); + const auxLevel=sofControls.querySelector('[data-aux-master]'); + const auxRead=sofControls.querySelector('[data-aux-master-read]'); + const busSelected=Number(selector.value); + const acceptedBus=s.acceptedRoute?.auxes?.[busSelected]; + const enabled=!!acceptedBus?.enabled&&!s.pending&&s.ready&&isNative(); + const currentGain=Number(acceptedBus?.gain); + const db=Number.isFinite(currentGain)&¤tGain>0 + ?Math.max(-60,Math.min(6,20*Math.log10(currentGain))):-60; + auxLevel.disabled=!enabled; + if(document.activeElement!==auxLevel)auxLevel.value=String(db); + const readText=enabled?(db<=-60?'OFF':db.toFixed(1)+' dB'):'AUX OFF'; + if(auxRead.textContent!==readText)auxRead.textContent=readText; if(sofBus>=0&&(!isNative()||!s.ready||!s.active||s.epoch!==sofEpoch)){ leaveSof();sofStatus('SEND FADERS EXITED · DEVICE CHANGED'); } @@ -368,6 +438,7 @@ if(!overlay.hidden)refreshIO(); if(!sendEditor.hidden)drawSendEditor(); sofRefresh(s); + refreshFocus(s); } // IO-MATRIX: reusable presentation of the existing native 10-channel graph. @@ -972,6 +1043,50 @@ lastSignature='';refresh(); } },true); + // AUX return fader updates only after release/keyboard change; native + // DSP ramps it inside one callback. Never touch the MAIN fader or rack. + sofControls.addEventListener('change',event=>{ + if(event.target.matches('[data-sof-bus]')){sofMessage='';refresh();return;} + if(!event.target.matches('[data-aux-master]'))return; + const bus=Number(sofControls.querySelector('[data-sof-bus]').value); + const db=Number(event.target.value); + const gain=db<=-60?0:Math.pow(10,db/20); + const answer=window.__arMixSetLiveAuxMasterGain?.(bus,+gain.toFixed(7)); + sofMessage=answer?.ok?'AUX MASTER · WAIT NATIVE ACK': + answer?.error||'AUX master unavailable'; + refresh(); + }); + // Channel focus is intentionally lightweight: point into existing MIX + // modes and native controller, never create a parallel mixer/FX model. + focusFlow.addEventListener('click',event=>{ + const button=event.target.closest('[data-focus-step]'); + if(!button)return; + event.preventDefault(); + const index=selectedInputChannel(); + const strip=mixer.querySelector('[data-strip="'+index+'"]'); + const step=button.dataset.focusStep; + if(step==='source'){ + if(!route().ready)openIO('device'); + else { + setMode('ROUTE'); + strip?.querySelector('.arBankSource')?.focus(); + } + } else if(step==='fx'){ + setMode('FX'); + if(typeof chooseChannel==='function')chooseChannel(index); + strip?.querySelector('.rack')?.scrollIntoView?.({block:'nearest',inline:'nearest'}); + } else if(step==='sends'){ + setMode('SENDS'); + const sends=route().acceptedRoute?.sends||[]; + const found=sends.find(x=>x.from===index&&x.to>=10&&x.to<14); + editSend(index,found?found.to-10:0,button); + } else if(step==='output')openIO('outputs',index); + }); + document.addEventListener('click',event=>{ + if(event.target.closest?.('#arChannelFocus,[data-focus-step]'))return; + const strip=event.target.closest?.('.strip[data-strip],[data-choose],[data-chanselect]'); + if(strip)refreshFocus(route()); + }); // The legacy native VST3 bridge registers document capture before this module. // Window capture intercepts only AUDIO SETUP, without changing FX/Orbit ownership. window.addEventListener('click',e=>{ @@ -1112,8 +1227,13 @@ if(!sendEditor.hidden){closeSendEditor();e.stopImmediatePropagation();} else if(!overlay.hidden){closeIO();e.stopImmediatePropagation();} },true); - const observer=new MutationObserver(records=>{if(records.some(r=>r.type==='childList'))refresh();}); - observer.observe(mixer,{childList:true}); + const observer=new MutationObserver(records=>{ + if(records.some(r=>r.type==='childList'))refresh(); + if(records.some(r=>r.attributeName==='class')) + focusFlow.hidden=mixer.classList.contains('hidden'); + }); + observer.observe(mixer,{childList:true,attributes:true,attributeFilter:['class']}); + focusFlow.hidden=mixer.classList.contains('hidden'); backend?.addEventListener?.('arMixStatus',d=>{ lastStatus=d; // 12Hz native telemetry: update only when topology, epoch or safety changes. @@ -1153,6 +1273,12 @@ refresh(); }); window.addEventListener('arMixRoutingDraftChanged',()=>{lastSignature='';refresh();}); + window.addEventListener('arMixAuxMasterGainResult',event=>{ + const ack=event.detail||{}; + sofMessage=ack.ok?'AUX '+(ack.bus+1)+' MASTER · LIVE NATIVE ACK': + 'AUX MASTER REJECTED · '+(ack.error||'Stale device'); + refresh(); + }); window.addEventListener('arMixAuxSendGainResult',event=>{ const a=event.detail||{}; if(sofBus>=0&&a.bus===sofBus){ diff --git a/web/monitor.js b/web/monitor.js index 598fab221..55a12b7ea 100644 --- a/web/monitor.js +++ b/web/monitor.js @@ -1227,6 +1227,46 @@ error:matched?"":String(ack?.error||"Native route changed; gain NOT applied")} })); }); + // M1 AUX MASTER: one existing enabled FX-return fader, ACK and epoch bound. + // Structural AUX enabling/mute/toMaster/FX replacement still uses APPLY. + let auxMasterRequestId=1; + const auxMasterPending=new Map(); + window.__arMixSetLiveAuxMasterGain=(bus,value)=>{ + const d=state.dryRoutingLab||{},gain=Number(value); + if(!Number.isInteger(bus)||bus<0||bus>=4||!Number.isFinite(gain)|| + gain<0||gain>4)return {ok:false,error:"Invalid AUX master gain."}; + if(!d.active||!d.ready||!d.acceptedRoute|| + patchPending||draftEpoch!==Number(d.epoch)||mixerDraftActive|| + rackFxDraft||!Array.isArray(d.acceptedRoute.auxes)|| + !d.acceptedRoute.auxes[bus]?.enabled) + return {ok:false,error:"AUX master unavailable: finish DRAFT and APPLY the enabled bus first."}; + if(auxMasterPending.has(bus)) + return {ok:false,error:"Wait for previous AUX master native ACK."}; + const requestId=auxMasterRequestId++; + auxMasterPending.set(bus,requestId); + api.emitEvent("arMixAction",{action:"routingAuxBusGain", + bus,requestId,deviceEpoch:Number(d.epoch),revision:Number(d.revision), + value:gain}); + return {ok:true,pending:true,message:"AUX MASTER PENDING · NATIVE ACK"}; + }; + api.addEventListener("arMixAuxBusGainAck",ack=>{ + const bus=Number(ack?.bus),id=Number(ack?.requestId); + if(auxMasterPending.get(bus)!==id)return; + auxMasterPending.delete(bus); + const next=ack?.state||{},now=state.dryRoutingLab||{}; + const ok=ack?.ok===true&&next.epoch===now.epoch&& + next.revision===now.revision&&next.acceptedRoute&&!patchPending&& + !mixerDraftActive; + if(ok){ + state.dryRoutingLab=next; + hydrateAcceptedRoute(); + drawAux();drawAuxSendMatrix(); + window.dispatchEvent(new Event("arMixRoutingDraftChanged")); + } + window.dispatchEvent(new CustomEvent("arMixAuxMasterGainResult",{ + detail:{ok:!!ok,bus,gain:Number(ack?.gain), + error:ok?"":String(ack?.error||"AUX native ACK stale; refresh device")}})); + }); window.__arMixStageAuxReturnEdit=(bus,field,value)=>{ const fault=sendEditGate(0,bus); if(fault)return {ok:false,error:fault};