Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b4c8019
feat(live): make any channel IN one native source+monitor transaction…
masarray Nov 5, 2026
8890a7f
feat(mixer): connect every visible channel IN to native per-strip sou…
masarray Nov 5, 2026
73bed26
fix(ux): remove duplicate CH1 patch/arm wizard; route native Audio Se…
masarray Nov 5, 2026
20cd810
fix(engine): acknowledge real M4 per-channel fader pan mute solo with…
masarray Nov 5, 2026
bd5e663
feat(audio-control): unlock approved 10CH faders pan mute solo and me…
masarray Nov 5, 2026
addddce
chore(integration): keep legacy standalone source unchanged; Windows …
masarray Nov 5, 2026
5e87a93
chore(integration): keep legacy standalone source unchanged; Windows …
masarray Nov 5, 2026
b4deb9b
fix(approved-gui): present verified native device ports on every mixe…
masarray Nov 5, 2026
b56caa5
feat(native): any visible mixer IN selects real hardware source and s…
masarray Nov 5, 2026
5137087
style(native): compact professional Audio I/O setup overlay without c…
masarray Nov 5, 2026
afa4549
build(native): embed only the approved mixer plus native-specific com…
masarray Nov 5, 2026
98748a6
feat(native): compact verified audio I/O and one-click per-channel mo…
masarray Nov 5, 2026
b563288
fix(readback): project real per-channel hardware IN/MAIN assignments …
masarray Nov 5, 2026
4fe434b
test(native): assert any-channel Audition I/O, integrated monitor and…
masarray Nov 5, 2026
bf9620e
fix(provenance): preserve exact unchanged public /preview/ HTML; nati…
masarray Nov 5, 2026
5226fa5
fix(bundle): add reversible native-only IN options injection without …
masarray Nov 5, 2026
324c0bd
fix(bundle): use actual newline delimiters in reversible native-only …
masarray Nov 5, 2026
eca4334
fix(native): preserve genuine First Sound diagnosis and independent t…
masarray Nov 5, 2026
2e62915
test(provenance): require native input hook in reversible bundle inje…
masarray Nov 5, 2026
0aef432
fix(audio-safety): prevent auto-monitor into identical VB-Cable captu…
masarray Nov 5, 2026
f31543a
fix(bundle): anchor native IN hook to exact approved channelOptions d…
masarray Nov 5, 2026
243dbba
fix(native-source): support explicit None to unpatch any input using …
masarray Nov 5, 2026
39d5477
test(native): verify any-channel hardware IN=None unpatch is typed, i…
masarray Nov 5, 2026
f6d6643
test(e2e): simulate real CH10 sparse-pin source ACK, automatic monito…
masarray Nov 5, 2026
460ee8a
fix(reliability): release stuck input selection after lost native ACK…
masarray Nov 5, 2026
4cd933d
fix(ux-safety): no auto-output on input selection; reuse approved MAI…
masarray Nov 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion scripts/build_approved_native_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
ROOT = Path(__file__).resolve().parents[1]
CANONICAL = ROOT / "site" / "preview-v2"
NATIVE_ADAPTER = ROOT / "web" / "approved-native-bridge.js"
ADAPTER_MARKER = ('<script defer src="assets/approved-native-contract.js"></script>\n'
ADAPTER_MARKER = ('<link rel="stylesheet" href="assets/approved-native-io.css">\n'
'<script defer src="assets/approved-native-contract.js"></script>\n'
'<script defer src="assets/approved-native-bridge.js"></script>')
SCHEMA = "arsonmix.approved-native-pages-bundle.v2"

Expand Down Expand Up @@ -57,6 +58,11 @@ def accepted_pages_html() -> str:
# HTML at native build time. Every anchor must occur exactly once: no silent
# breakage if Pages GUI source evolves. No extra layout or simulated PCM.
NATIVE_EVENT_HOOKS = (
# The approved Pages HTML stays byte-for-byte unchanged; these two
# reversible native-only hooks expose verified mixer hardware choices.
("const option=(values,selected)=>values.map(x=>'<option value=\"'+escapeHtml(x)+'\"'+(x===selected?' selected':'')+'>'+escapeHtml(x)+'</option>').join('');\n", "const option=(values,selected)=>values.map(x=>{const value=Array.isArray(x)?x[0]:x,label=Array.isArray(x)?x[1]:x;return '<option value=\"'+escapeHtml(value)+'\"'+(value===selected?' selected':'')+'>'+escapeHtml(label)+'</option>';}).join('');\n"),
("const channelOptions=(t,type)=>{\n",
"const channelOptions=(t,type)=>{\n if(window.__JUCE__?.backend){\n const native=window.__ARMIX_NATIVE_M2__?.channelOptions?.(t,type);\n if(native)return native;\n return type==='input'?[['None','Choose audio device…']]:type==='output'?[[t.output||'Master','MAIN']]:['None'];\n }\n"),
("function wireGraphCommit(ops,{record=true}={}){\n",
"function wireGraphCommit(ops,{record=true}={}){\n"
" if(window.__JUCE__?.backend){window.__ARMIX_NATIVE_M2__?.consumeWire?.(ops);return false;}\n"),
Expand Down Expand Up @@ -186,6 +192,8 @@ def stage(out: Path) -> dict:
out.mkdir(parents=True)
shutil.copytree(pages / "assets", out / "assets")
shutil.copy2(NATIVE_ADAPTER, out / "assets" / "approved-native-bridge.js")
shutil.copy2(ROOT / "web" / "approved-native-io.css",
out / "assets" / "approved-native-io.css")
shutil.copy2(ROOT / "web" / "approved-native-contract.js",
out / "assets" / "approved-native-contract.js")
native = native_html(approved.decode("utf-8")).encode("utf-8")
Expand Down
16 changes: 15 additions & 1 deletion src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,17 +783,31 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
if(engine_.dryRoutingLabActive() && channel>=1 &&
channel<=LiveDryRoutingLab::count &&
(name=="faderDb"||name=="pan"||name=="mute"||name=="solo")) {
// Audition-style live mixer control: all ten strip faders/pans/
// mute/solo target their REAL native PCM owner, never the Pages
// demo model or hardcoded legacy CH1. No UI-thread graph rebuild.
const auto ep=args.getProperty("routeEpoch",juce::var());
const auto rev=args.getProperty("routeRevision",juce::var());
bool accepted=false;
if(!ep.isVoid()&&!rev.isVoid() &&
((name=="mute"||name=="solo")?value.isBool():
(value.isDouble()||value.isInt()))) {
const auto epoch=static_cast<std::uint64_t>(static_cast<juce::int64>(ep));
const auto revision=static_cast<std::uint64_t>(static_cast<juce::int64>(rev));
const float liveValue=value.isBool()?(bool(value)?1.f:0.f):valueNumber;
(void)engine_.setDryRoutingLabParameter(channel-1,epoch,revision,
accepted=engine_.setDryRoutingLabParameter(channel-1,epoch,revision,
name,liveValue);
}
auto ack=std::make_unique<juce::DynamicObject>();
ack->setProperty("channel",channel);
ack->setProperty("parameter",name);
ack->setProperty("ok",accepted);
ack->setProperty("routeEpoch",
static_cast<juce::int64>(engine_.dryRoutingLabEpoch()));
ack->setProperty("routeRevision",
static_cast<juce::int64>(engine_.dryRoutingLabRevision()));
if(browser_.loaded)
browser_.emitEventIfBrowserIsVisible("arMixM4ControlAck",juce::var(ack.release()));
return;
}
if (name == "masterGain" && (value.isDouble() || value.isInt()))
Expand Down
16 changes: 9 additions & 7 deletions src/NativeVerifiedSourcePatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ struct NativeVerifiedSourcePatch final {
actualRevision>static_cast<std::uint64_t>(std::numeric_limits<juce::int64>::max()) ||
!accepted.isObject() || channel<0 || channel>=10)
return "SOURCE: stale device epoch or invalid native channel";
if(mode!="MONO"&&mode!="STEREO")
return "SOURCE: MONO or STEREO mode required";
if(physicalLeft<0 || enabledPhysicalPorts.empty())
if(mode!="NONE"&&mode!="MONO"&&mode!="STEREO")
return "SOURCE: NONE, MONO or STEREO mode required";
if(mode=="NONE" && (physicalLeft!=-1||physicalRight!=-1))
return "SOURCE: clear input requires no physical capture pins";
if(mode!="NONE"&&(physicalLeft<0||enabledPhysicalPorts.empty()))
return "SOURCE: select an enabled physical capture pin";
if(static_cast<juce::int64>(accepted.getProperty("deviceEpoch",juce::var(-1))) !=
static_cast<juce::int64>(actualEpoch))
Expand All @@ -35,8 +37,8 @@ struct NativeVerifiedSourcePatch final {
if(port==physicalLeft)validLeft=true;
if(port==physicalRight)validRight=true;
}
if(!validLeft || (mode=="STEREO" &&
(!validRight || physicalLeft==physicalRight)))
if(mode!="NONE"&&(!validLeft || (mode=="STEREO" &&
(!validRight || physicalLeft==physicalRight))))
return "SOURCE: STEREO requires two distinct active physical pins; MONO accepts one";
// JUCE var assignment shares the underlying DynamicObject. Deep
// clone before touching a row, or failed prepare would silently
Expand All @@ -62,11 +64,11 @@ struct NativeVerifiedSourcePatch final {
const auto width=row->getProperty("channelFormat").toString();
if(width!="MONO" && width!="STEREO")
return "SOURCE: native processing format missing or invalid";
row->setProperty("sourceKind","PHYSICAL");
row->setProperty("sourceKind",mode=="NONE"?"NONE":"PHYSICAL");
row->setProperty("sourceFormat",mode);
}
row->setProperty("mode",mode);
row->setProperty("left",physicalLeft);
row->setProperty("left",mode=="NONE"?-1:physicalLeft);
row->setProperty("right",mode=="STEREO"?physicalRight:-1);
// The existing M4 producer handles revision/epoch publication and
// fails back to its prior accepted graph on any bad plugin/routing.
Expand Down
131 changes: 116 additions & 15 deletions tests/approved_native_m2_contract.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,85 @@ test("M3 native-only Pages scope performs real bridge projection, fader intent a
assert.equal(scope.edges.length,0,"accepted snapshot replaces reference wire");
});

test("verified Windows CH10 selects sparse hardware IN3 then native ACK starts MAIN; M4 fader targets CH10",()=>{
const vm=require("node:vm"),events=[],listeners=new Map();
const tracks=Array.from({length:10},(_,i)=>({
id:30+i,name:"CH"+(i+1),kind:"audio",input:"None",output:"Master",
level:-12,pan:0,mute:false,solo:false
}));
const scope={tracks,master:{id:90,name:"MAIN",level:0,mute:false},
render(){},stopDemo(){},findTrack(el){return el.track;},
displayMeterDbfs(){}};
const backend={
emitEvent(name,payload){events.push({name,payload});},
addEventListener(name,cb){listeners.set(name,cb);}
};
const preview={disabled:false};
const document={
readyState:"complete",documentElement:{dataset:{}},
getElementById:id=>id==="info"?{textContent:""}:id==="preview"?preview:null,
querySelector(){return null;},addEventListener(){}
};
const window={__JUCE__:{backend},ArSonApprovedNativeContract:protocol,
__ARMIX_NATIVE_SCOPE__:scope,setTimeout(){return 0;}};
vm.runInNewContext(read("web/approved-native-bridge.js"),
{window,document,performance:{now:()=>0},console},{timeout:1500});
const g0=clone(fixtures.g0);
g0.device.enabledInputs=[0,2];
g0.device.inputEndpoints=[
{id:"in:0",port:0,callback:0,label:"Mic 1",active:true},
{id:"in:2",port:2,callback:1,label:"Mic 3",active:true}
];
g0.legacyM4={active:true,routeAccepted:false,routingRevision:"12"};
listeners.get("arMixConsoleSnapshot")(g0);
listeners.get("arMixStatus")({
connected:true,directRouteAuthorized:true,adaptiveClockActive:false,
monitor:false,dryRoutingLab:{active:true,ready:true,topologyFault:false,
hasAcceptedRoute:false,epoch:69,revision:12}
});
const choices=window.__ARMIX_NATIVE_M2__.channelOptions(tracks[9],"input");
assert.ok(choices.some(x=>x[0]==="MONO:2"),"sparse physical input is real");
assert.ok(!choices.some(x=>/CABLE Output L\/R \(Stereo\)/.test(x[0])),
"fake Pages CABLE list must not be selectable as hardware");
const picker={dataset:{field:"input"},value:"MONO:2",track:tracks[9]};
assert.equal(window.__ARMIX_NATIVE_M2__.consumeField({target:picker,type:"change"}),true);
const req=events.findLast(x=>x.payload?.action==="routingSourceSwitch");
assert.ok(req);
assert.equal(req.payload.channel,9,"CH10 routes its OWN hardware input");
assert.equal(req.payload.left,2);
assert.equal(req.payload.mode,"MONO");
assert.equal(req.payload.deviceEpoch,69);
assert.equal(req.payload.revision,12);
const rows=Array.from({length:10},(_,i)=>i===9?
{mode:"MONO",left:2,right:-1,main:true}:
{mode:"NONE",left:-1,right:-1,main:true});
listeners.get("arMixSourceSwitchAck")({
ok:true,requestId:req.payload.requestId,channel:9,
state:{active:true,ready:true,topologyFault:false,
hasAcceptedRoute:true,epoch:69,revision:13,
acceptedRoute:{channels:rows}}
});
const monitor=events.findLast(x=>x.payload?.action==="monitor");
assert.ok(monitor);
assert.equal(monitor.payload.value,true);
assert.equal(monitor.payload.expectedRevision,13);
assert.equal(tracks[9].input,"MONO:2");
listeners.get("arMixAudioArmAck")({ok:true,armed:true,deviceEpoch:69});
const armed=clone(g0);
armed.legacyM4={active:true,routeAccepted:true,routingRevision:"13"};
armed.device.outputArmed=true;
listeners.get("arMixConsoleSnapshot")(armed);
const fader={dataset:{field:"level"},value:"-18",track:tracks[9]};
window.__ARMIX_NATIVE_M2__.consumeField({target:fader,type:"change"});
const param=events.findLast(x=>x.name==="arMixParameter");
assert.ok(param,"M4 CH10 fader reaches real native parameter transport");
assert.equal(param.payload.channel,10);
assert.equal(param.payload.parameter,"faderDb");
assert.equal(param.payload.routeEpoch,69);
assert.equal(param.payload.routeRevision,13);
assert.equal(param.payload.value,-18);
});

test("M3 Windows bundle owns pointerup fader gesture and fences native FX keyboard reorder",()=>{
const builder=read("scripts/build_approved_native_gui.py");
const bridge=read("web/approved-native-bridge.js");
Expand All @@ -428,29 +507,51 @@ test("M3 Windows bundle owns pointerup fader gesture and fences native FX keyboa
assert.ok(!bridge.includes('window.addEventListener("pointerup"'));
});

test("native Windows operator can explicitly patch first physical input, arm and mute",()=>{
test("Windows mixer uses Audition-style native IN on any channel, no hidden CH1 arm wizard",()=>{
const js=read("web/approved-native-bridge.js");
const main=read("src/Main.cpp");
const engine=read("src/LiveAudioEngine.h");
assert.match(js,/REAL AUDIO · FIRST SOUND/);
assert.match(js,/action:"audioSetup"/);
assert.match(js,/d\.inputEndpoints\.filter\(p=>/);
assert.match(js,/d\.enabledInputs\.includes\(p\.port\)/);
assert.match(js,/action:"routingSourceSwitch",requestId:pendingSourceId/);
assert.match(js,/channel:0,mode:"MONO",left:pin,right:-1/);
assert.match(js,/action:"monitor",value:true/);
const page=read("site/preview-v2/index.html");
const builder=read("scripts/build_approved_native_gui.py");
assert.match(js,/channelOptions:nativeChannelOptions/);
assert.match(js,/const chooseNativePhysicalInput=\(track,value\)=>/);
assert.match(js,/const channel=inputAt\(track\)/);
assert.match(js,/action:"routingSourceSwitch",requestId:p.id,channel:p.channel/);
assert.match(js,/inputAt\(track\)/);
assert.match(js,/nativeSourcePending\.phase="mute"/);
assert.match(js,/action:"monitor",value:false/);
assert.match(js,/expectedEpoch:epoch,expectedRevision:revision/);
assert.match(js,/action:"monitor",value:true/);
assert.match(js,/arMixSourceSwitchAck/);
assert.match(js,/arMixAudioArmAck/);
assert.match(js,/if\(ack\.ok===true\)/);
assert.match(js,/NATIVE PATCH REJECTED:/);
assert.match(js,/NO VERIFIED AUDIO DEVICE/);
assert.match(js,/NATIVE PCM · HARDWARE FAT PENDING/);
assert.match(js,/MAIN ARMED · PCM NOT YET ADMITTED/);
assert.match(js,/deviceEpoch:p.epoch,revision:p.revision/);
assert.match(js,/arMixAudioDeviceApplyAck/);
assert.match(js,/arMixAudioDeviceInventory/);
assert.match(js,/Audio I\/O Settings/);
assert.match(js,/Driver Recovery…/);
assert.doesNotMatch(js,/Patch CH1|Arm output/);
assert.doesNotMatch(page,/__ARMIX_NATIVE_M2__/,"public approved Pages must remain byte-identical");
assert.match(builder,/const channelOptions=\(t,type\)=>/);
assert.match(builder,/Array\.isArray\(x\)\?x\[0\]:x/);
assert.match(builder,/approved-native-io\.css/);
assert.match(main,/action=="routingSourceSwitch"/);
assert.match(main,/engine_\.liveOutputArmFault\(\)/);
assert.match(main,/safe->emitApprovedNativeSnapshot\(\)/);
assert.match(engine,/juce::String switchDryRoutingLabSource\(/);
assert.match(engine,/setOutputMuted\(true\)/);
});
test("G0 M4 real mixer fader/pan/mute/solo work before universal ChannelId admission",()=>{
const js=read("web/approved-native-bridge.js");
const main=read("src/Main.cpp");
const dry=read("src/LiveDryRoutingLab.h");
assert.match(js,/verifiedM4\(\)/);
assert.match(js,/m4Parameter\(t,"faderDb",numeric\)/);
assert.match(js,/m4Parameter\(t,"pan",pan\)/);
assert.match(js,/m4Parameter\(t,action,!t\[action\]\)/);
assert.match(js,/channel:channel\+1,value,routeEpoch:epoch,routeRevision:revision/);
assert.match(js,/renderMeasuredM4\(live\)/);
assert.match(js,/channelPeaksL/);
assert.match(js,/channelPeaksR/);
assert.match(main,/accepted=engine_\.setDryRoutingLabParameter\(channel-1/);
assert.match(main,/arMixM4ControlAck/);
assert.match(dry,/publisher_\.updateActiveControl\(expectedEpoch,expectedRevision/);
});

30 changes: 30 additions & 0 deletions tests/native_dry_route_command_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
#include "../engine/core/NativeDryRouteCommand.h"
#include "../engine/core/PreparedMixerBlock.h"
#include "../src/NativeVerifiedSourcePatch.h"
#if defined(NDEBUG)
#undef NDEBUG
#endif
Expand Down Expand Up @@ -139,6 +140,35 @@ int main(){
assert(near(l[0],0.5f*0.70710678118f));
assert(near(r[0],0.5f*0.70710678118f));

// Audition-style IN=None on ANY previously routed native channel is a
// complete typed source patch, not an invalid physical input/guessed pin.
// The accepted reference stays unchanged until the graph is republished.
auto sourceTemplate=juce::JSON::parse(juce::JSON::toString(typed,false));
sourceTemplate.getDynamicObject()->setProperty("deviceEpoch",juce::int64(91));
sourceTemplate.getDynamicObject()->setProperty("revision",juce::int64(7));
sourceTemplate.getDynamicObject()->setProperty("sends",
juce::var(juce::Array<juce::var>{}));
juce::var noSource,invalidClear;
assert(NativeVerifiedSourcePatch::prepare(sourceTemplate,0,"NONE",-1,-1,
ports,91,7,noSource).isEmpty());
const auto cleared=noSource.getProperty("channels",{}).getArray()->getReference(0);
assert(cleared.getProperty("mode",{}).toString()=="NONE");
assert(cleared.getProperty("sourceKind",{}).toString()=="NONE");
assert(cleared.getProperty("sourceFormat",{}).toString()=="NONE");
assert(static_cast<int>(cleared.getProperty("left",0))==-1);
assert(static_cast<int>(cleared.getProperty("right",0))==-1);
assert(sourceTemplate.getProperty("channels",{}).getArray()
->getReference(0).getProperty("mode",{}).toString()=="MONO");
assert(NativeVerifiedSourcePatch::prepare(sourceTemplate,0,"NONE",2,-1,
ports,91,7,invalidClear).isNotEmpty());
assert(invalidClear.isVoid());
assert(NativeVerifiedSourcePatch::prepare(sourceTemplate,0,"NONE",-1,-1,
ports,92,7,invalidClear).isNotEmpty()); // wrong driver epoch
NativeDryRouteCommand clearedPlan;
assert(NativeDryRouteCommand::decode(noSource,clearedPlan,error));
assert(clearedPlan.channels.stripsAndMaster.strips[0].source==SourceMode::disconnected);
assert(clearedPlan.channels.formats[0]==ChannelFormat::stereo);

// Fail-closed: one type mismatch, old decoded plan unchanged.
const auto before=v2;
auto* ch0=typed.getProperty("channels",juce::var())
Expand Down
Loading
Loading