diff --git a/scripts/build_approved_native_gui.py b/scripts/build_approved_native_gui.py
index 08dc37a85..d1d9e19e2 100644
--- a/scripts/build_approved_native_gui.py
+++ b/scripts/build_approved_native_gui.py
@@ -24,6 +24,7 @@
ADAPTER_MARKER = ('\n'
'\n'
'\n'
+ '\n'
'\n'
'\n'
'\n')
@@ -365,6 +366,8 @@ def stage(out: Path) -> dict:
out / "assets" / "approved-device-view-model.js")
shutil.copy2(ROOT / "web" / "approved-channel-strip-view-model.js",
out / "assets" / "approved-channel-strip-view-model.js")
+ shutil.copy2(ROOT / "web" / "approved-fx-rack-view-model.js",
+ out / "assets" / "approved-fx-rack-view-model.js")
native = native_html(approved.decode("utf-8")).encode("utf-8")
(out / "index.html").write_bytes(native)
files = [out / "index.html", *sorted(p for p in (out / "assets").rglob("*") if p.is_file())]
diff --git a/tests/approved_native_cold_start_smoke.py b/tests/approved_native_cold_start_smoke.py
index 0ac252381..1b964254b 100644
--- a/tests/approved_native_cold_start_smoke.py
+++ b/tests/approved_native_cold_start_smoke.py
@@ -76,6 +76,7 @@ def main():
page.locator('.command-bar [data-native-io]').click()
assert page.evaluate("""()=>Boolean(
window.ArSonApprovedChannelStripViewModel &&
+ window.ArSonApprovedFxRackViewModel?.powerPresentation &&
window.__ARMIX_NATIVE_M2__?.inputChoices &&
window.__ARMIX_NATIVE_M2__?.outputChoices)"""), (
'native assembled GUI missing GUI-1 Channel Strip ViewModel')
diff --git a/tests/approved_native_gui_bundle_test.py b/tests/approved_native_gui_bundle_test.py
index 0f425100e..110a53428 100644
--- a/tests/approved_native_gui_bundle_test.py
+++ b/tests/approved_native_gui_bundle_test.py
@@ -67,7 +67,13 @@ def test_native_is_exact_assembled_public_pages_plus_nonvisual_native_seam(self)
self.assertLess(native.index('assets/approved-device-view-model.js'),
native.index('assets/approved-channel-strip-view-model.js'))
self.assertLess(native.index('assets/approved-channel-strip-view-model.js'),
+ native.index('assets/approved-fx-rack-view-model.js'))
+ self.assertLess(native.index('assets/approved-fx-rack-view-model.js'),
native.index('assets/approved-native-bridge.js'))
+ self.assertNotIn('assets/approved-fx-rack-view-model.js', approved)
+ self.assertEqual(
+ (out / 'assets/approved-fx-rack-view-model.js').read_bytes(),
+ (ROOT / 'web/approved-fx-rack-view-model.js').read_bytes())
self.assertNotIn('assets/approved-channel-strip-view-model.js', approved)
self.assertEqual(
(out / 'assets/approved-channel-strip-view-model.js').read_bytes(),
diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs
index 4b4661048..7340786cc 100644
--- a/tests/approved_native_m2_contract.test.cjs
+++ b/tests/approved_native_m2_contract.test.cjs
@@ -6,6 +6,7 @@ const {readFileSync}=require("node:fs");
const protocol=require("../web/approved-native-contract.js");
const deviceVM=require("../web/approved-device-view-model.js");
const stripVM=require("../web/approved-channel-strip-view-model.js");
+const fxRackVM=require("../web/approved-fx-rack-view-model.js");
const read=p=>readFileSync(p,"utf8");
const fixtures=JSON.parse(read("integration/console-v6/fixtures.json"));
const clone=x=>JSON.parse(JSON.stringify(x));
@@ -1249,7 +1250,7 @@ test("M3 native-only Pages scope performs real bridge projection, fader intent a
querySelector:()=>null,addEventListener(){}
};
const window={
- __JUCE__:{backend:native},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,
+ __JUCE__:{backend:native},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},queueMicrotask(fn){microtasks.push(fn);},setTimeout(fn,ms){timers.push({fn,ms});return timers.length;}
};
vm.runInNewContext(read("web/approved-native-bridge.js"),{
@@ -1450,6 +1451,91 @@ test("M3 native-only Pages scope performs real bridge projection, fader intent a
assert.equal(sent.findLast(x=>x.name==="arMixConsoleIntent").payload.payload.changes[0].to,other.id);
});
+// GUI-2: FX Rack projection is pure. No shadow DSP state, browser FX editor
+// ownership, plugin reordering, or second routing/Apply command dispatcher.
+test("GUI-2 native FX Rack projection keeps global, rack and insert bypass independent",()=>{
+ const ch={fxRackBypassed:false,inserts:[
+ {id:"9223372036854775808",bypassed:false,latencySamples:128},
+ {id:"9223372036854775810",bypassed:true,latencyChanged:true}
+ ]};
+ const frozen=JSON.stringify(ch);
+ const base=fxRackVM.powerPresentation(ch,false,"Vocal");
+ assert.deepEqual(base.slots.map(x=>x.effective),[true,false]);
+ assert.deepEqual(base.slots.map(x=>x.slotEnabled),[true,false]);
+ assert.equal(base.headerPressed,true);
+ assert.equal(base.slots[0].latencyTitle,"Plugin delay: 128 samples · compensated");
+ assert.match(base.slots[1].latencyTitle,/Plugin delay changed/);
+ assert.equal(base.slots[1].buttonTitle,"Enable only insert 2");
+ const global=fxRackVM.powerPresentation(ch,true,"Vocal");
+ assert.deepEqual(global.slots.map(x=>x.effective),[false,false]);
+ assert.deepEqual(global.slots.map(x=>x.slotEnabled),[true,false]);
+ assert.equal(global.headerPressed,false);
+ const chain=fxRackVM.powerPresentation({...ch,fxRackBypassed:true},false,"Vocal");
+ assert.equal(chain.chainBypassed,true);
+ assert.deepEqual(chain.slots.map(x=>x.effective),[false,false]);
+ assert.equal(chain.slots[0].buttonTitle,"Bypass only insert 1");
+ assert.equal(JSON.stringify(ch),frozen,"projection cannot rewrite accepted insert flags");
+ assert.equal(fxRackVM.powerPresentation(ch,null,"Vocal"),null);
+ assert.equal(fxRackVM.powerPresentation({...ch,inserts:[{id:"",bypassed:false}]},false,"Vocal"),null);
+});
+test("GUI-2 FX Rack never paints stale mounted VST3 instance or slot order",()=>{
+ const view=fxRackVM.powerPresentation({fxRackBypassed:false,inserts:[
+ {id:"instance-A",bypassed:false},{id:"instance-B",bypassed:true}
+ ]},false,"CH5");
+ const rows=[{slot:"0",instanceId:"instance-A",hasPower:true},
+ {slot:"1",instanceId:"instance-B",hasPower:true}];
+ assert.equal(fxRackVM.mountedCompatible(view,rows),true);
+ assert.equal(fxRackVM.mountedCompatible(view,[rows[1],rows[0]]),true,
+ "DOM order may differ; stable slot plus native token selects correct row");
+ assert.equal(fxRackVM.mountedCompatible(view,[rows[0],rows[0]]),false);
+ assert.equal(fxRackVM.mountedCompatible(view,[{...rows[0],instanceId:"instance-X"},rows[1]]),false);
+ assert.equal(fxRackVM.mountedCompatible(view,[rows[0],{...rows[1],hasPower:false}]),false);
+ assert.equal(fxRackVM.mountedCompatible(view,[rows[0]]),false);
+});
+test("GUI-2 FX Rack ACK alone cannot commit bypass, moved token cannot settle",()=>{
+ const p={acked:false,kind:"insert",channelId:"9007199254740993",
+ insertId:"fx-1",bypassed:true};
+ const ch={id:p.channelId,fxRackBypassed:false,
+ inserts:[{id:"fx-1",bypassed:true}]};
+ assert.equal(fxRackVM.powerReadbackConfirmed(p,[ch]),false);
+ assert.equal(fxRackVM.powerReadbackConfirmed({...p,acked:true},[ch]),true);
+ assert.equal(fxRackVM.powerReadbackConfirmed({...p,acked:true},
+ [{...ch,inserts:[{id:"fx-moved",bypassed:true}]}]),false);
+ assert.equal(fxRackVM.powerReadbackConfirmed({...p,acked:true},[
+ {...ch,fxRackBypassed:true,inserts:[{id:"fx-1",bypassed:false}]}]),false);
+ assert.equal(fxRackVM.powerReadbackConfirmed({...p,acked:true,kind:"rack",insertId:null},
+ [{...ch,fxRackBypassed:true}]),true);
+ const m4={authority:"M4",deviceEpoch:"18",routeRevision:"9",
+ channels:[{fxRackBypassed:true}]};
+ const pending={channel:0,epoch:"18",revision:"9",bypassed:true,acked:false};
+ assert.equal(fxRackVM.m4RackPendingState(pending,m4),"WAIT");
+ assert.equal(fxRackVM.m4RackPendingState({...pending,acked:true},m4),"CONFIRMED");
+ assert.equal(fxRackVM.m4RackPendingState({...pending,acked:true},
+ {...m4,deviceEpoch:"19"}),"STALE");
+});
+test("GUI-2 M4 catalog projection cannot modify native identity or resurrect deleted FX",()=>{
+ const rows=[{instanceId:"legacy-instance",catalogId:"external-eq",bypassed:true}];
+ const frozen=JSON.stringify(rows);
+ const m4=fxRackVM.m4Presentation(rows,new Map([
+ ["external-eq",{name:"Parametric EQ"}]]),true);
+ assert.equal(m4.fxOn,false);
+ assert.deepEqual(m4.slots[0],{slot:0,name:"Parametric EQ",bypassed:true,
+ instance:{id:"legacy-instance",name:"Parametric EQ"}});
+ assert.equal(m4.slots[1].name,"None");
+ assert.equal(m4.slots[1].instance,null);
+ assert.equal(m4.slots.length,8);
+ assert.equal(fxRackVM.m4Presentation([],new Map(),undefined).fxOn,null);
+ assert.equal(JSON.stringify(rows),frozen);
+ const source=read("web/approved-native-bridge.js");
+ assert.match(source,/fxRackVM\.powerPresentation\(ch,globalFxBypassed,t\.name\)/);
+ assert.match(source,/fxRackVM\.mountedCompatible\(view,slots\)/);
+ assert.match(source,/fxRackVM\.m4Presentation\(m\.fxInstances\[lane\]/);
+ assert.match(source,/fxRackVM\.powerReadbackConfirmed\(pendingNativeFxPower/);
+ assert.doesNotMatch(source,/const effective=enabled&&globalEnabled&&!insert\.bypassed/);
+ assert.doesNotMatch(source,/const actual=p\.kind==="rack"\?ch\?\.fxRackBypassed/);
+ assert.equal((source.match(/action:"routingNativeFxRackBypass"/g)||[]).length,0,
+ "native action names must remain in the existing conditional dispatch only");
+});
test("P0 native FX rack and per-slot readback update mounted strip without replacing fader DOM",()=>{
const vm=require("node:vm"),listeners=new Map(),sent=[];
let paints=0,serial=100,wire=300,strip=null;
@@ -1473,7 +1559,7 @@ test("P0 native FX rack and per-slot readback update mounted strip without repla
querySelector:selector=>selector.startsWith('.strip[data-id=')?strip:null,
addEventListener(){}
};
- const win={__JUCE__:{backend:native},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,
+ const win={__JUCE__:{backend:native},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},
setTimeout(){return 0},clearTimeout(){},queueMicrotask(fn){fn();}};
vm.runInNewContext(read("web/approved-native-bridge.js"),
@@ -1651,7 +1737,7 @@ test("P0 FIRST SOUND G0 offers verified input and leaves automatic MAIN to nativ
addEventListener(){}
};
win={
- __JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,
+ __JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},
setTimeout(){return 0},clearTimeout(){},queueMicrotask(fn){fn();}
};
@@ -1738,7 +1824,7 @@ test("P0 native hardware IN remains selectable after ChannelId ownership, failed
id==="preview"?{disabled:true}:null,
querySelector:()=>null,addEventListener(){}
};
- const win={__JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,
+ const win={__JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},
setTimeout(){return 0},clearTimeout(){},
queueMicrotask(fn){microtasks.push(fn);}};
diff --git a/tests/live_fader_held_drag.test.cjs b/tests/live_fader_held_drag.test.cjs
index 93f5ea605..4158147f1 100644
--- a/tests/live_fader_held_drag.test.cjs
+++ b/tests/live_fader_held_drag.test.cjs
@@ -8,6 +8,7 @@ const vm=require("node:vm");
const protocol=require("../web/approved-native-contract.js");
const deviceVM=require("../web/approved-device-view-model.js");
const stripVM=require("../web/approved-channel-strip-view-model.js");
+const fxRackVM=require("../web/approved-fx-rack-view-model.js");
const read=p=>readFileSync(p,"utf8");
const clone=x=>JSON.parse(JSON.stringify(x));
const fixture=JSON.parse(read("integration/console-v6/fixtures.json")).g0;
@@ -78,7 +79,7 @@ function harness({m4=false}={}){
};
const window={
__JUCE__:{backend},ArSonApprovedNativeContract:protocol,ArSonApprovedDeviceViewModel:deviceVM,
- ArSonApprovedChannelStripViewModel:stripVM,
+ ArSonApprovedChannelStripViewModel:stripVM,ArSonApprovedFxRackViewModel:fxRackVM,
__ARMIX_NATIVE_SCOPE__:scope,addEventListener(){},
setTimeout(fn,delay=0){timers.push({fn,at:now+Math.max(0,Number(delay)||0)});return timers.length;}
};
diff --git a/web/approved-fx-rack-view-model.js b/web/approved-fx-rack-view-model.js
new file mode 100644
index 000000000..e79ac586f
--- /dev/null
+++ b/web/approved-fx-rack-view-model.js
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// GUI-2: pure FX Rack presentation/readback. The ONE native mixer owns all
+// plugin instances, graph revisions, bypass state and editor HWND lifetime.
+(function (root, factory) {
+ const api=factory();
+ if(typeof module==="object"&&module.exports)module.exports=api;
+ if(root)root.ArSonApprovedFxRackViewModel=api;
+})(typeof globalThis==="object"?globalThis:undefined,function () {
+ "use strict";
+ // A rack and the global A/B gate do not rewrite any individual insert flag.
+ // Use the exact accepted instance ID for every projected power button.
+ function powerPresentation(channel,globalFxBypassed,trackName) {
+ if(typeof channel?.fxRackBypassed!=="boolean"||
+ !Array.isArray(channel.inserts)||
+ typeof globalFxBypassed!=="boolean")return null;
+ const enabled=!channel.fxRackBypassed;
+ const globalEnabled=!globalFxBypassed;
+ const slots=channel.inserts.map((insert,slot)=>{
+ if(!insert||typeof insert.id!=="string"||!insert.id||
+ typeof insert.bypassed!=="boolean")return null;
+ const effective=enabled&&globalEnabled&&!insert.bypassed;
+ const latencyTitle=insert.latencyChanged===true?
+ "Plugin delay changed · aligned dry signal retained; reload the plugin before using its new delay":
+ Number.isInteger(insert.latencySamples)?
+ "Plugin delay: "+insert.latencySamples+" samples · compensated":null;
+ return {
+ slot,instanceId:insert.id,bypassed:insert.bypassed,
+ slotEnabled:!insert.bypassed,effective,latencyTitle,
+ buttonTitle:(insert.bypassed?"Enable":"Bypass")+" only insert "+(slot+1),
+ buttonLabel:(insert.bypassed?"Enable":"Bypass")+" only FX insert "+
+ (slot+1)+" in "+trackName
+ };
+ });
+ if(slots.some(slot=>!slot))return null;
+ return {
+ enabled,globalEnabled,chainBypassed:!enabled||!globalEnabled,
+ headerPressed:enabled&&globalEnabled,
+ headerTitle:(enabled?"Bypass":"Enable")+" all channel FX",
+ headerLabel:(enabled?"Bypass":"Enable")+" entire FX chain in "+trackName,
+ slots
+ };
+ }
+ // Pure mounted DOM compatibility guard. Never paint a reused row when its
+ // native processor lease or slot position has changed at the same revision.
+ function mountedCompatible(projection,rows) {
+ if(!projection||!Array.isArray(rows)||
+ rows.length!==projection.slots.length)return false;
+ const seen=new Set();
+ return rows.every(row=>{
+ if(!row||typeof row.slot!=="string"||
+ seen.has(row.slot)||row.hasPower!==true)return false;
+ seen.add(row.slot);
+ const slot=projection.slots.find(s=>String(s.slot)===row.slot);
+ return !!slot && row.instanceId===slot.instanceId;
+ });
+ }
+ // M4 catalog metadata may change but is NEVER authority to overwrite an
+ // installed CHANNEL_ID rack. The bridge enforces that authority boundary.
+ function m4Presentation(rows,catalog,acceptedRack) {
+ if(!Array.isArray(rows))return null;
+ const slots=Array.from({length:8},(_,slot)=>{
+ const live=rows[slot];
+ const entry=live && catalog?.get?.(live.catalogId);
+ const name=live?(entry?.name||"VST3 Loaded"):"None";
+ return {slot,name,bypassed:Boolean(live?.bypassed),
+ instance:live?{id:live.instanceId,name}:null};
+ });
+ return {fxOn:typeof acceptedRack==="boolean"?!acceptedRack:null,slots};
+ }
+ // ACK alone is insufficient. Confirm only the matching instance from the
+ // later installed ChannelId graph; a moved/deleted insert must not settle.
+ function powerReadbackConfirmed(pending,channels) {
+ if(pending?.acked!==true||!Array.isArray(channels))return false;
+ const channel=channels.find(ch=>ch.id===pending.channelId);
+ if(!channel)return false;
+ const value=pending.kind==="rack"?channel.fxRackBypassed:
+ pending.kind==="insert"?channel.inserts?.find(i=>i.id===pending.insertId)?.bypassed:
+ undefined;
+ return typeof value==="boolean"&&value===pending.bypassed;
+ }
+ function m4RackPendingState(pending,session) {
+ if(!pending||session?.authority!=="M4"||
+ session.deviceEpoch!==pending.epoch||
+ session.routeRevision!==pending.revision)return "STALE";
+ return pending.acked===true&&
+ session.channels?.[pending.channel]?.fxRackBypassed===pending.bypassed?
+ "CONFIRMED":"WAIT";
+ }
+ return Object.freeze({powerPresentation,mountedCompatible,m4Presentation,
+ powerReadbackConfirmed,m4RackPendingState});
+});
diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js
index eb871b9d6..f49924f5e 100644
--- a/web/approved-native-bridge.js
+++ b/web/approved-native-bridge.js
@@ -6,11 +6,12 @@
const protocol = window.ArSonApprovedNativeContract;
const deviceVM = window.ArSonApprovedDeviceViewModel;
const stripVM = window.ArSonApprovedChannelStripViewModel;
+ const fxRackVM = window.ArSonApprovedFxRackViewModel;
// The public GUI owns one lexical model. Native-only bundle exports a narrow
// reference to that SAME model; never reconstruct a parallel DOM/DSP.
const scope = window.__ARMIX_NATIVE_SCOPE__ || null;
const connected = Boolean(backend?.emitEvent && backend?.addEventListener &&
- protocol && deviceVM && stripVM);
+ protocol && deviceVM && stripVM && fxRackVM);
// Public browser preview keeps its header; the native JUCE caption replaces it.
if (backend?.emitEvent && backend?.addEventListener)
document.documentElement?.classList?.add?.("armix-native-desktop");
@@ -591,67 +592,46 @@
// steal focus, interrupt a fader drag or reallocate WIRE render objects.
// The verified individual bypass flag stays distinct from rack bypass.
function paintNativeFxPowerReadback(ch,t,globalFxBypassed){
- if(typeof ch.fxRackBypassed!=="boolean"||!Array.isArray(ch.inserts)||
+ if(typeof ch?.fxRackBypassed!=="boolean"||!Array.isArray(ch.inserts)||
typeof globalFxBypassed!=="boolean")
- return true; // never synthesize missing DSP readback
- const enabled=!ch.fxRackBypassed;
- // Read the SAME accepted native PCM snapshot as every slot, not a
- // CSS class from the PREVIOUS browser render frame.
- const globalEnabled=!globalFxBypassed;
+ return true; // no synthetic native PCM bypass readback
+ const view=fxRackVM.powerPresentation(ch,globalFxBypassed,t.name);
+ if(!view)return false;
const strip=document.querySelector('.strip[data-id="'+t.id+'"]');
- // GAIN/SOF are alternate views of the FX area; power readback still
- // updates the model but must not rebuild the rack or steal knob focus.
- const rackArea=strip?.querySelector(".fx-section");
- const rack=rackArea?.classList?.contains?.("is-gain-view") ||
- rackArea?.classList?.contains?.("is-sof-view")?null:rackArea;
- // Virtualized mobile banks may have no mounted strip. The model still
- // receives verified state; normal bank render creates the right buttons.
- if(rack){
- const header=rack.querySelector('[data-action="fxOn"]');
- const rows=[...rack.querySelectorAll('.fxslot-row:not(.is-empty)')];
- if(!header||rows.length!==ch.inserts.length)return false;
- for(let slot=0;slot
- r.dataset.slot===String(slot));
- if(!insert||typeof insert.bypassed!=="boolean"||
- !row||row.dataset.insertId!==insert.id||
- !row.querySelector('[data-action="slotPower"]'))
- return false; // structural re-render, never modify wrong FX owner
- }
- }
- t.fxOn=enabled;
+ // Alternate GAIN/SOF view and virtualized banks still update the model
+ // but cannot be used to infer, replace or re-own a mounted FX editor.
+ const area=strip?.querySelector(".fx-section");
+ const rack=area?.classList?.contains?.("is-gain-view") ||
+ area?.classList?.contains?.("is-sof-view")?null:area;
+ const header=rack?.querySelector('[data-action="fxOn"]');
+ const rows=rack?[...rack.querySelectorAll('.fxslot-row:not(.is-empty)')]:[];
+ const slots=rows.map(row=>({slot:row.dataset.slot,
+ instanceId:row.dataset.insertId,
+ hasPower:!!row.querySelector('[data-action="slotPower"]')}));
+ if(rack && (!header||!fxRackVM.mountedCompatible(view,slots)))
+ return false; // structural refresh only, never paint the wrong VST3
+ t.fxOn=view.enabled;
if(!Array.isArray(t.slotBypass))t.slotBypass=Array(8).fill(false);
- for(let slot=0;slotr.dataset.slot===String(slot));
- const effective=enabled&&globalEnabled&&!insert.bypassed;
- if(insert.latencyChanged===true)
- row.title="Plugin delay changed · aligned dry signal retained; reload the plugin before using its new delay";
- else if(Number.isInteger(insert.latencySamples))
- row.title="Plugin delay: "+insert.latencySamples+" samples · compensated";
- row.dataset.fxSlotEnabled=String(!insert.bypassed);
- row.dataset.fxEffective=String(effective);
- row.classList.toggle("is-active",effective);
- row.classList.toggle("is-bypassed",!effective);
+ rack.dataset.fxChainEnabled=String(view.enabled);
+ rack.dataset.globalFxEnabled=String(view.globalEnabled);
+ rack.classList.toggle("is-chain-bypassed",view.chainBypassed);
+ header.setAttribute("aria-pressed",String(view.headerPressed));
+ header.title=view.headerTitle;
+ header.setAttribute("aria-label",view.headerLabel);
+ const rowBySlot=new Map(rows.map(row=>[row.dataset.slot,row]));
+ for(const slot of view.slots){
+ const row=rowBySlot.get(String(slot.slot));
+ if(slot.latencyTitle!==null)row.title=slot.latencyTitle;
+ row.dataset.fxSlotEnabled=String(slot.slotEnabled);
+ row.dataset.fxEffective=String(slot.effective);
+ row.classList.toggle("is-active",slot.effective);
+ row.classList.toggle("is-bypassed",!slot.effective);
const button=row.querySelector('[data-action="slotPower"]');
- button.setAttribute("aria-pressed",String(effective));
- button.title=(insert.bypassed?"Enable":"Bypass")+
- " only insert "+(slot+1);
- button.setAttribute("aria-label",
- (insert.bypassed?"Enable":"Bypass")+" only FX insert "+
- (slot+1)+" in "+t.name);
+ button.setAttribute("aria-pressed",String(slot.effective));
+ button.title=slot.buttonTitle;
+ button.setAttribute("aria-label",slot.buttonLabel);
}
return true;
}
@@ -1423,12 +1403,8 @@
function reconcileM4RackReadback(next){
const session=next?.raw?.mixerSession;
for(const [lane,p] of pendingM4RackPowers){
- if(session?.authority!=="M4"||
- session.deviceEpoch!==p.epoch||session.routeRevision!==p.revision){
- pendingM4RackPowers.delete(lane);continue;
- }
- const actual=session.channels?.[lane]?.fxRackBypassed;
- if(p.acked && actual===p.bypassed)pendingM4RackPowers.delete(lane);
+ const decision=fxRackVM.m4RackPendingState(p,session);
+ if(decision!=="WAIT")pendingM4RackPowers.delete(lane);
}
}
// Global A/B is a SINGLE native atomic override. Individual racks and
@@ -1637,33 +1613,32 @@
scope?.syncFaderVisual?.({...t,level:db});
}
function paintM4FxInstances(m) {
- // Catalog refresh is metadata, never permission to replace a native
- // rack with an inactive compatibility graph's old/empty FX inventory.
+ // Only the accepted M4 owner may populate compatibility rack controls.
if(mixerSession()?.authority==="CHANNEL_ID")return;
if(!Array.isArray(m?.fxInstances)||!scope?.tracks)return;
for(let lane=0;lane<10;lane++){
const t=scope.tracks.find(x=>x.id===m4TrackIds[lane]);
- const rows=m.fxInstances[lane];
- if(!t||!Array.isArray(rows))continue;
- let change=false;
const acceptedRack=mixerSession()?.authority==="M4"?
mixerSession()?.channels?.[lane]?.fxRackBypassed:undefined;
- if(typeof acceptedRack==="boolean" && t.fxOn===acceptedRack){
- t.fxOn=!acceptedRack;change=true;
+ const view=fxRackVM.m4Presentation(m.fxInstances[lane],
+ nativeCatalog,acceptedRack);
+ if(!t||!view)continue;
+ let change=false;
+ if(view.fxOn!==null&&t.fxOn!==view.fxOn){
+ t.fxOn=view.fxOn;change=true;
}
- for(let slot=0;slot<8;slot++){
- const live=rows[slot],entry=nativeCatalog.get(live?.catalogId);
- const name=live?(entry?.name||"VST3 Loaded"):"None";
- if(t.fx[slot]!==name || t.slotBypass[slot]!==Boolean(live?.bypassed) ||
- (t.fxInsertIds?.[slot]?.id||null)!==(live?.instanceId||null)){
- t.fx[slot]=name;
- t.slotBypass[slot]=Boolean(live?.bypassed);
+ for(const slot of view.slots){
+ const i=slot.slot;
+ if(t.fx[i]!==slot.name||t.slotBypass[i]!==slot.bypassed||
+ (t.fxInsertIds?.[i]?.id||null)!==(slot.instance?.id||null)){
+ t.fx[i]=slot.name;
+ t.slotBypass[i]=slot.bypassed;
if(!Array.isArray(t.fxInsertIds))t.fxInsertIds=Array(8).fill(null);
- t.fxInsertIds[slot]=live?{id:live.instanceId,name}:null;
+ t.fxInsertIds[i]=slot.instance;
change=true;
}
}
- if(change && scope.activeFaderId!==t.id)
+ if(change&&scope.activeFaderId!==t.id)
scope.refreshStrip?.(t);
}
}
@@ -2921,13 +2896,8 @@
status("VST3 loaded · "+inserted.name+" · native PCM readback verified");
}
}
- if(pendingNativeFxPower?.acked){
- const p=pendingNativeFxPower;
- const ch=next.graph.channels.find(x=>x.id===p.channelId);
- const actual=p.kind==="rack"?ch?.fxRackBypassed:
- ch?.inserts?.find(x=>x.id===p.insertId)?.bypassed;
- if(actual===p.bypassed)pendingNativeFxPower=null;
- }
+ if(fxRackVM.powerReadbackConfirmed(pendingNativeFxPower,
+ next.graph.channels))pendingNativeFxPower=null;
if(startupWire)window.queueMicrotask(flushStartupWire);
status("Mixer settings updated");
}