Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
> **M2 UNIFIED FX CONSOLE / BUS WORKFLOW 2026-10-31 (BRANCH IN VALIDATION):** Read docs/M2_UNIFIED_CONSOLE_BUS_WORKFLOW_20261031.md before editing FX Rack/bus routing. Current branch unifies CH1–10 FX Rack UI using one presenter and offers real +BUS/+FX BUS using an otherwise unused native 10CH lane and existing muted native ACK. It intentionally does NOT remove CH1's legacy vendor VST3 lease, create dynamic CH11, implement native MASTER FX/PDC, or certify physical #15 FAT. Protect device + SOURCE PR #228/#231/#232/#233, Show/Orbit, one JUCE callback, epoch revision ACK, and AGENTS product truth. The next major engine milestone is real per-ChannelId FxRack/Show migration, not another cosmetic branch.

> **LATEST CROSS-THREAD STATUS (2026-10-31, main after #234):** Read [M1/M2 & release reconciliation](docs/RECONCILED_PROGRESS_M1_M2_20261031.md) FIRST. DEVICE2+SOURCE2 are merged together in #234 (`7db4ab70`); #232 closed superseded, never merge its old head. #235 M2 FX/BUS is OPEN with Chromium regressions and not production; #229/#225 FactoryFX overlap and need selective reconcile. The native Windows FAT ZIP from `main@a7fb6151` predates #234; use a newer successful main artifact when published. No MAONO/WASAPI hardware FAT or #15 zero-VST crackle clearance, and FactoryFX approved lock still empty. Older AGENTS milestones below are historical if they conflict. Preserve one JUCE device owner, one native graph/route authority, stable L2/RAIL3, and explicit native ACK / output safety.

> **DEVICE1 CUSTOM DEVICE SETUP MERGED #228 (2026-10-31) — CI PASS, PHYSICAL FAT PENDING:** Read [PRD](docs/PRD_CUSTOM_AUDIO_DEVICE_SETUP_20261031.md), [ARD](docs/ARD_CUSTOM_AUDIO_DEVICE_SETUP_20261031.md) and [per-file handoff](docs/HANDOFF_CUSTOM_AUDIO_DEVICE_SETUP_20261031.md) before touching AUDIO DEVICE / DEVICE-DRIVER / ASIO / WASAPI. Existing WebView2 Audio I/O Matrix must become the SINGLE real device setup UI: backend, actual capture/playback endpoints, sample rate, buffer, enabled pins, APPLY with verified JUCE readback, fail-closed muted rollback. Keep ONE existing AudioDeviceManager, native routing epoch/ACK, MAIN/MONITOR/OUTPUT1/FX and #15 gate. Now DEVICE/DRIVER in the existing WebView2 matrix selects actual JUCE-reported ASIO/WASAPI/DirectSound backend, input/output endpoints, rate, buffer and verified pin masks; its native APPLY, muted rollback, readback and requestId ACK were merged in #228 at e0eaeafe88b9fdc997f3f6e7856331679db1ba7b. The old AudioDeviceSelectorComponent remains only a C++ engineering fallback and is NOT the normal UI. Physical MAONO/WASAPI FAT, vendor driver hangs and #15 0FX crackle remain UNQUALIFIED. Driver scans/opens may block vendor code: don't claim async bridge eliminates freeze; audit pinned JUCE thread affinity and instrument physical hangs. No second hardware setup UI, manager, audio graph or naive per-dropdown device restart.
Expand Down
39 changes: 39 additions & 0 deletions docs/M2_UNIFIED_CONSOLE_BUS_WORKFLOW_20261031.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# M2 — Studio-style console FX parity and native BUS staging
2026-10-31 | user-visible implementation on existing native 10-input/4-AUX graph.
Owner: #192 dynamic channels, #95 VST3/FX/PDC. No certified physical results claimed.

## Reference behavior
Official Fender Studio Pro / Studio One console manual:
https://fenderstudiopromanual.fender.com/en/Content/Mixing_Topics/Effects_Signal_Routing.htm
https://fenderstudiopromanual.fender.com/en/Content/Mixing_Topics/The_Console.htm
Audio, Bus and FX strips use inserts/sends, subgroup output sums into bus, FX send can preserve dry direct-to-MAIN, nested buses require feedback prevention. Match the operation semantics and accessible actions rather than copying branding/code/assets.

## What this branch actually implements
- One presentation pipeline in web/bridge.js: fxLaneSnapshot, fxSlotMarkup and renderRack generate exactly the same 8-row FX workspace and 6 compact strip slots for existing CH1–10. No second visual CH1 renderer. All displayed loaded/bypass states come from real JUCE CH1 chain or native routed VST3 ACK. Unpatched lanes are disabled and clearly marked, not fake active FX.
- CH1 existing VST3 lease, plugin state/Orbit, existing native bypass/move and Show remain unchanged. Other CHs keep their real routed VST3 controller. This only unifies the UI adapter and preserves audio identity until native instance-owner migration is safe.
- + BUS from selected connected CH stages an otherwise unused native CH as BUS receiver, source direct MAIN off, unity POST send to the BUS, BUS MAIN on. Avoid doubled dry signal. Operator must MUTE outputs, APPLY and wait for positive native routing ACK before it sounds.
- + FX BUS stages a separate BUS receiver with 0.25 linear POST send while source still feeds MAIN; the FX BUS inserts can then host real native VST3. No fake reverb added automatically.
- Real native channel-send DAG validation guards self-feedback, cycles, duplicates and resource limits. The wizard also rejects pending drafts, dirty graph, stale device epoch, output armed, no source and no spare native strip; rollback restores previous source main and exact spare channel state.
- No new callbacks, WebAudio DSP, allocations in processBlock, serial device changes or plugin lifecycle added. Existing 10-input/4-AUX DSP and ROUTING/MUTE/APPLY/ACK remain sole authority.

## Status boundaries
- This is a meaningful console workflow and native routing feature, NOT yet full Studio One parity.
- LIVE channel add/remove and arbitrary named buses remain unimplemented. Current +BUS reuses one of the TEN available native strips and explicitly fails when full. User may use that strip for a Vocal/Drum/FX Bus but cannot create CH11 yet.
- CH1 native vendor FX and routed FX still have distinct lifecycle paths despite identical UI. MASTER insert FX, PDC and end-to-end zero latency are not implemented. ChannelId dynamic/Show migration remains the next big milestone: replace LegacyChannelOneLease and fixed 10CH path with one prepared graph + one FxRack keyed by ChannelId, preserving Orbit/vendor state and native ACK.
- No claim of complete Studio One visual copy, zero device roundtrip delay, hardware approval or solved #15 crackle.

## Validation and physical FAT
1. Exact-head native Windows compile, CTest, packaging and Chromium smoke; targeted JS contracts enforce single view model and route wizard fail-closed behavior.
2. Under DIRECT ASIO/WASAPI with outputs MUTED: physical Mic CH1 -> BUS on unused CH10 -> MAIN. With output armed after accepted ACK, exactly one path should be audible. Independently physical Mic CH3 -> FX BUS on CH9, CH3 direct MAIN remains while CH9 processes real reverb VST3.
3. Channel 1, 3, 9 and 10 six FX rows identical in geometry and operator workflow. No ghost live inserts, source/output stays correct, no dropped plugin editor lease/Show state. Bus routing status must only become live after positive ACK.
4. Reject: output armed, source NONE, prior dirty draft, full 10 native channels, obsolete epoch, feedback cycles, VST add failure; preserve previous audible graph.
5. Hardware #15: 0FX baseline and real wired ASIO/WASAPI low buffer (32/64/128), 44.1/48/96k, 30-minute soak, silence/dropout/crackle and low-spec GUI. Only mark product FAT passed after measured evidence.

## Follow-up architecture gate, no parallel DSP
Only one live native ChannelId-based graph, same native instance lease for CH1..N, FX bus, group and main, topology precompile control-thread, stable ID, full VST3 state, safe de-click handoff and PDC. Do not merge any old 10CH prototype branch into main to simulate dynamic add. Check current main and #232 device-owner PR before changes to JUCE audio graph.

## M2B integrated milestone: Multi-source BUS and FX SEND routing
- A previously ACKed BUS can now accept multiple native CH inputs through the same FX Rack using SEND TO EXISTING BUS → OUTPUT → BUS or FX SEND → BUS.
- Exclusive group routing disables source direct MAIN, unity POST to BUS; parallel FX sends at linear .25 retain direct dry MAIN. Native DAG prevents feedback/self-loop and a duplicate edge. BUS-to-BUS nesting only when legal.
- Reuses existing audio graph, 10-CH capacity, same epoch/revision/MUTE/APPLY/ACK. Safe failure retains previously accepted route. A BUS is selectable only after native ACK, not a browser draft.
- No falsely claimed arbitrary new runtime channels/independent FX bus role, native master VST/PDC, physical latency or #15 FAT.
2 changes: 1 addition & 1 deletion tests/fx_drag_reorder_contract_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test('DAW reorder preserves real chain identity, metadata, and bypass',()=>{
});
test('native has six consistent empty inserts and one DSP reorder per drop',()=>{
assert.match(bridge,/Array.from\(\{length:6\}/);
assert.match(bridge,/Math.max\(0,6-Math.min\(state.chain.length,6\)\)/);
assert.match(bridge,/Array\.from\(\{length:6\},\(_,slot\)=>fxSlotMarkup\(lane,slot,true\)\)/);
assert.match(bridge,/fx-drag-ghost/);
assert.match(bridge,/send\("fxMove",\{slot:from,value:to-from\}\)/);
assert.doesNotMatch(bridge,/FX FULL/);
Expand Down
2 changes: 1 addition & 1 deletion tests/live_routing_ui_contract_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test("GUI exposes only truthful dry device routes and acknowledged commit",()=>{
assert.match(main,/arMixRoutingLabAck/);
// Default 10 fake preview strips are intentionally not made into VST3
// controls by the dry hardware test.
assert.match(bridge,/if\(i!==0\)/);
assert.match(bridge,/const lane=fxLaneSnapshot\(i\)/);
assert.match(bridge,/track\.dataset\.preview="1"/);
});

Expand Down
114 changes: 114 additions & 0 deletions tests/mixer_io_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,36 @@ async def main():
assert "LIVE" in await page.locator('[data-strip="0"] .arBankStage').inner_text()
assert 'Microphone 1' in await page.locator('[data-focus-source]').inner_text()
assert 'MAIN' in await page.locator('[data-focus-out]').inner_text()
# M2 Studio-style BUS: one existing empty native lane, no phantom
# CH11; group re-routes direct MAIN, parallel FX BUS preserves dry.
# Both remain DRAFT until the operator explicitly MUTES/APPLIES/ACKs.
group=await page.evaluate("""()=>({
result:window.__arMixStageBusFromSelected({source:0,kind:'group'}),
view:window.__arMixRouteView()
})""")
assert group['result']['ok'],group
bus=group['result']['target']
assert group['view']['draftRoutes'][bus]['mode']=='BUS',group
assert group['view']['draftRoutes'][bus]['gain']==1,group
assert group['view']['draftRoutes'][0]['main'] is False,group
assert any(x['from']==0 and x['to']==bus and x['gain']==1
for x in group['view']['draftSends']),group
assert (await page.evaluate("""()=>window.__armixTestActions.filter(
x=>x.name==='arMixAction'&&x.data.action==='routingDryApply').length"""))==1
assert (await page.evaluate("()=>window.__arMixRevertMixerDraft()"))['ok']
await page.locator('#arRouteClose').click()
fxbus=await page.evaluate("""()=>({
result:window.__arMixStageBusFromSelected({source:0,kind:'fx'}),
view:window.__arMixRouteView()
})""")
assert fxbus['result']['ok'] and fxbus['result']['target']==bus,fxbus
assert fxbus['view']['draftRoutes'][0]['main'] is True,fxbus
assert any(x['from']==0 and x['to']==bus and x['gain']==.25
for x in fxbus['view']['draftSends']),fxbus
assert (await page.evaluate("()=>window.__arMixRevertMixerDraft()"))['ok']
await page.locator('#arRouteClose').click()
assert (await page.evaluate("""()=>window.__armixTestActions.filter(
x=>x.name==='arMixAction'&&x.data.action==='routingDryApply').length"""))==1
await page.locator('[data-focus-step="fx"]').click()
assert await page.locator('#mixer').get_attribute('data-io-mode')=='FX'
await page.locator('[data-focus-step="source"]').click()
Expand Down Expand Up @@ -745,6 +775,90 @@ async def main():
assert await page.locator('[data-source-alias-save]').is_disabled()
await page.screenshot(path="mixer-patch1-maono-ch3-ch6-1366.png")
assert not errors,errors
# M2B independent browser-native routing graph (same browser process):
# create group, ACK, route a second CH into that same existing BUS.
bp=await browser.new_page(viewport={"width":1366,"height":768})
bus_errors=[]
bp.on("pageerror",lambda e:bus_errors.append(str(e)))
await bp.add_init_script("""(()=>{
const listeners={};window.__armixTestActions=[];
window.__JUCE__={backend:{
addEventListener(name,fn){(listeners[name]??=[]).push(fn)},
emitEvent(name,data){window.__armixTestActions.push({name,data})}
}};
window.__armixTestEmit=(name,data)=>(listeners[name]||[]).forEach(fn=>fn(data));
})();""")
await bp.goto((root/"web/index.html").as_uri())
await bp.evaluate("""()=>{
const channels=Array.from({length:10},(_,i)=>({
mode:i<2?'MONO':'NONE',channelFormat:'MONO',left:i<2?i:-1,
right:-1,gain:.25,pan:0,main:true,mute:false,solo:false,
fxId:'',fxIds:[]}));
const auxes=Array.from({length:4},()=>({
enabled:false,gain:1,main:true,mute:false,fxId:'',fxIds:[]}));
const d={active:true,ready:true,epoch:45,revision:3,
ports:[{port:0,label:'Mic 1'},{port:1,label:'Mic 2'}],
outputPorts:[0,1],channelControls:[],
acceptedRoute:{deviceEpoch:45,channels,auxes,sends:[]}};
window.__busDevice={connected:true,driver:'ASIO',
monitor:false,chainCount:0,dryRoutingLab:d};
window.__armixTestEmit('arMixStatus',window.__busDevice);
}""")
created=await bp.evaluate("""()=>({
action:window.__arMixStageBusFromSelected({source:0,kind:'group'}),
draft:window.__arMixRouteView()})""")
assert created['action']['ok'],created
bus=created['action']['target']
assert created['draft']['draftRoutes'][bus]['mode']=='BUS',created
assert created['draft']['draftRoutes'][bus]['gain']==1,created
assert created['draft']['draftRoutes'][0]['main'] is False,created
assert not await bp.evaluate("""()=>window.__armixTestActions.some(
x=>x.data?.action==='routingDryApply')""")
await bp.locator('#arRouteApply').click()
assert await bp.evaluate("""()=>window.__armixTestActions.some(
x=>x.data?.action==='routingDryApply')""")
await bp.evaluate("""()=>{
const view=window.__arMixRouteView();
const d=window.__busDevice.dryRoutingLab;
d.acceptedRoute={...d.acceptedRoute,
channels:view.draftRoutes,auxes:view.draftAux,sends:view.draftSends};
d.revision=4;
window.__armixTestEmit('arMixRoutingLabAck',{ok:true,state:d});
window.__armixTestEmit('arMixStatus',window.__busDevice);
}""")
await bp.locator('#arRouteClose').click()
await bp.locator('[data-view="FX RACK"]').click()
await bp.evaluate('()=>{currentChannel=1;renderRackWorkspace()}')
assert await bp.locator('#rackWorkspace [data-bus-target] option').count()==1
assert await bp.locator('#rackWorkspace [data-bus-target]').input_value()==str(bus)
# Existing BUS accepts a second input; no new strip is allocated.
await bp.locator('#rackWorkspace [data-bus-assign="group"]').click()
send=await bp.evaluate('()=>window.__arMixRouteView()')
assert send['draftRoutes'][1]['main'] is False,send
assert send['draftRoutes'][bus]['mode']=='BUS',send
assert len(send['draftSends'])==2,send
assert any(e['from']==1 and e['to']==bus and e['gain']==1
for e in send['draftSends']),send
assert len(await bp.evaluate("""()=>window.__armixTestActions.filter(
x=>x.data?.action==='routingDryApply')"""))==1
assert (await bp.evaluate('()=>window.__arMixRevertMixerDraft()'))['ok']
await bp.locator('#arRouteClose').click()
await bp.locator('[data-view="FX RACK"]').click()
await bp.evaluate('()=>{currentChannel=1;renderRackWorkspace()}')
await bp.locator('#rackWorkspace [data-bus-assign="fx"]').click()
fxsend=await bp.evaluate('()=>window.__arMixRouteView()')
assert fxsend['draftRoutes'][1]['main'] is True,fxsend
assert any(e['from']==1 and e['to']==bus and e['gain']==.25
for e in fxsend['draftSends']),fxsend
assert (await bp.evaluate('()=>window.__arMixRevertMixerDraft()'))['ok']
self_cycle=await bp.evaluate("""target=>window.__arMixStageSendToBus({
source:target,target,kind:'fx'})""",bus)
assert not self_cycle['ok'] and 'Feedback' in self_cycle['error']
duplicate=await bp.evaluate("""target=>window.__arMixStageSendToBus({
source:0,target,kind:'fx'})""",bus)
assert not duplicate['ok'] and 'already' in duplicate['error']
assert not bus_errors,bus_errors
await bp.close()
await browser.close()
print("PASS: G1/G2 + G3 real PRE/POST draft, AUX return, 0-gain bypass, native ACK/reject/revert, stable rack and 3 viewports")

Expand Down
4 changes: 2 additions & 2 deletions tests/mixer_shell_contract_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ test('L2 route and VST inserts use one consistent six-row native rack with locke
assert.match(src,/master-locked-six/);
assert.match(src,/class="master-insert insert empty" disabled aria-disabled="true"/);
assert.match(src,/slot===0\?"FX UNAVAILABLE":"ADD FX"/);
assert.match(src,/class="fx-power \$\{actual\.bypassed\?"is-bypassed":""\}"/);
assert.match(src,/loaded\?"":'<span class="insert-add-glyph"/);
assert.match(src,/class="fx-power /);
assert.match(src,/function fxSlotMarkup\(lane,slot,compact=false\)/);
assert.match(css,/@media\(max-height:690px\)\{[\s\S]*?--ar-upper-height:165px/);
});

Expand Down
4 changes: 2 additions & 2 deletions tests/native_ui_contract_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ test('native meter reads DSP and hides only the nine unrouted input channels',()
assert.ok(bridge.includes("meter-fill{opacity:0!important}"));
});
test('quick FX bypass is wired to native slot instead of demo mock',()=>{
assert.match(bridge,/data-native-fx="bypass" data-slot="\$\{i\}"/);
assert.match(bridge,/aria-pressed="\$\{!p\.bypass\}"/);
assert.match(bridge,/data-native-fx="bypass" data-slot=/);
assert.match(bridge,/aria-pressed/);
assert.match(bridge,/send\("fxBypass",\{slot,value:!state\.chain\[slot\]\?\.bypass\}\)/);
assert.match(engine,/graphOwned_->bypassFlags\[physical\]\.store/);
assert.match(engine,/bypassEnvelope\[physical\]/);
Expand Down
Loading
Loading