From ff4136f1188a6d508bf41bcc02dd298b58ac414a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 19:56:48 +0700 Subject: [PATCH 01/20] feat(P1I): native ten-lane realtime fader/PAN/MUTE/SOLO control plane without VST3 rebuild --- engine/core/LiveChannelFxGraph.h | 7 +- engine/core/PreparedMixerBlock.h | 100 +++++++++++++++++++++++++-- engine/core/RealtimeRoutePublisher.h | 11 +++ src/LiveDryRoutingLab.h | 67 +++++++++++++++++- 4 files changed, 179 insertions(+), 6 deletions(-) diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index cef8638e2..f659a3982 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -35,6 +35,10 @@ class LiveChannelFxGraph final { int capacity() const noexcept{return block_?block_->capacity():0;} int maxFramesPerPlugin() const noexcept {return pluginQuantum_;} int activeInserts() const noexcept{return activeInserts_;} + bool setStripControl(int channel,float gain,float pan, + bool mono,bool mute,bool solo) noexcept { + return controls_.set(channel,gain,pan,mono,mute,solo); + } const juce::String& insertName(int strip) const noexcept { static const juce::String empty; return strip>=0&&stripprocessBlock(buffer,midi); }; - return block_->process(physical,inputs,left,right,frames,channelFx,levels); + return block_->process(physical,inputs,left,right,frames,channelFx,levels,&controls_); } private: std::unique_ptr block_; + RealtimeStripControls controls_ {}; FxBank processors_ {}; std::array midi_ {}; std::array names_ {}; diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 127978f37..93a8eeefc 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -2,6 +2,7 @@ #pragma once #include "ChannelSendPlan.h" #include +#include #include #include #include @@ -107,6 +108,36 @@ struct PreparedRenderGraph final { } }; +// P1I: A single native parameter plane, updated only by the control thread. +// All coefficients are calculated on control thread. Callback reads atomics +// once per block and interpolates into fixed strip scratch buffers. The +// immutable topology (DAG/physical ports/FX ownership) is never rebuilt for +// ordinary fader, pan, MUTE, or SOLO changes. +class RealtimeStripControls final { +public: + struct Target { + std::atomic left{1.f},right{1.f}; + std::atomic mute{false},solo{false}; + }; + bool set(int strip,float gain,float pan,bool mono,bool mute,bool solo) noexcept { + if(strip<0||strip>=stripCount||!std::isfinite(gain)||gain<0.f||gain>4.f|| + !std::isfinite(pan)||pan< -1.f||pan>1.f)return false; + const float left=mono?gain*std::sqrt(0.5f*(1.f-pan)): + gain*(pan>0.f?1.f-pan:1.f); + const float right=mono?gain*std::sqrt(0.5f*(1.f+pan)): + gain*(pan<0.f?1.f+pan:1.f); + auto& c=targets_[strip]; + c.left.store(left,std::memory_order_relaxed); + c.right.store(right,std::memory_order_relaxed); + c.mute.store(mute,std::memory_order_relaxed); + c.solo.store(solo,std::memory_order_relaxed); + return true; + } + const Target& at(int strip) const noexcept{return targets_[strip];} +private: + std::array targets_{}; +}; + struct RenderLevels final { std::array channelPeak {}; float masterPeakL = 0.f, masterPeakR = 0.f; @@ -150,7 +181,8 @@ class PreparedMixerBlock final { template bool process(const float* const* physical, int callbackInputCount, float* outputL, float* outputR, int frames, Fx&& processFx, - RenderLevels* observed=nullptr) noexcept { + RenderLevels* observed=nullptr, + const RealtimeStripControls* live=nullptr) noexcept { static_assert(std::is_nothrow_invocable_v, "DSP hook must be noexcept and realtime bounded"); if (observed) *observed={}; @@ -167,6 +199,10 @@ class PreparedMixerBlock final { std::fill_n(masterL_,frames,0.f); std::fill_n(masterR_,frames,0.f); + bool anySolo=false; + if(live)for(int strip=0;stripat(strip).solo.load(std::memory_order_relaxed) && + !live->at(strip).mute.load(std::memory_order_relaxed); for(int k=0;kat(strip); + routeAudible=!target.mute.load(std::memory_order_relaxed); + if(routeAudible&&anySolo) { + routeAudible=false; + for(int j=0;jat(j); + if(s.solo.load(std::memory_order_relaxed) && + !s.mute.load(std::memory_order_relaxed) && + (j==strip||graph.sends.upstreamOf(strip,j)|| + graph.sends.upstreamOf(j,strip))) { + routeAudible=true;break; + } + } + } + gl=target.left.load(std::memory_order_relaxed); + gr=target.right.load(std::memory_order_relaxed); + // A MUTE or SOLO transition must also silence PRE sends. + // Smooth the pre-send source gate over <=64 samples; it does + // not create/restart FX, drivers, nodes or send topology. + const float targetGate=routeAudible?1.f:0.f; + if(!rampPrimed_[strip]) { + preGate_[strip]=targetGate; + lastGainL_[strip]=gl; + lastGainR_[strip]=gr; + rampPrimed_[strip]=true; + } + const int ramp=std::min(frames,64); + const float dGate=(targetGate-preGate_[strip])/ramp; + float gate=preGate_[strip]; + for(int f=0;f backing_; // ALLOCATED BEFORE callback, never resized std::array left_{}; std::array right_{}; + std::array preGate_{},lastGainL_{},lastGainR_{}; + std::array rampPrimed_{}; float* masterL_=nullptr; float* masterR_=nullptr; }; diff --git a/engine/core/RealtimeRoutePublisher.h b/engine/core/RealtimeRoutePublisher.h index 2e2c7cc4f..c9781ad0e 100644 --- a/engine/core/RealtimeRoutePublisher.h +++ b/engine/core/RealtimeRoutePublisher.h @@ -119,6 +119,17 @@ class RealtimeRoutePublisher final { retiredCount_=0; return true; } + // Only the single control-thread writer calls this. The editor MUST + // mutate atomic runtime parameters, never processor lifetime or topology. + // The owned snapshot is stable on the writer thread; RT reads atomics. + template + bool updateActiveControl(std::uint64_t epoch,std::uint64_t expectedRevision, + Update&& update) noexcept { + if(!owned_||!owned_->prepared||owned_->deviceEpoch!=epoch|| + owned_->graphRevision!=expectedRevision||revision_!=expectedRevision) + return false; + return update(*owned_->prepared); + } [[nodiscard]] ReadLease acquire() noexcept {return ReadLease(*this);} std::uint64_t lastRevision() const noexcept {return revision_;} // CONTROL std::size_t pendingRetirements() const noexcept {return retiredCount_;} // CONTROL diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index ce596d18b..daecfd885 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -33,6 +33,10 @@ class LiveDryRoutingLab final { int uid=0; }; static constexpr int count=armix::mixer::stripCount; + struct ChannelEdit { + float linear=1.f, pan=0.f; + bool mute=false, solo=false, mono=false; + }; // JUCE calls aboutToStart after configuring the input/output device. // One device session gets a new epoch; stored route cannot survive it. @@ -116,9 +120,17 @@ class LiveDryRoutingLab final { command,decoded,validationError))return validationError; const auto& cfg=decoded.channels; const auto& sends=decoded.sends; + // All physical and BUS nodes stay scheduled for realtime SOLO/MUTE; + // only the runtime parameter plane controls audibility thereafter. + // This prevents re-instantiating VST3 when a musician moves a fader. + auto topology=cfg; + for(auto& strip:topology.stripsAndMaster.strips) { + strip.mute=false; + strip.solo=false; + } Plan plan; armix::mixer::RenderError error; - if(!Plan::compile(cfg, + if(!Plan::compile(topology, {physicalPorts.data(),static_cast(countNow)}, sends,plan,error)) return "Invalid physical routing (inactive port, format or mapping)"; @@ -131,6 +143,16 @@ class LiveDryRoutingLab final { juce::jlimit(32,Block::hardFrameLimit,deviceFrames)); if(!next->prepared || next->prepared->capacity()==0) return "Cannot allocate routing workspace"; + std::array proposed{}; + for(int i=0;iprepared->setStripControl(i,proposed[i].linear, + proposed[i].pan,proposed[i].mono, + proposed[i].mute,proposed[i].solo)) + return "Cannot prepare native channel controls"; + } // Every VST3 is instantiated and prepared on the control thread. // A graph has private processor instances: a retiring snapshot can // NEVER share a processBlock call with a newly published snapshot. @@ -190,6 +212,7 @@ class LiveDryRoutingLab final { enabled_.store(true,std::memory_order_release); sendCount_.store(sends.count,std::memory_order_relaxed); fxCount_.store(insertCount,std::memory_order_relaxed); + channelEdits_=proposed; // control thread SSOT for this route revision return {}; case Publisher::Result::staleDevice: return "Device epoch changed during preparation"; @@ -202,6 +225,36 @@ class LiveDryRoutingLab final { } } + // Native live control path. Only the JUCE message thread writes. No + // graph recompilation, VST3 instantiation or callback detach. + // Browser carries the exact acknowledged route token to reject stale + // events following hotplug, reload or another user's APPLY transaction. + bool setChannelParameter(int strip,std::uint64_t expectedEpoch, + std::uint64_t expectedRevision, + const juce::String& name,float value) noexcept { + if(strip<0||strip>=count || !ready() || + expectedEpoch!=epoch() || expectedRevision!=revision())return false; + auto updated=channelEdits_[strip]; + if(name=="faderDb") { + if(!std::isfinite(value)||value< -60.f||value>10.f)return false; + updated.linear=value<= -60.f?0.f:std::pow(10.f,value/20.f); + }else if(name=="pan") { + if(!std::isfinite(value)||value< -100.f||value>100.f)return false; + updated.pan=value*.01f; + }else if(name=="mute"||name=="solo") { + if(value!=0.f && value!=1.f)return false; + if(name=="mute")updated.mute=value>0.5f; + else updated.solo=value>0.5f; + }else return false; + if(!publisher_.updateActiveControl(expectedEpoch,expectedRevision, + [&](FxGraph& fx) noexcept { + return fx.setStripControl(strip,updated.linear,updated.pan, + updated.mono,updated.mute,updated.solo); + }))return false; + channelEdits_[strip]=updated; + return true; + } + void disable() noexcept { enabled_.store(false,std::memory_order_release); publishedEpoch_.store(0,std::memory_order_release); @@ -328,6 +381,17 @@ class LiveDryRoutingLab final { out->setProperty("peakR",peakR_.load(std::memory_order_relaxed)); out->setProperty("sendCount",sendCount_.load(std::memory_order_relaxed)); out->setProperty("fxCount",fxCount_.load(std::memory_order_relaxed)); + juce::Array controls; + for(const auto& state:channelEdits_) { + auto c=std::make_unique(); + const float db=state.linear>0.f ? 20.f*std::log10(state.linear) : -60.f; + c->setProperty("db",db); + c->setProperty("pan",state.pan*100.f); + c->setProperty("mute",state.mute); + c->setProperty("solo",state.solo); + controls.add(juce::var(c.release())); + } + out->setProperty("channelControls",juce::var(controls)); juce::Array levels; for(const auto& p:channelPeaks_)levels.add(p.load(std::memory_order_relaxed)); out->setProperty("channelPeaks",juce::var(levels)); @@ -364,6 +428,7 @@ class LiveDryRoutingLab final { } private: Publisher publisher_; + std::array channelEdits_{}; // JUCE message thread only // All data shared between JUCE device lifecycle and GUI/control reads // are atomic; the callback never enumerates masks or channel names. std::array,armix::device::LiveInputPortRegistry::limit> enabledPorts_{}; From f6c044bcd52be3b9c91ea894af570c432d69da47 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 19:59:25 +0700 Subject: [PATCH 02/20] fix(P1I): initialize native atomic FX controls from compiled DSP coefficients for P1H compatibility --- engine/core/PreparedMixerBlock.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 93a8eeefc..a27c49997 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -133,6 +133,10 @@ class RealtimeStripControls final { c.solo.store(solo,std::memory_order_relaxed); return true; } + void setPreparedCoefficients(int strip,float left,float right) noexcept { + targets_[strip].left.store(left,std::memory_order_relaxed); + targets_[strip].right.store(right,std::memory_order_relaxed); + } const Target& at(int strip) const noexcept{return targets_[strip];} private: std::array targets_{}; From 8f54e4b9e8324d59ad204f055383e2a6b66b306e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 19:59:28 +0700 Subject: [PATCH 03/20] fix(P1I): initialize native atomic FX controls from compiled DSP coefficients for P1H compatibility --- engine/core/LiveChannelFxGraph.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index f659a3982..2076c0c88 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -22,7 +22,11 @@ class LiveChannelFxGraph final { explicit LiveChannelFxGraph(const PreparedRenderGraph& plan,int frames,int pluginQuantum=512) : block_(std::make_unique(plan,frames)), - pluginQuantum_(std::clamp(pluginQuantum,32,PreparedMixerBlock::hardFrameLimit)) {} + pluginQuantum_(std::clamp(pluginQuantum,32,PreparedMixerBlock::hardFrameLimit)) { + // P1H callers without live edits retain original compiled faders. + for(int i=0;i Date: Wed, 28 Oct 2026 19:59:45 +0700 Subject: [PATCH 04/20] feat(P1I): publish channel state and VST identities from one native routing graph --- src/LiveDryRoutingLab.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index daecfd885..1820fb021 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -213,6 +213,7 @@ class LiveDryRoutingLab final { sendCount_.store(sends.count,std::memory_order_relaxed); fxCount_.store(insertCount,std::memory_order_relaxed); channelEdits_=proposed; // control thread SSOT for this route revision + for(int i=0;isetProperty("peakR",peakR_.load(std::memory_order_relaxed)); out->setProperty("sendCount",sendCount_.load(std::memory_order_relaxed)); out->setProperty("fxCount",fxCount_.load(std::memory_order_relaxed)); + juce::Array controls,fxNames; + for(int i=0;i(); + obj->setProperty("db",st.linear>0.f?20.f*std::log10(st.linear):-60.f); + obj->setProperty("pan",st.pan*100.f); + obj->setProperty("mute",st.mute); + obj->setProperty("solo",st.solo); + controls.add(juce::var(obj.release())); + fxNames.add(channelFxNames_[i]); + } + out->setProperty("channelControls",juce::var(controls)); + out->setProperty("channelFxNames",juce::var(fxNames)); juce::Array controls; for(const auto& state:channelEdits_) { auto c=std::make_unique(); @@ -429,6 +443,7 @@ class LiveDryRoutingLab final { private: Publisher publisher_; std::array channelEdits_{}; // JUCE message thread only + std::array channelFxNames_{}; // status/control thread only // All data shared between JUCE device lifecycle and GUI/control reads // are atomic; the callback never enumerates masks or channel names. std::array,armix::device::LiveInputPortRegistry::limit> enabledPorts_{}; From 1631cd5232dfd61aa8217b6b4bf9039f46a8aca1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 19:59:48 +0700 Subject: [PATCH 05/20] feat(P1I): expose native 10-channel parameter bridge without device restart --- src/LiveAudioEngine.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 6eac9b80d..cf76a8fc0 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -841,6 +841,11 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback setOutputMuted(true); // never expose CH1 unexpectedly on STOP dryRoutingLab_.disable(); } + bool setDryRoutingLabParameter(int strip,std::uint64_t epoch, + std::uint64_t revision,const juce::String& parameter, + float value) noexcept { + return dryRoutingLab_.setChannelParameter(strip,epoch,revision,parameter,value); + } bool dryRoutingLabActive() const noexcept {return dryRoutingLab_.active();} void pollDryRoutingLab() noexcept {dryRoutingLab_.poll();} From 8fd7e953745560d2071fc22e9c908cb267b610d7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:00:07 +0700 Subject: [PATCH 06/20] feat(P1I): revision-fenced premium GUI to native 10-channel fader/PAN/MUTE/SOLO event contract --- src/Main.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Main.cpp b/src/Main.cpp index 946d9f50e..d22804a39 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -616,6 +616,23 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr const int channel = static_cast (args.getProperty ("channel", -2)); const auto value = args.getProperty ("value", {}); const auto valueNumber = static_cast (static_cast (value)); + // P1I: exact acknowledged epoch+revision fences all live strip edits. + if(engine_.dryRoutingLabActive() && channel>=1 && + channel<=LiveDryRoutingLab::count && + (name=="faderDb"||name=="pan"||name=="mute"||name=="solo")) { + const auto ep=args.getProperty("routeEpoch",juce::var()); + const auto rev=args.getProperty("routeRevision",juce::var()); + if(!ep.isVoid()&&!rev.isVoid() && + ((name=="mute"||name=="solo")?value.isBool(): + (value.isDouble()||value.isInt()))) { + const auto epoch=static_cast(static_cast(ep)); + const auto revision=static_cast(static_cast(rev)); + const float liveValue=value.isBool()?(bool(value)?1.f:0.f):valueNumber; + (void)engine_.setDryRoutingLabParameter(channel-1,epoch,revision, + name,liveValue); + } + return; + } if (name == "masterGain" && (value.isDouble() || value.isInt())) engine_.setMasterGainDb (valueNumber); // The app.js bridge converts strip index 0 to channel ID 1. From 27818f8769da4514a807187c899c6e7e0e8db3b0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:00:11 +0700 Subject: [PATCH 07/20] feat(P1I): revision-fenced premium GUI to native 10-channel fader/PAN/MUTE/SOLO event contract --- web/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/app.js b/web/app.js index 3584f3ded..bfd3e04d1 100644 --- a/web/app.js +++ b/web/app.js @@ -199,6 +199,11 @@ function updateMeterVisual(key,level,now){ function flushUiParams(){uiFlushScheduled=false;const bridge=window.__JUCE__?.backend;if(bridge?.emitEvent)for(const event of pendingUiParams.values())bridge.emitEvent('arMixParameter',event);pendingUiParams.clear()} function send(param,value,ch=currentChannel){ const event={channel:ch+1,parameter:param,value}; + // P1I: native routing token rejects UI gestures from stale device graphs. + const liveToken=window.__armixRouteToken; + if(ch>=0&&ch<10&&liveToken?.epoch>0&&liveToken?.revision>0){ + event.routeEpoch=liveToken.epoch;event.routeRevision=liveToken.revision; + } if(['faderDb','pan','trimDb','phonesDb','masterGain'].includes(param)){ pendingUiParams.set(`${ch}:${param}`,event); if(!uiFlushScheduled){uiFlushScheduled=true;requestAnimationFrame(flushUiParams)} From 24db2e6c34692bdf6c2d551271e18ad7a68f1106 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:00:38 +0700 Subject: [PATCH 08/20] feat(P1I): replace 10 preview strips with truthful native meters/FX and live DSP fader controls --- web/bridge.js | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/web/bridge.js b/web/bridge.js index b66f828aa..22d8ab825 100644 --- a/web/bridge.js +++ b/web/bridge.js @@ -198,6 +198,22 @@ } function renderRack(){ if(!workspace || currentTab()!=="FX RACK") return; + const lab=state.device?.dryRoutingLab; + if(lab?.active) { + const selected=typeof currentChannel==="number"?currentChannel:0; + const isMaster=typeof masterSelected!=="undefined"&&masterSelected; + const name=isMaster?"MASTER":(channels[selected]?.name||("CH "+(selected+1))); + const fx=isMaster?"":(lab.channelFxNames?.[selected]||""); + workspace.innerHTML='
'+ + cardHeader("Native FX · "+name,"One LIVE routing graph · one source of truth")+ + '

REAL VST3 PROCESSING

'+ + '

'+(isMaster?"MASTER inserts are not available in this mode": + fx?escapeHtml(fx)+" · independent native VST3 instance": + "DRY · no FX selected for this channel")+'

'+ + ''+ + '

Fader, PAN, MUTE and SOLO now change LIVE DSP without rebuilding VST3. Structural changes stay in Routing LAB.

'; + return; + } const selected=typeof currentChannel==="number"?currentChannel:0; const isMaster=typeof masterSelected!=="undefined"&&masterSelected; if(isMaster||selected!==0){ @@ -684,6 +700,21 @@ } const rack=track.querySelector(".rack"); if(!rack)return; + const lab=state.device?.dryRoutingLab; + if(lab?.active){ + const fx=lab.channelFxNames?.[i]||""; + const signature="live-lab-"+fx; + if(rack.dataset.nativeSig!==signature){ + rack.dataset.nativeSig=signature; + rack.innerHTML='
'; + } + track.removeAttribute("data-preview"); + rack.removeAttribute("data-preview"); + track.title="LIVE native routing · channel "+(i+1)+" · FX: "+(fx||"DRY"); + return; + } if(i!==0){ if(rack.dataset.nativeSig!=="empty-nonlive"){ rack.dataset.nativeSig="empty-nonlive"; @@ -739,6 +770,12 @@ // renderMaster() replaces descendants without replacing the mixer root. // Reapply the disabled native-only controls after each Master redraw. new MutationObserver(()=>syncView()).observe(mixer,{childList:true,subtree:true}); + // Opens the existing native Routing LAB, not a second mixer/editor. + document.addEventListener("click",event=>{ + if(!event.target.closest("[data-native-routing-lab]"))return; + event.preventDefault();event.stopImmediatePropagation(); + document.getElementById("arOpenRoutingLab")?.click(); + },true); const repaint=()=>{ if(currentTab()==="FX RACK") renderRack(); patchMixer(); @@ -1221,6 +1258,39 @@ // A restored GUI-only snapshot must not masquerade as a live native setting. function syncNativeMixerControls(d){ if(typeof channels==="undefined" || !channels[0])return; + const lab=d.dryRoutingLab; + if(lab?.active&&lab.ready&&Array.isArray(lab.channelControls)){ + const editing=Date.now().05){ + ch.fader=db;changed=true; + const f=document.querySelector('[data-fader="'+i+'"]'); + if(f){f.querySelector(".cap")?.style.setProperty("--pos",levelToTop(db)+"%");f.setAttribute("aria-valuenow",db.toFixed(1));} + const read=document.querySelector('[data-read="'+i+'"]'); + if(read)read.textContent=fmt(db); + } + if(!editing&&Number.isFinite(pan)&&ch.pan!==pan){ + ch.pan=pan;changed=true; + const p=document.querySelector('[data-pan="'+i+'"]'); + if(p){p.style.setProperty("--pan-frac",(pan+100)/200);p.style.setProperty("--pan-left",Math.min(.5,(pan+100)/200));p.style.setProperty("--pan-span",Math.abs(pan)/200);p.setAttribute("aria-valuenow",String(pan));} + const read=document.querySelector('[data-pan-read="'+i+'"]'); + if(read)read.textContent=panText(pan); + } + for(const key of ["mute","solo"])if(ch[key]!==!!st[key]){ + ch[key]=!!st[key];changed=true; + const b=document.querySelector('[data-'+key+'="'+i+'"]'); + if(b){b.classList.toggle("active",ch[key]);b.setAttribute("aria-pressed",String(ch[key]));} + } + } + if(changed)patchMixer(); + return; + } const channelDb=Number(d.channelDb), masterDb=Number(d.masterDb); const channelPan=Math.round(Number(d.channelPan)*100); if(!Number.isFinite(channelDb)||!Number.isFinite(masterDb)||!Number.isFinite(channelPan))return; @@ -1273,6 +1343,9 @@ backend.addEventListener("arMixStatus",d=>{ state.device=d; state.monitor=!!d.monitor; + const lab=d.dryRoutingLab; + window.__armixRouteToken=lab?.active&&lab.ready? + {epoch:Number(lab.epoch),revision:Number(lab.revision)}:null; syncNativeMixerControls(d); const b=document.querySelector('[data-native-action="monitor"]'); if(b){ @@ -1288,7 +1361,11 @@ // No fixed "-5 per telemetry callback" smoothing: its speed changed // with source cadence and fought the shared elapsed-time ballistics. // UI animation is capped at 29.4fps; native peaks remain unmodified. - paintMeter(document.querySelector('[data-meter="0"]'),percent(d.inputPeak)); + if(lab?.active&&lab.ready&&Array.isArray(lab.channelPeaks)){ + for(let i=0;i Date: Wed, 28 Oct 2026 20:01:31 +0700 Subject: [PATCH 09/20] test(P1I): sample-accurate ten-channel native fader/PAN, pre-send MUTE/SOLO closure, zero RT heap and epoch fencing --- tests/realtime_ten_channel_controls_test.cpp | 102 +++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 tests/realtime_ten_channel_controls_test.cpp diff --git a/tests/realtime_ten_channel_controls_test.cpp b/tests/realtime_ten_channel_controls_test.cpp new file mode 100644 index 000000000..dacb65ad2 --- /dev/null +++ b/tests/realtime_ten_channel_controls_test.cpp @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#include "../engine/core/PreparedMixerBlock.h" +#include "../engine/core/RealtimeRoutePublisher.h" +#if defined(NDEBUG) +#undef NDEBUG +#endif +#include +#include +#include +#include +#include +#include +using namespace armix::mixer; +static std::atomic allocations{0}; +void* operator new(std::size_t n) { + allocations.fetch_add(1,std::memory_order_relaxed); + if(auto* p=std::malloc(n==0?1:n))return p; + throw std::bad_alloc(); +} +void operator delete(void* p) noexcept {std::free(p);} +void operator delete(void* p,std::size_t) noexcept {std::free(p);} +static bool near(float a,float b) {return std::abs(a-b)<.0002f;} +int main() { + constexpr std::array physical{2,5,9}; + ChannelRoutingConfig cfg; + cfg.stripsAndMaster.strips[0]={SourceMode::mono,2,-1,1.f,0.f,false,false}; + cfg.stripsAndMaster.strips[1]={SourceMode::disconnected,-1,-1,1.f,0.f,false,false}; + cfg.stripsAndMaster.strips[2]={SourceMode::stereo,5,9,1.f,0.f,false,false}; + cfg.formats[1]=ChannelFormat::stereo; + SendRequest send; + send.toMaster[0]=false; + send.count=1; + send.sends[0]={0,1,SendTap::preFader,.5f,0.f,true}; + PreparedRenderGraph plan;RenderError error; + assert(PreparedRenderGraph::compile(cfg,physical,send,plan,error)); + assert(plan.scheduled[0]&&plan.scheduled[1]&&plan.scheduled[2]); + PreparedMixerBlock block(plan,128); + RealtimeStripControls controls; + assert(controls.set(0,1.f,0.f,true,false,false)); + assert(controls.set(1,1.f,0.f,false,false,false)); + assert(controls.set(2,1.f,0.f,false,false,false)); + assert(!controls.set(10,1.f,0.f,false,false,false)); + assert(!controls.set(1,1.f,20.f,false,false,false)); + const std::array inA=[] {std::arraya{};a.fill(.8f);return a;}(); + const std::array inB=[] {std::arraya{};a.fill(.2f);return a;}(); + const std::array inC=[] {std::arraya{};a.fill(.3f);return a;}(); + const float* inputs[]={inA.data(),inB.data(),inC.data()}; + std::array left{},right{}; + const auto noFx=[](int,float*,float*,int) noexcept {}; + auto run=[&] { + const auto before=allocations.load(std::memory_order_relaxed); + assert(block.process(inputs,3,left.data(),right.data(),128,noFx,nullptr,&controls)); + assert(allocations.load(std::memory_order_relaxed)==before); + return std::pair{left[127],right[127]}; + }; + auto [l,r]=run(); + // CH1 FX PRE .8*.5=.4, plus independent stereo CH3 .2/.3 + assert(near(l,.6f)&&near(r,.7f)); + assert(controls.set(0,0.f,0.f,true,false,false)); + std::tie(l,r)=run(); + assert(near(l,.6f)&&near(r,.7f)); // fader 0 does NOT kill PRE + assert(controls.set(0,0.f,0.f,true,true,false)); + std::tie(l,r)=run(); + assert(near(l,.2f)&&near(r,.3f)); // MUTE does kill PRE + assert(controls.set(0,0.f,0.f,true,false,true)); + std::tie(l,r)=run(); + assert(near(l,.4f)&&near(r,.4f)); // SOLO keeps CH1 and BUS descendant + assert(controls.set(0,0.f,0.f,true,false,false)); + assert(controls.set(2,1.f,-1.f,false,false,false)); + std::tie(l,r)=run(); + assert(near(l,.6f)&&near(r,.4f)); // stereo left balance only + assert(controls.set(1,0.f,0.f,false,false,false)); + std::tie(l,r)=run(); + assert(near(l,.2f)&&near(r,0.f)); // bus fader updates without graph build + assert(controls.set(1,1.f,0.f,false,false,false)); + std::tie(l,r)=run(); + assert(near(l,.6f)&&near(r,.4f)); + + // Revision/epoch-fenced control editing leaves unchanged topology and + // the same instance intact (one writer, no plugin publication/recreate). + struct LiveNode {RealtimeStripControls params;int identity=42;}; + using Pub=armix::rt::RealtimeRoutePublisher; + Pub publisher; + auto snap=std::make_unique(); + snap->deviceEpoch=4;snap->graphRevision=1; + snap->prepared=std::make_unique(); + assert(publisher.publish(std::move(snap),0,4)==Pub::Result::applied); + const auto update=[](LiveNode& x) noexcept { + return x.params.set(3,.5f,.2f,false,false,false); + }; + assert(!publisher.updateActiveControl(3,1,update)); // old device + assert(!publisher.updateActiveControl(4,0,update)); // old revision + assert(publisher.updateActiveControl(4,1,update)); + { + auto lease=publisher.acquire(); + assert(lease.get(4)&&lease.get(4)->prepared->identity==42); + assert(near(lease.get(4)->prepared->params.at(3).left.load(),.5f)); + } + publisher.unpublish(); + assert(!publisher.updateActiveControl(4,1,update)); + assert(publisher.pollRetirement()); +} From b5da2766d439abd4c384b8b0cffba98bf77b94fc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:01:58 +0700 Subject: [PATCH 10/20] build(P1I): add synthetic native 10CH live controls CTest --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a203506a..a21f3c2d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,9 @@ if(BUILD_TESTING) target_link_libraries(ARMixNativeMixerSessionTests PRIVATE juce::juce_audio_devices juce::juce_recommended_config_flags) target_compile_features(ARMixNativeMixerSessionTests PRIVATE cxx_std_20) add_test(NAME P1FPhysicalPortToNativeMasterAndEpochGuard COMMAND ARMixNativeMixerSessionTests) + add_executable(ARMixTenChannelLiveControlTests tests/realtime_ten_channel_controls_test.cpp) + target_compile_features(ARMixTenChannelLiveControlTests PRIVATE cxx_std_20) + add_test(NAME P1ITenChannelLiveFaderPanMuteSoloAndStableFx COMMAND ARMixTenChannelLiveControlTests) juce_add_console_app(ARMixLiveChannelFxTests PRODUCT_NAME "ArSonMix P1H Independent Channel FX Tests") target_sources(ARMixLiveChannelFxTests PRIVATE tests/live_channel_fx_graph_test.cpp engine/core/LiveChannelFxGraph.h) target_link_libraries(ARMixLiveChannelFxTests PRIVATE juce::juce_audio_processors juce::juce_recommended_config_flags) From dfe66a529a1559d23f7c56342758ed11afd53bda Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:02:01 +0700 Subject: [PATCH 11/20] ci(P1I): include no-rebuild control CTest in existing lean Windows workflow --- .github/workflows/p1-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 815234477..38099bd00 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -92,7 +92,7 @@ jobs: -DBUILD_TESTING=ON -DJUCE_WEBVIEW2_PACKAGE_LOCATION="${{ github.workspace }}/.deps" - name: Build executable and native RT tests - run: cmake --build build --config Release --target ARMixConsole ARMixFxOrderTests ARMixMixerRoutingTests ARMixChannelRoutingContractTests ARMixChannelSendTests ARMixPreparedMixerBlockTests ARMixLiveRoutingEpochTests ARMixJucePortMaskTests ARMixNativeMixerSessionTests ARMixNativeDrySendTests ARMixLiveChannelFxTests ARMixWorkspaceTests ARMixVaultTests ARMixBackupTests ARMixOrbitPhaseTests ARMixOrbitControlTests ARMixOrbitMotionTests ARMixOrbitDistanceTests ARMixFxBypassEnvelopeTests ARMixDearVrPolarPolicyTests ARMixRTTests ARMixPresetTests ARMixDiagnosticTests ARMixClockBridgeTests ARMixVirtualClockSoakTests ARMixCadenceTests ARMixCrackleWindowTests ARMixHealthTests ARMixPolicyTests ARMixPeriodEvidenceTests ARMixLifecycleTests ARMixWasapiProbeTests ARMixDualJuceTests ARMixClockSizingTests ARMixIndependentFormatTests ARMixRecoveryTests ARMixStreamWatchdogTests ARMixBridgeContinuityTests ARMixEndpointPolicyTests ARMixEndpointGuardTests ARMixAsioPolicyTests ARMixAsioBackendTests ARMixAsioRegistryIdentityTests ARMixDirectFenceTests --parallel 2 + run: cmake --build build --config Release --target ARMixConsole ARMixFxOrderTests ARMixMixerRoutingTests ARMixChannelRoutingContractTests ARMixChannelSendTests ARMixPreparedMixerBlockTests ARMixLiveRoutingEpochTests ARMixJucePortMaskTests ARMixNativeMixerSessionTests ARMixNativeDrySendTests ARMixLiveChannelFxTests ARMixTenChannelLiveControlTests ARMixWorkspaceTests ARMixVaultTests ARMixBackupTests ARMixOrbitPhaseTests ARMixOrbitControlTests ARMixOrbitMotionTests ARMixOrbitDistanceTests ARMixFxBypassEnvelopeTests ARMixDearVrPolarPolicyTests ARMixRTTests ARMixPresetTests ARMixDiagnosticTests ARMixClockBridgeTests ARMixVirtualClockSoakTests ARMixCadenceTests ARMixCrackleWindowTests ARMixHealthTests ARMixPolicyTests ARMixPeriodEvidenceTests ARMixLifecycleTests ARMixWasapiProbeTests ARMixDualJuceTests ARMixClockSizingTests ARMixIndependentFormatTests ARMixRecoveryTests ARMixStreamWatchdogTests ARMixBridgeContinuityTests ARMixEndpointPolicyTests ARMixEndpointGuardTests ARMixAsioPolicyTests ARMixAsioBackendTests ARMixAsioRegistryIdentityTests ARMixDirectFenceTests --parallel 2 - name: Test realtime control primitives run: ctest --test-dir build -C Release --output-on-failure - name: Package verified JUCE GUI for hardware FAT From c3e532f05c2efb581a9a029b07b6e9e7cbe02127 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:02:04 +0700 Subject: [PATCH 12/20] test(P1I): assert live GUI faders, FX identity, meters and epoch ACK --- tests/live_routing_ui_contract_test.mjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/live_routing_ui_contract_test.mjs b/tests/live_routing_ui_contract_test.mjs index ae80dac5f..bf606ef54 100644 --- a/tests/live_routing_ui_contract_test.mjs +++ b/tests/live_routing_ui_contract_test.mjs @@ -102,3 +102,24 @@ test("P1H independently instantiates and processes real JUCE FX in 10 native lan assert.match(ui,/fxChoices\(v\.fxId\)/); assert.match(ui,/result\.fxCount/); }); + +test("P1I binds premium 10CH console to REAL native RT graph without FX restart",()=>{ + const app=readFileSync(new URL("../web/app.js",import.meta.url),"utf8"); + const core=readFileSync(new URL("../engine/core/PreparedMixerBlock.h",import.meta.url),"utf8"); + const fx=readFileSync(new URL("../engine/core/LiveChannelFxGraph.h",import.meta.url),"utf8"); + const publisher=readFileSync(new URL("../engine/core/RealtimeRoutePublisher.h",import.meta.url),"utf8"); + assert.match(app,/routeEpoch=liveToken\.epoch/); + assert.match(app,/routeRevision=liveToken\.revision/); + assert.match(main,/setDryRoutingLabParameter/); + assert.match(lab,/setChannelParameter/); + assert.match(lab,/publisher_\.updateActiveControl/); + assert.match(lab,/channelControls/); + assert.match(lab,/channelFxNames/); + assert.match(core,/class RealtimeStripControls/); + assert.match(core,/graph\.sends\.upstreamOf/); + assert.match(fx,/&controls_/); + assert.match(publisher,/updateActiveControl/); + assert.match(bridge,/window\.__armixRouteToken/); + assert.match(bridge,/lab\.channelPeaks/); + assert.match(bridge,/data-native-routing-lab/); +}); From 5064a4e626efcb4d733f3598333b578648d83dea Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:02:18 +0700 Subject: [PATCH 13/20] build(P1I): include native test tuple and pair contracts explicitly --- tests/realtime_ten_channel_controls_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/realtime_ten_channel_controls_test.cpp b/tests/realtime_ten_channel_controls_test.cpp index dacb65ad2..8fc61b452 100644 --- a/tests/realtime_ten_channel_controls_test.cpp +++ b/tests/realtime_ten_channel_controls_test.cpp @@ -10,6 +10,8 @@ #include #include #include +#include +#include using namespace armix::mixer; static std::atomic allocations{0}; void* operator new(std::size_t n) { From c79bf1f47b04d547c35546c1ed6e3a9713a97cd9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:03:27 +0700 Subject: [PATCH 14/20] fix(P1I): repaint FX rack only on 10CH native LAB mode transitions --- web/bridge.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/bridge.js b/web/bridge.js index 22d8ab825..f5df81da9 100644 --- a/web/bridge.js +++ b/web/bridge.js @@ -1341,12 +1341,16 @@ if(changed)patchMixer(); } backend.addEventListener("arMixStatus",d=>{ + const labWasActive=!!state.device?.dryRoutingLab?.active; state.device=d; state.monitor=!!d.monitor; const lab=d.dryRoutingLab; window.__armixRouteToken=lab?.active&&lab.ready? {epoch:Number(lab.epoch),revision:Number(lab.revision)}:null; syncNativeMixerControls(d); + // UI can switch between CH1 production and 10CH DSP without replacing + // premium mixer geometry or rebuilding VST3 instances. + if(labWasActive!==!!lab?.active)repaint(); const b=document.querySelector('[data-native-action="monitor"]'); if(b){ const label=state.monitor?"MUTE OUTPUT":"UNMUTE OUTPUT"; From b12b4059f32873ac79d484ed7251a45f2d8c109f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:03:59 +0700 Subject: [PATCH 15/20] docs(P1I): complete native 10CH control milestone and hardware acceptance gates --- ..._UNIFIED_10CH_REALTIME_CONSOLE_20261028.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/P1I_UNIFIED_10CH_REALTIME_CONSOLE_20261028.md diff --git a/docs/P1I_UNIFIED_10CH_REALTIME_CONSOLE_20261028.md b/docs/P1I_UNIFIED_10CH_REALTIME_CONSOLE_20261028.md new file mode 100644 index 000000000..c5a271a95 --- /dev/null +++ b/docs/P1I_UNIFIED_10CH_REALTIME_CONSOLE_20261028.md @@ -0,0 +1,24 @@ +# P1I — Premium 10-Channel Console → REAL Native Realtime DSP + +Baseline: `main@758ec23e959305115d7fc4e23f7c9f73ddad43c8` (P1H, merged native multichannel VST3, GUI v0.8). This extends the existing `PreparedMixerBlock + LiveChannelFxGraph + RealtimeRoutePublisher` without a new audio callback, second engine, or redundant GUI layout. This is a major UI-to-engine correction, **not** full Studio One feature parity. + +## Delivered + +1. **10 real channel faders/PAN/MUTE/SOLO on the existing premium console** while the native Routing LAB is active and its real device graph has been approved. `web/app.js` passes the native route epoch+revision in control events; `Main.cpp` dispatches all channel IDs 1–10, rejecting old-token updates; `LiveDryRoutingLab` updates atomic per-strip controls of the *same* published graph. Legacy CH1 controls remain unchanged when LAB is stopped. Physical source selection, BUS layout and one stereo-compatible VST3 insert per channel still require the LAB structural APPLY. +2. **No VST3 re-instantiation or device restart for parameter-only edits.** Fader/PAN coefficient calculation occurs in control thread. Audio callback loads atomics once per block; per-channel 64-sample gain ramp suppresses zipper clicks. Independent PRE-send mute/solo gate also ramps, so MUTE suppresses sends without abruptly dropping all buses. Routing DAG, activated hardware port masks, published revision and actual vendor instances stay unchanged. SOLO uses precompiled DAG reachability to keep soloed lane's upstream/downstream path; unrelated channels become silent. No callback heap, JSON, locks, driver I/O or plugin lifecycle operation added. +3. **Truthful premium GUI telemetry.** When the 10CH graph is active, all ten strips display actual native post-fader peak data. CH2–10 no longer pretend to be disconnected, while any empty VST slot is labelled DRY/ROUTE instead of a fake running plugin. FX Rack displays the actual selected per-channel native FX name and opens the same Routing LAB for structural changes. Master FX remain explicitly unavailable; no invented bus or fake editor. +4. **Output safety preserved:** stale epoch/revision event rejected; device topology fault latches silence until explicit remap; structural edits still require OUTPUT MUTE, avoid other thread's independent clock driver, build new graph off RT and preserve CH1 original VST3 + Orbit + preset + GUI. Only param edits bypass structural compile. +5. **Native synthetic acceptance:** `tests/realtime_ten_channel_controls_test.cpp` checks sample-level PRE-fader send at fader=0, SOLO DAG closure, mute-on-PRE, stereo PAN, bus fader, no callback allocation and stale epoch/revision control rejection. Existing JUCE vendor-instance test continues to execute and requires same VST3 identity/lifecycle semantics. One existing Windows workflow reused; no extra CI matrix. + +## How to use on real device + +- Select and validate a DIRECT ASIO or WASAPI audio device with correct enabled physical input/output masks; configure Routing LAB while **MUTE OUTPUT** is ON and CH1 production FX temporarily removed. For multichannel, enable required inputs in native AUDIO SETUP; JUCE initial 1IN/2OUT requested minimum does not enable every physical input automatically. +- Inside Routing LAB, set CH1–10 physical Mono/Stereo inputs, optional BUS destination, PRE/POST sends, and independent stereo-compatible VST3 effect IDs. Click APPLY while muted. Check native ACK with exact device epoch/revision; unmute carefully at low headphone volume. +- Close LAB panel; use the **normal MIX console** faders, PAN, MUTE, SOLO for all ten strips. Observe actual DSP levels in the strip meters and FX Rack. These parameter movements do not need APPLY and do not recreate VST3. Structural edits remain through Routing LAB and require muting; STOP LAB safely restores previous CH1 host with output held muted. +- Deliberately change hardware device/mask; verify stale UI gestures are rejected, previous channel cannot accidentally route into a newly selected device. Control status re-syncs from native every 12 Hz; preview sessions in browser storage do not supersede native state. + +## Limitations / next architecture gates + +Still **opt-in LAB**, not full production DAW. BUS uses the same fixed 10 strip slots, not separate AUX pool; only one stereo-compatible VST3/strip in LAB; no full multichannel plug-in editor, portable route state, PDC, hardware CUE/output patchbay or MONO bus layout negotiation. Structural routing APPLY still recreates even unchanged VST3 instances and interrupts tails; that is the NEXT architecture debt. Native strip MUTE/SOLO and PAN have 64-sample interpolation; vendor processors may still allocate/block internally and hardware timing is not validated. The serious #15 0-FX hardware crackle remains open; MSVC+CTest PASS is not hardware proof. + +**Next major milestone:** separate 10 physical input strips from aux/subgroup/FX buses and implement stable FX instance ownership through graph changes, one native MixSession/patchbay SSOT. No bulk-merging overlapping stale #115/#117; preserve current approved GUI lightweight/onboard GPU performance. Gate every new iteration with exact-head Windows native + Chromium + physically recorded dry-through FAT. From cc7a0457a2156a79c9d699a221102676114ee51b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:05:38 +0700 Subject: [PATCH 16/20] build(gui): maintain exact premium standalone/WebView app.js parity for native 10CH control token --- AR-MIX-Live-FX-Host-Standalone-v0.3.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AR-MIX-Live-FX-Host-Standalone-v0.3.html b/AR-MIX-Live-FX-Host-Standalone-v0.3.html index bf82a6389..489273af5 100644 --- a/AR-MIX-Live-FX-Host-Standalone-v0.3.html +++ b/AR-MIX-Live-FX-Host-Standalone-v0.3.html @@ -1531,6 +1531,11 @@ function flushUiParams(){uiFlushScheduled=false;const bridge=window.__JUCE__?.backend;if(bridge?.emitEvent)for(const event of pendingUiParams.values())bridge.emitEvent('arMixParameter',event);pendingUiParams.clear()} function send(param,value,ch=currentChannel){ const event={channel:ch+1,parameter:param,value}; + // P1I: native routing token rejects UI gestures from stale device graphs. + const liveToken=window.__armixRouteToken; + if(ch>=0&&ch<10&&liveToken?.epoch>0&&liveToken?.revision>0){ + event.routeEpoch=liveToken.epoch;event.routeRevision=liveToken.revision; + } if(['faderDb','pan','trimDb','phonesDb','masterGain'].includes(param)){ pendingUiParams.set(`${ch}:${param}`,event); if(!uiFlushScheduled){uiFlushScheduled=true;requestAnimationFrame(flushUiParams)} From 0b2e1f06e47987f2ae80b032a5cbe053dc04d539 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:09:11 +0700 Subject: [PATCH 17/20] fix(P1I): accept full native +10 dB fader gain in structural routing codec --- engine/core/NativeDryRouteCommand.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/core/NativeDryRouteCommand.h b/engine/core/NativeDryRouteCommand.h index 8f50cdf16..fe11e2529 100644 --- a/engine/core/NativeDryRouteCommand.h +++ b/engine/core/NativeDryRouteCommand.h @@ -45,9 +45,9 @@ struct NativeDryRouteCommand final { } const float level=static_cast(static_cast(gain)); const float balance=static_cast(static_cast(pan)); - if(!std::isfinite(level)||level<0.f||level>1.f|| + if(!std::isfinite(level)||level<0.f||level>4.f|| !std::isfinite(balance)||balance< -1.f||balance>1.f) { - problem="Channel level must be 0..1 and pan -1..1";return false; + problem="Channel linear gain must be 0..4 and pan -1..1";return false; } auto& c=candidate.channels.stripsAndMaster.strips[i]; c.faderLinear=level;c.pan=balance; From ea1a35cf6d27b78ec442eb690d9e84cb81fa8f81 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:09:15 +0700 Subject: [PATCH 18/20] fix(P1I): reapply native fader/PAN/MUTE/SOLO into route draft and preserve arbitrary gain --- web/monitor.js | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/web/monitor.js b/web/monitor.js index 3f51bec8d..52cd92594 100644 --- a/web/monitor.js +++ b/web/monitor.js @@ -75,14 +75,14 @@ '
Select channels, BUS returns and sends; APPLY is a native graph transaction.
' + '
'; document.body.appendChild(routeOverlay); - const draftRoutes=Array.from({length:10},()=>({mode:"NONE",left:-1,right:-1,gain:0.25,main:true,mute:false,solo:false,fxId:""})); + const draftRoutes=Array.from({length:10},()=>({mode:"NONE",left:-1,right:-1,gain:0.25,pan:0,main:true,mute:false,solo:false,fxId:""})); const draftSends=[]; let draftEpoch=0; // identity of the hardware used to draw these selectors function invalidateDraftForNewDevice(nextEpoch){ if(draftEpoch===nextEpoch)return false; draftEpoch=nextEpoch; for(const route of draftRoutes) { - route.mode="NONE";route.left=-1;route.right=-1;route.gain=0.25; + route.mode="NONE";route.left=-1;route.right=-1;route.gain=0.25;route.pan=0; route.main=true;route.mute=false;route.solo=false;route.fxId=""; } draftSends.length=0; @@ -109,6 +109,29 @@ catalogItems=items.filter(p=>p&&typeof p.id==="string"); if(routeOverlay.classList.contains("open"))drawRoutes(); }); + function syncNativeLevelsToRouteDraft(){ + const d=state.dryRoutingLab||{}; + if(!d.active||!d.ready||!Array.isArray(d.channelControls))return; + // Changes performed on the main mixer must survive the next STRUCTURAL + // APPLY; never roll back a musician's fader/PAN when editing a send. + for(let i=0;iMath.abs(v-current)<.00001); + if(!matched&&Number.isFinite(current)&¤t>=0&¤t<=4) + base.push([current,(current<=0?'−∞':(20*Math.log10(current)).toFixed(1))+' dB · LIVE']); + return base.map(([v,label])=> + '').join(''); + } function drawRoutes(){ // An identical numbered input on another ASIO device is NOT the same // microphone. Clear all prior user intent if device epoch changed. @@ -123,8 +146,7 @@ ''+ ''+ ''+ + routeGainChoices(v.gain)+''+ '
'+ ''+ ''+ @@ -188,6 +210,7 @@ " · "+(d.ports?.length||0)+" enabled inputs · "+(d.outputPorts?.length||0)+" outputs · "+(d.sendCount||0)+" live sends"); } document.getElementById("arOpenRoutingLab").addEventListener("click",()=>{ + syncNativeLevelsToRouteDraft(); drawRoutes(); routeOverlay.classList.add("open"); overlay.classList.remove("open"); From ddb18fab6b9799892d0f037d0934f1cf77d32329 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:15:32 +0700 Subject: [PATCH 19/20] fix(P1I): remove duplicated native channelControls status block found by MSVC --- src/LiveDryRoutingLab.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 1820fb021..23b867547 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -395,17 +395,6 @@ class LiveDryRoutingLab final { } out->setProperty("channelControls",juce::var(controls)); out->setProperty("channelFxNames",juce::var(fxNames)); - juce::Array controls; - for(const auto& state:channelEdits_) { - auto c=std::make_unique(); - const float db=state.linear>0.f ? 20.f*std::log10(state.linear) : -60.f; - c->setProperty("db",db); - c->setProperty("pan",state.pan*100.f); - c->setProperty("mute",state.mute); - c->setProperty("solo",state.solo); - controls.add(juce::var(c.release())); - } - out->setProperty("channelControls",juce::var(controls)); juce::Array levels; for(const auto& p:channelPeaks_)levels.add(p.load(std::memory_order_relaxed)); out->setProperty("channelPeaks",juce::var(levels)); From f9e23a972e2631a9dddd18d00d4243b0a9c450d5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 28 Oct 2026 20:23:20 +0700 Subject: [PATCH 20/20] test(P1I): correct expected stereo balance gain (L=0.4 R=0.5 at PAN +20%) --- tests/realtime_ten_channel_controls_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/realtime_ten_channel_controls_test.cpp b/tests/realtime_ten_channel_controls_test.cpp index 8fc61b452..570406194 100644 --- a/tests/realtime_ten_channel_controls_test.cpp +++ b/tests/realtime_ten_channel_controls_test.cpp @@ -96,7 +96,8 @@ int main() { { auto lease=publisher.acquire(); assert(lease.get(4)&&lease.get(4)->prepared->identity==42); - assert(near(lease.get(4)->prepared->params.at(3).left.load(),.5f)); + assert(near(lease.get(4)->prepared->params.at(3).left.load(),.4f)); // stereo pan +20% reduces LEFT + assert(near(lease.get(4)->prepared->params.at(3).right.load(),.5f)); } publisher.unpublish(); assert(!publisher.updateActiveControl(4,1,update));