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
18 changes: 17 additions & 1 deletion src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,23 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
action.startsWith ("import") || action.startsWith ("fx") ||
action == "addCatalog" || action == "addScanFolder" ||
action == "scanVst3" || action == "routingDryApply"))
return emitNotice ("Studio backup in progress. Finish backup before editing saved FX or VST library.", true);
{
const auto reason=juce::String(
"Studio backup in progress. Finish backup before editing saved FX or VST library.");
// R1 matrix must ALWAYS get a response after APPLY, including
// upstream rejection before the normal routing command handler.
// No graph or device state may be mutated while Studio IO is busy.
if(action=="routingDryApply" && browser_.loaded)
{
auto ack=std::make_unique<juce::DynamicObject>();
ack->setProperty("ok",false);
ack->setProperty("error",reason);
ack->setProperty("state",engine_.status().getProperty("dryRoutingLab",{}));
browser_.emitEventIfBrowserIsVisible(
"arMixRoutingLabAck",juce::var(ack.release()));
}
return emitNotice(reason,true);
}

// Structural plugin operations currently detach the original callback
// and must never mutate a running independent render thread.
Expand Down
12 changes: 12 additions & 0 deletions tests/live_routing_ui_contract_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,15 @@ test("R0 premium workspace is anchored to mixer chrome and lazily opens INTERNAL
assert.match(ui,/routingDryApply/);
assert.match(ui,/hydrateAcceptedRoute/);
});
test("R1 upstream Studio-IO rejection always releases native APPLY pending state",()=>{
const first=main.indexOf('if ((studioBackupBusy_ || nativeShowBusy_)');
const next=main.indexOf('// Structural plugin operations',first);
assert.ok(first>=0&&next>first);
const gate=main.slice(first,next);
assert.match(gate,/action=="routingDryApply"/);
assert.match(gate,/arMixRoutingLabAck/);
assert.match(gate,/setProperty\("ok",false\)/);
assert.match(ui,/patchPending=false/);
assert.match(ui,/if\(patchPending\)return/);
});

13 changes: 13 additions & 0 deletions tests/ui_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,19 @@ async def image_for(selector):
assert action["channels"][0]["left"]==2 and action["channels"][0]["mode"]=="MONO",action
assert action["channels"][1]["left"]==2 and action["channels"][1]["right"]==5,action
assert await native.locator("#arRouteApply").is_disabled()
# Busy Studio IO must reject with native ACK and unlock APPLY (no
# fake LIVE green cell or reinitialization of the user's draft).
await native.evaluate("""()=>{
const d=window.__arPatchStatus.dryRoutingLab;
window.__arMixMockEvents.arMixRoutingLabAck({
ok:false,error:"Studio backup in progress",state:d
});
}""")
assert await native.locator("#arRouteApply").is_enabled()
assert "REJECTED" in await native.locator("#arRouteFeedback").inner_text()
assert await native.locator('[data-patch-row="0"][data-patch-port="2"].arPatchCell').get_attribute("data-patch-state")=="draft"
await native.locator("#arRouteApply").click()
assert await native.locator("#arRouteApply").is_disabled()
await native.evaluate("""()=>{
const d=window.__arPatchStatus.dryRoutingLab;
d.active=true;d.ready=true;d.revision=1;
Expand Down
13 changes: 3 additions & 10 deletions web/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,18 +579,11 @@
if(failure){patchFeedback("REJECTED · "+failure);return;}
if(state.monitor){patchFeedback("MUTE OUTPUT FIRST · structural routing cannot be applied while speakers are armed.");return;}
syncNativeLevelsToRouteDraft();
// patchPreflight above already checked epoch, enabled ports and stereo.
// Enter pending only after *every* synchronous rejection gate has passed.
patchPending=true;
renderPatchMatrix();
if(!draftEpoch || draftEpoch!==Number(d.epoch)){
document.getElementById("arRouteFeedback").textContent=
"DEVICE CHANGED · old channel assignments discarded. Re-select the actual physical inputs.";
drawRoutes();
return; // must never submit old ports with a newly observed epoch
}
if(!Array.isArray(d.ports)||!d.ports.length){
document.getElementById("arRouteFeedback").textContent="Select a real ASIO/WASAPI audio input in AUDIO SETUP first.";return;
}
document.getElementById("arRouteFeedback").textContent="Applying native route (output must be MUTED)...";
document.getElementById("arRouteFeedback").textContent="Applying verified native route (output remains MUTED)...";
api.emitEvent("arMixAction",{action:"routingDryApply",value:{
deviceEpoch:draftEpoch,revision:Number(d.revision)||0,
channels:draftRoutes.map(c=>({...c})),
Expand Down
Loading