From dc5bf5c55372029ee0351d3c9ba0d8f84ea7e935 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:07:33 +0700 Subject: [PATCH 001/155] feat(M5): stable ChannelId VST3 instance lease bank for mono/stereo CH-N Group/FX Return, no RT allocations or catalog remap --- engine/core/DynamicChannelFxLeaseBank.h | 151 ++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 engine/core/DynamicChannelFxLeaseBank.h diff --git a/engine/core/DynamicChannelFxLeaseBank.h b/engine/core/DynamicChannelFxLeaseBank.h new file mode 100644 index 000000000..fe264da0e --- /dev/null +++ b/engine/core/DynamicChannelFxLeaseBank.h @@ -0,0 +1,151 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "DynamicChannelRoster.h" +#include "LiveChannelFxGraph.h" +#include +#include +#include +#include +#include +#include +#include + +// M5 universal ChannelId/VST3 ownership bridge. +// +// Unlike the fixed ten-strip index, this immutable CONTROL-PREPARED table +// follows stable ChannelId across +CHANNEL, +GROUP, FX Return and reorder. +// It holds the exact M4 vendor FxInstance owner leases (binary state, +// parameters, bypass envelope, reverb tail). The audio callback traverses +// RAW pointers only: no shared_ptr refcount, heap, lock, VST instantiation, +// string compare or plugin lookup by catalog name. +// +// The bank must be owned by the SAME published/retired native graph snapshot +// as the PCM schedule. Do not discard it while a callback can render from it. +// Never render a former legacy graph concurrently with its migrated instances. +namespace armix::mixer { +class DynamicChannelFxLeaseBank final { +public: + using FxGraph=LiveChannelFxGraph; + using Lease=FxGraph::InstanceLease; + static constexpr int maxInserts=FxGraph::maxInsertsPerStrip; + + struct Assignment final { + ChannelId id{}; + ProcessingFormat format=ProcessingFormat::stereo; + std::vector inserts; // CONTROL only; no creation on callback + }; + + enum class Fault : std::uint8_t { + none,invalidEpoch,emptyId,duplicateChannel,tooManyInserts, + emptyLease,duplicateInstance,invalidBusLayout,missingLegacyIdentity + }; + DynamicChannelFxLeaseBank()=default; + DynamicChannelFxLeaseBank(const DynamicChannelFxLeaseBank&)=delete; + DynamicChannelFxLeaseBank& operator=(const DynamicChannelFxLeaseBank&)=delete; + DynamicChannelFxLeaseBank(DynamicChannelFxLeaseBank&&)=default; + DynamicChannelFxLeaseBank& operator=(DynamicChannelFxLeaseBank&&)=default; + + // Used by message-thread M4->M5 migration. There is no fallback by + // slot position or catalog ID: an actual opaque M4 instance token is + // required, so a Show/reorder cannot accidentally acquire another plugin. + static bool captureLegacy(int lane,ChannelId nativeId, + ProcessingFormat format, + const FxGraph& prior, + Assignment& destination) { + if(lane<0||lane>=FxGraph::fxSlots||!nativeId.value)return false; + Assignment staged; + staged.id=nativeId;staged.format=format; + for(int slot=0;slotinstanceId!=token)return false; + staged.inserts.push_back(std::move(owner)); + } + destination=std::move(staged); + return true; + } + + static Fault prepare(std::uint64_t epoch,std::uint64_t revision, + std::span bindings, + DynamicChannelFxLeaseBank& destination) { + if(!epoch||!revision)return Fault::invalidEpoch; + DynamicChannelFxLeaseBank candidate; + candidate.epoch_=epoch;candidate.revision_=revision; + candidate.rows_.reserve(bindings.size()); + for(const auto& b:bindings) { + if(!b.id.value)return Fault::emptyId; + if(b.inserts.size()>static_cast(maxInserts)) + return Fault::tooManyInserts; + if(b.format!=ProcessingFormat::mono && + b.format!=ProcessingFormat::stereo)return Fault::invalidBusLayout; + Row row;row.id=b.id;row.format=b.format; + row.count=static_cast(b.inserts.size()); + for(std::size_t i=0;iprocessor)return Fault::emptyLease; + // M4's preparation verifies a stereo processor layout for + // both mono-as-dual and stereo strips. Other plugin layouts + // must be negotiated explicitly before a future PCM cutover. + if(owner->processor->getTotalNumInputChannels()!=2 || + owner->processor->getTotalNumOutputChannels()!=2) + return Fault::invalidBusLayout; + for(const auto& existing:candidate.rows_) + for(std::size_t k=0;kcount:0; + } + const Lease* ownerForControl(ChannelId id,std::size_t slot) const noexcept { + const auto* p=find(id);return p&&slotcount?&p->owners[slot]:nullptr; + } + + // Process each M4 VST exactly once at its target ChannelId. CPU work is + // proportional to that node's FX rack, not every Channel in the session. + // Call only on the native audio thread after epoch/revision graph admission. + void operator()(ChannelId id,float* left,float* right,int frames) const noexcept { + const Row* row=find(id); + if(!row)return; // a genuinely dry ChannelId or MASTER + if(!left||!right||left==right||frames<=0)return; + for(std::size_t i=0;icount;++i) + row->raw[i]->render(left,right,frames); + } + +private: + struct Row final { + ChannelId id{}; + ProcessingFormat format=ProcessingFormat::stereo; + std::uint8_t count=0; + std::array owners{}; + std::array raw{}; + }; + const Row* find(ChannelId id) const noexcept { + const auto it=std::lower_bound(rows_.begin(),rows_.end(),id.value, + [](const Row& row,std::uint64_t value){return row.id.valueid==id?&*it:nullptr; + } + std::vector rows_{}; + std::uint64_t epoch_=0,revision_=0; +}; +} // namespace armix::mixer From d7bdd4c0c5947af8a77bafa34385511580a2ff41 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:08:04 +0700 Subject: [PATCH 002/155] feat(M5): expose epoch/revision-gated M4 FX lease migration to stable ChannelIds on control thread --- src/LiveDryRoutingLab.h | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index ae28b5f16..dfc48de8d 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -3,6 +3,7 @@ #include "../engine/core/PreparedMixerBlock.h" #include "../engine/core/MasterOutputMonoPolicy.h" #include "../engine/core/LiveChannelFxGraph.h" +#include "../engine/core/DynamicChannelFxLeaseBank.h" #include "VstBusLayout.h" #include "../engine/core/NativeDryRouteCommand.h" #include "../engine/device/JuceActivePortSnapshot.h" @@ -567,6 +568,57 @@ class LiveDryRoutingLab final { return true; } + // M5 native ChannelId VST3 migration: capture actual current M4 vendor + // processor LEASES, not catalog names or copied binary state. The writer + // must hold these control-owned leases within its new published dynamic + // PCM snapshot until final callback retirement. No callback activity, + // device reopen, preset restoration or rack instantiation occurs here. + // The host's special legacy CH1 external chain remains a SEPARATE lease; + // do not cut over a loaded external CH1 graph without transferring it. + bool captureDynamicFxLeases( + std::uint64_t expectedEpoch,std::uint64_t expectedRevision, + std::span laneIds, + armix::mixer::DynamicChannelFxLeaseBank& destination, + juce::String& error) const { + using Bank=armix::mixer::DynamicChannelFxLeaseBank; + if(laneIds.size()!=static_cast(fxSlots) || + !hasExplicitRoute() || !ready() || + expectedEpoch!=epoch() || expectedRevision!=revision()) { + error="M5: native epoch/revision or 10CH+4AUX FX roster stale"; + return false; + } + const FxGraph* current=publisher_.controlPrepared(expectedEpoch,expectedRevision); + if(!current) { + error="M5: no current M4 prepared vendor FX graph"; + return false; + } + std::vector staged; + staged.reserve(fxSlots); + for(int lane=0;lane(lane)], + format,*current,slot)) { + error="M5: failed to retain M4 VST3 token for lane "+ + juce::String(lane); + return false; + } + staged.push_back(std::move(slot)); + } + const auto fault=Bank::prepare(expectedEpoch,expectedRevision,staged, + destination); + if(fault!=Bank::Fault::none) { + error="M5: ChannelId VST lease migration rejected, fault "+ + juce::String(static_cast(fault)); + return false; + } + error.clear(); + return true; + } + // Live, nonstructural FX power control; all guards bound to a real ACK. bool setFxBypass(int lane,int slot,std::uint64_t expectedEpoch, std::uint64_t expectedRevision,const juce::String& token, From 09f2c0c46d65306a671d2b6b9b797a32118f2dc2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:08:56 +0700 Subject: [PATCH 003/155] test(M5): render real JUCE FX on CH1, CH11, Group and FX Return with one prepared PCM, state retention and zero RT heap --- tests/live_channel_fx_graph_test.cpp | 118 +++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index d437b1579..aee035e38 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -1,5 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only #include "../engine/core/LiveChannelFxGraph.h" +#include "../engine/core/DynamicChannelFxLeaseBank.h" +#include "../engine/core/DynamicNativeSessionPublisher.h" #include "../engine/core/NativeOutputPairTap.h" #include "../engine/core/RealtimeRoutePublisher.h" #if defined(NDEBUG) @@ -87,7 +89,123 @@ static std::unique_ptr makeGraph(float firstFx,float returnF assert(graph->maxFramesPerPlugin()==32); // clamp minimum safe plugin quantum return graph; } +// M5: real M4 JUCE plugin instances survive ChannelId graph migration. +// CH11 and FX Return are not borrowed legacy strips: they receive their own +// native processor leases and execute in the same prepared PCM schedule. +static void verifyUniversalChannelIdFxLeaseAndLivePcm() { + using Bank=DynamicChannelFxLeaseBank; + DynamicChannelRoster roster; + std::array adds{}; + for(int i=0;i<4;++i) { + auto& op=adds[static_cast(i)]; + op.kind=ChannelEdit::Kind::add; + op.position=static_cast(i); + op.role=i==2?ChannelRole::fxReturn:i==3?ChannelRole::main:ChannelRole::input; + op.format=i<2?ProcessingFormat::mono:ProcessingFormat::stereo; + op.text=i==0?"CH1":i==1?"CH11":i==2?"FX RETURN":"MAIN"; + } + const auto created=roster.edit(0,adds); + assert(created.ok()&&created.createdIds.size()==4); + const auto ch1=created.createdIds[0],ch11=created.createdIds[1]; + const auto ret=created.createdIds[2],main=created.createdIds[3]; + std::vector wire; + const auto link=[&](ChannelId src,ChannelId dst,bool primary, + float gain=1.f) { + ChannelEdit op;op.kind=ChannelEdit::Kind::addSendReference; + op.id=src;op.target=dst;op.value=gain;op.primaryOutput=primary; + wire.push_back(std::move(op)); + }; + link(ch1,main,true); + link(ch11,main,true); + link(ret,main,true); + link(ch11,ret,false,.5f); + ChannelEdit marker;marker.kind=ChannelEdit::Kind::addInsertReference; + marker.id=ret;marker.text="native-vst3-fx-return"; + wire.push_back(std::move(marker)); + assert(roster.edit(roster.revision(),wire).ok()); + const std::array selected{ch1,ch11}; + const auto group=roster.createBusForSelected( + roster.revision(),selected,"VOCAL GROUP",ChannelRole::group); + assert(group.ok()&&group.createdIds.size()==1); + const auto bus=group.createdIds[0]; + assert(roster.find(ch11)->primaryOutput==bus); + assert(roster.find(bus)->primaryOutput==main); + + DynamicGraphRequest req; + req.physicalInputs=2;req.maxFrames=64; + req.sources={{ch1,0,-1,false},{ch11,1,-1,false}}; + DynamicNativeSessionPublisher native; + constexpr std::uint64_t epoch=991; + assert(native.commit(roster,req,0,epoch,epoch,true).ok()); + + auto original=makeGraph(2.f,3.f); + Bank::Assignment first,groupOwner; + assert(Bank::captureLegacy(0,ch1,ProcessingFormat::mono,*original,first)); + assert(Bank::captureLegacy(1,bus,ProcessingFormat::stereo,*original,groupOwner)); + // These are genuinely new CH11/FX Return native instances. The M4 + // vendor processor ownership class and binary state path are reused. + const auto newFx=[&](float g,const char* catalog)->Bank::Lease { + auto p=std::make_unique(g); + p->prepareToPlay(48000.0,64); + return std::make_shared( + std::move(p),juce::String(catalog),juce::String(catalog),64); + }; + Bank::Assignment eleven;eleven.id=ch11;eleven.format=ProcessingFormat::mono; + eleven.inserts.push_back(newFx(4.f,"ch11-gain")); + Bank::Assignment returnFx;returnFx.id=ret;returnFx.format=ProcessingFormat::stereo; + returnFx.inserts.push_back(newFx(2.f,"fx-return-gain")); + std::array assignments{first,eleven,groupOwner,returnFx}; + Bank bank; + assert(Bank::prepare(epoch,native.acceptedRevision(),assignments,bank)== + Bank::Fault::none); + assert(bank.lanes()==4&&bank.insertCount(ch11)==1&& + bank.insertCount(bus)==1&&bank.insertCount(ret)==1); + assert(bank.ownerForControl(ch1,0)&& + (*bank.ownerForControl(ch1,0))->instanceId== + original->insertInstanceId(0,0)); + Bank blocked; + std::array alias{first,groupOwner}; + alias[1].id=ch11; + alias[1].inserts=first.inserts; // same native processor twice + assert(Bank::prepare(epoch,2,alias,blocked)==Bank::Fault::duplicateInstance); + assert(blocked.lanes()==0); + assert(Bank::prepare(epoch,2,assignments,blocked)==Bank::Fault::none); + const auto token=original->insertInstanceId(0,0); + auto migrated=*bank.ownerForControl(ch1,0); + assert(migrated->instanceId==token); + original.reset(); // vendor instances retained by bank, no new VST3 scan + assert(GainFx::living>=4); + std::array mic{},music{},left{},right{}; + mic.fill(.2f);music.fill(.1f); + const float* pins[]{mic.data(),music.data()}; + const auto beforeHeap=heapCalls.load(std::memory_order_relaxed); + assert(native.render(epoch,pins,2,left.data(),right.data(),64,false, + [&bank](ChannelId id,float* l,float* r,int n) noexcept { + bank(id,l,r,n); + })); + assert(heapCalls.load(std::memory_order_relaxed)==beforeHeap); + constexpr float center=.7071067811865475f; + // Main: (CH1 .2*2 + CH11 .1*4) * mono pan * GROUP FX3 + // + CH11 post-send .5 * FX Return VST2 (no extra dry source). + assert(near(left[63],((.2f*2.f+.1f*4.f)*3.f+ + (.1f*4.f)*.5f*2.f)*center)); + assert(near(left[63],right[63])); + assert(native.setChannelMix(epoch,1,bus,.5f,0.f)); + assert(native.render(epoch,pins,2,left.data(),right.data(),64,false, + [&bank](ChannelId id,float* l,float* r,int n) noexcept { + bank(id,l,r,n); + })); + assert(near(left[63],((.2f*2.f+.1f*4.f)*3.f*.5f+ + (.1f*4.f)*.5f*2.f)*center)); + assert(!native.render(epoch+1,pins,2,left.data(),right.data(),64,false, + [&bank](ChannelId id,float* l,float* r,int n) noexcept { + bank(id,l,r,n); + })); + assert(left[63]==0.f&&right[63]==0.f); +} + int main() { + verifyUniversalChannelIdFxLeaseAndLivePcm(); // R0: existing CH1 FX chain may be rendered inside the SAME prepared // ten-channel routing pass, without creating a second plugin or copying // a processor. Verify exactly one call and zero callback heap allocation. From 15ac5f2c57373d8406512693cdd6fc66b1f83ac8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:09:22 +0700 Subject: [PATCH 004/155] test(M5): use verified accepted Group topology and vendor-prepared 32-frame quantum in native PCM --- tests/live_channel_fx_graph_test.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index aee035e38..2a709987d 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -128,15 +128,18 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { roster.revision(),selected,"VOCAL GROUP",ChannelRole::group); assert(group.ok()&&group.createdIds.size()==1); const auto bus=group.createdIds[0]; - assert(roster.find(ch11)->primaryOutput==bus); - assert(roster.find(bus)->primaryOutput==main); + // The accepted routing view, not a UI draft, proves exclusive primary OUT. DynamicGraphRequest req; - req.physicalInputs=2;req.maxFrames=64; + req.physicalInputs=2;req.maxFrames=32; req.sources={{ch1,0,-1,false},{ch11,1,-1,false}}; DynamicNativeSessionPublisher native; constexpr std::uint64_t epoch=991; assert(native.commit(roster,req,0,epoch,epoch,true).ok()); + const auto* view=native.acceptedRouting(epoch,1); + assert(view&&view->find(ch11)&&view->find(bus)); + assert(view->find(ch11)->primaryOutput==bus); + assert(view->find(bus)->primaryOutput==main); auto original=makeGraph(2.f,3.f); Bank::Assignment first,groupOwner; @@ -175,11 +178,11 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { assert(migrated->instanceId==token); original.reset(); // vendor instances retained by bank, no new VST3 scan assert(GainFx::living>=4); - std::array mic{},music{},left{},right{}; + std::array mic{},music{},left{},right{}; mic.fill(.2f);music.fill(.1f); const float* pins[]{mic.data(),music.data()}; const auto beforeHeap=heapCalls.load(std::memory_order_relaxed); - assert(native.render(epoch,pins,2,left.data(),right.data(),64,false, + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, [&bank](ChannelId id,float* l,float* r,int n) noexcept { bank(id,l,r,n); })); @@ -187,21 +190,21 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { constexpr float center=.7071067811865475f; // Main: (CH1 .2*2 + CH11 .1*4) * mono pan * GROUP FX3 // + CH11 post-send .5 * FX Return VST2 (no extra dry source). - assert(near(left[63],((.2f*2.f+.1f*4.f)*3.f+ + assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f+ (.1f*4.f)*.5f*2.f)*center)); - assert(near(left[63],right[63])); + assert(near(left[31],right[31])); assert(native.setChannelMix(epoch,1,bus,.5f,0.f)); - assert(native.render(epoch,pins,2,left.data(),right.data(),64,false, + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, [&bank](ChannelId id,float* l,float* r,int n) noexcept { bank(id,l,r,n); })); - assert(near(left[63],((.2f*2.f+.1f*4.f)*3.f*.5f+ + assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f*.5f+ (.1f*4.f)*.5f*2.f)*center)); - assert(!native.render(epoch+1,pins,2,left.data(),right.data(),64,false, + assert(!native.render(epoch+1,pins,2,left.data(),right.data(),32,false, [&bank](ChannelId id,float* l,float* r,int n) noexcept { bank(id,l,r,n); })); - assert(left[63]==0.f&&right[63]==0.f); + assert(left[31]==0.f&&right[31]==0.f); } int main() { From d5ebc0b6cf005d2f78dc7b90abd55c977f004169 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:10:04 +0700 Subject: [PATCH 005/155] docs(M5): native Group/CH11 FX state migration, global console contract and exact safe cutover/FAT gates --- ...CHANNELID_VST3_LEASE_MIGRATION_20261101.md | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/M5_UNIVERSAL_CHANNELID_VST3_LEASE_MIGRATION_20261101.md diff --git a/docs/M5_UNIVERSAL_CHANNELID_VST3_LEASE_MIGRATION_20261101.md b/docs/M5_UNIVERSAL_CHANNELID_VST3_LEASE_MIGRATION_20261101.md new file mode 100644 index 000000000..9a237de74 --- /dev/null +++ b/docs/M5_UNIVERSAL_CHANNELID_VST3_LEASE_MIGRATION_20261101.md @@ -0,0 +1,38 @@ +# M5 — Universal ChannelId / native VST3 lease migration + +**Scope:** ArSonMix is a realtime live-performance digital mixer, NOT a DAW arranger/editor. This milestone migrates the actual M4 per-channel vendor processor ownership model into a ChannelId-keyed native DSP graph. It is the required shared FX seam for real CH11+, Group and FX Return parity. It does **not** activate the old dry-only M3E #263 pilot in production. + +## Why + +Current shipped M4 supports native VST3 on fixed CH1..CH10 and four AUX lanes, with stateful FX instance identity, bypass fade and correct control-thread retirement. Prior M3E pilot could create a new Group native PCM but refused any existing VST3/AUX/MONITOR/Show. Replacing an accepted M4 mix with an FX-free graph would silently discard reverb and compressor state. This is unacceptable for live karaoke, podcast, streaming or stage use. + +Top global console contracts are consistent: +- Fender Studio Pro: Bus submixes, FX Channel return with independent sends, pre/post send choices, Group channel input fan-in, nested Bus and direct output routing. https://fenderstudiopromanual.fender.com/en/Content/Mixing_Topics/The_Console.htm +- Waves eMotion LV1: Channel and Group processing, separate Aux/FX/Monitor/MATRIX layers and physical routing patches. https://www.waves.com/emotion-lv1-tutorial-4-2-mixer-channels-groups-aux + +## Implemented M5 native architecture + +### `engine/core/DynamicChannelFxLeaseBank.h` +- A **stable ChannelId → M4 FX rack** map. Identities survive reordering and channel-bank viewport changes. Works for arbitrary dynamically admitted Mono/Stereo input, Group, and FX Return IDs; no CH10 borrowing. +- `captureLegacy`: imports each already-accepted M4 native vendor **FxInstance lease** using exact opaque `instanceId`, never a catalog-name substitute or processor recreation. The actual `juce::AudioProcessor`, parameters, binary state, internal delay/reverb tail, bypass envelope and MIDI scratch remain owned. +- `prepare`: one control-thread transaction preallocates and validates mapping, 8-insert bound, mono/stereo Node contract, stereo VST bus layout, missing lease, reused native processor in multiple simultaneous lanes, invalid device epoch or repeated ChannelId. Failed preparation leaves the previously accepted bank unchanged. +- `operator()(ChannelId,float*,float*,frames) noexcept`: callback dispatch is read-only, binary search by immutable ID with raw processor pointers, no `shared_ptr` copy, allocation, waiting, mutex, VST scan, new callback or dynamic catalog lookup. +- **Lifecycle requirement:** lease bank MUST be owned/retired by the SAME native prepared PCM publication/snapshot as its routing plan. A final owner must never disappear inside a callback. Two graphs sharing the same plugin may NOT render concurrently; existing `FxInstance::render` fail-closed atomic gate is an additional safety fence, not a dual-render design. + +### `src/LiveDryRoutingLab.h` +- `captureDynamicFxLeases(expectedEpoch,expectedRevision,ids,...)` now exposes exactly 10 input + 4 AUX M4 VST rack owners for native M5 conversion, from the actual publisher accepted revision. No device switching and no modification to the active M4 graph. Stale/invalid device epochs fail closed. + +### `tests/live_channel_fx_graph_test.cpp` +- Native JUCE `AudioProcessor::processBlock` through ONE `DynamicNativeSessionPublisher` PCM graph: **CH1 FX + CH11 FX → GROUP FX → MAIN** while CH11 also has a parallel POST SEND to an independent FX Return with its own processor. +- Proves an actual output sum with no doubled dry signal and correct -6 dB Group fader, opaque M4 instance token reuse after the old owner graph is retired, no audio-callback heap allocations, one native render, duplicate vendor instance rejection, and wrong-epoch output fail-silent. +- Reuses existing `ARMixLiveChannelFxTests` Windows MSVC/CTest executable; no separate CI matrix and no expensive external vendor plugins for deterministic tests. + +## Integration admission — do not skip + +1. Merge this bank only after exact-head native Windows CTest and test fixture pass. +2. Refactor M3E dynamic publisher to **own Bank alongside native prepared PCM**, so an epoch/revision ACK refers to the same routing + FX instance generation. No separate second render path. Use the M4 off-RT plugin editor/Show save-restore; CH1 legacy external owner must be migrated independently (the legacy routed graph can have an empty CH1 FX lane while the special CH1 host still has FX). Never claim a complete CH1 transfer until that owner is connected. +3. Migrate the entire accepted legacy Show/AUX/PRE/POST/MONITOR/MAIN/secondary output via the existing `LegacyGraphMigration` bridge. Support one hardware device pin mask per accepted render; no hidden coercion to ASIO/OBS. +4. Permit Add Channel/Group/FX Return in the single native producer **after** passing true CH11 mono/stereo, plugin preset state, nested Group and send/monitor tests. Build GUI strip IDs from the exact native ACK. Hardware FAT follows from a Windows executable at that head. +5. Keep existing M4/FAST3 one-APPLY and emergency MUTE, adaptive channel bank R7, P0 #15 0FX crackle evidence and realtime performance counters intact. + +**Honest status:** This is a substantive native FX/state migration seam with real processor PCM tests, **not yet a publicly usable full dynamic Studio One-equivalent Console**. No physical zero-latency guarantee and no field MAONO PS22 FAT has been executed for this M5 branch. From baf6e7fae0aec47ea0b7a3fd9511690133d27d0e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:11:56 +0700 Subject: [PATCH 006/155] feat(M5): bind VST3 owner lease to SAME atomic native PCM snapshot; dispatch exactly once with RT raw pointers --- engine/core/DynamicNativeSessionPublisher.h | 33 +++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index 65b315d8a..d2d697fa2 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -18,9 +18,23 @@ // Never run both renderers or sum their outputs. No browser-only LIVE status. namespace armix::mixer { class DynamicNativeSessionPublisher final { +public: + // Control-owned native FX lifetime travels IN the same accepted PCM + // snapshot. JUCE types stay outside this portable DSP publisher. + struct FxPlan final { + std::shared_ptr owner; // CONTROL-only copy/destruction + void* context=nullptr; // unchanged owner.get(), RT raw pointer + void (*render)(void*,ChannelId,float*,float*,int) noexcept=nullptr; + bool valid() const noexcept { + return (!owner&&!context&&!render) || + (owner&&context==owner.get()&&render); + } + }; +private: struct Prepared final { DynamicPreparedMixerBlock graph; DynamicConsoleRoutingView routing; + FxPlan fx; // SAME lifetime and revision as native PCM graph int physicalInputs=0; bool monitor=false; }; @@ -49,8 +63,12 @@ class DynamicNativeSessionPublisher final { std::uint64_t expectedRevision, std::uint64_t proposedDeviceEpoch, std::uint64_t activeDeviceEpoch, - bool allOutputsDisarmed) { + bool allOutputsDisarmed, + FxPlan fx={}) { CommitResult report;report.revision=publisher_.lastRevision(); + if(!fx.valid()) { + report.fault=Fault::invalidCandidate;return report; + } if(proposedDeviceEpoch==0 || proposedDeviceEpoch!=activeDeviceEpoch) { report.fault=Fault::staleDevice;return report; @@ -76,6 +94,7 @@ class DynamicNativeSessionPublisher final { report.fault=Fault::invalidGraph;return report; } prepared->physicalInputs=request.physicalInputs; + prepared->fx=std::move(fx); // one accepted control-plane publication prepared->monitor=std::any_of(roster.channels().begin(), roster.channels().end(),[](const ChannelStripDefinition& row) { return row.role==ChannelRole::monitor; @@ -143,9 +162,19 @@ class DynamicNativeSessionPublisher final { if(rendering_.test_and_set(std::memory_order_acquire)) { clearOutputs();return false; } + // Prepared FX takes precedence over the legacy external callback. + // NEVER invoke both: that would double-compress or double-reverb. + // Snapshot ownership pins the M4 instance throughout this callback; + // only control-thread retirement releases the shared owner. + const auto dispatch=[&](ChannelId id,float* l,float* r,int n) noexcept { + const auto& acceptedFx=snap->prepared->fx; + if(acceptedFx.render) + acceptedFx.render(acceptedFx.context,id,l,r,n); + else effect(id,l,r,n); + }; const bool ok=snap->prepared->graph.process( physical,physicalCount,mainL,mainR,frames, - std::forward(effect),monitorL,monitorR); + dispatch,monitorL,monitorR); rendering_.clear(std::memory_order_release); if(!ok)clearOutputs(); return ok; From 9184a901d1d48f86e6f4e30e89b3d84e78956b1c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:12:28 +0700 Subject: [PATCH 007/155] test(M5): bind real JUCE FX bank to same native PCM snapshot, reject pointer mismatch, no duplicate plugin render, retain through graph republish --- tests/live_channel_fx_graph_test.cpp | 53 ++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 2a709987d..1cd2df115 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -159,7 +159,8 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { returnFx.inserts.push_back(newFx(2.f,"fx-return-gain")); std::array assignments{first,eleven,groupOwner,returnFx}; Bank bank; - assert(Bank::prepare(epoch,native.acceptedRevision(),assignments,bank)== + // The accepted FX owner and native PCM must share the NEXT graph revision. + assert(Bank::prepare(epoch,native.acceptedRevision()+1,assignments,bank)== Bank::Fault::none); assert(bank.lanes()==4&&bank.insertCount(ch11)==1&& bank.insertCount(bus)==1&&bank.insertCount(ret)==1); @@ -178,14 +179,36 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { assert(migrated->instanceId==token); original.reset(); // vendor instances retained by bank, no new VST3 scan assert(GainFx::living>=4); + auto acceptedOwner=std::make_shared(std::move(bank)); + DynamicNativeSessionPublisher::FxPlan ownerPlan; + ownerPlan.owner=std::static_pointer_cast(acceptedOwner); + ownerPlan.context=acceptedOwner.get(); + ownerPlan.render=+[](void* ctx,ChannelId id,float* l,float* r,int n) noexcept { + (*static_cast(ctx))(id,l,r,n); + }; + assert(ownerPlan.valid()); + // A mismatched raw callback context cannot be published or overwrite a + // working hardware graph. This is not a UI flag or an unchecked pointer. + auto wrong=ownerPlan;wrong.context=nullptr; + assert(native.commit(roster,req,1,epoch,epoch,true,std::move(wrong)).fault== + DynamicNativeSessionPublisher::Fault::invalidCandidate); + assert(native.acceptedRevision()==1); + assert(native.commit(roster,req,1,epoch,epoch,true,ownerPlan).ok()); + assert(native.acceptedRevision()==2); + // Only the accepted snapshot retains the vendor bank; local control + // holders can retire without losing a live VST during callback. + acceptedOwner.reset(); std::array mic{},music{},left{},right{}; mic.fill(.2f);music.fill(.1f); const float* pins[]{mic.data(),music.data()}; + int legacyFallbackCalls=0; + const auto legacyFx=[&](ChannelId,float*,float*,int) noexcept { + ++legacyFallbackCalls; + }; const auto beforeHeap=heapCalls.load(std::memory_order_relaxed); assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, - [&bank](ChannelId id,float* l,float* r,int n) noexcept { - bank(id,l,r,n); - })); + legacyFx)); + assert(legacyFallbackCalls==0); // never dual-render M4 + M5 assert(heapCalls.load(std::memory_order_relaxed)==beforeHeap); constexpr float center=.7071067811865475f; // Main: (CH1 .2*2 + CH11 .1*4) * mono pan * GROUP FX3 @@ -193,17 +216,25 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f+ (.1f*4.f)*.5f*2.f)*center)); assert(near(left[31],right[31])); - assert(native.setChannelMix(epoch,1,bus,.5f,0.f)); + assert(native.setChannelMix(epoch,2,bus,.5f,0.f)); + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, + legacyFx)); + assert(legacyFallbackCalls==0); + assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f*.5f+ + (.1f*4.f)*.5f*2.f)*center)); + // A structural recompile carries the same M4 VST3 lease and accepted + // Group gain. In real production the control thread must serialize + // the same revision/epoch and never recreate vendor state. + assert(roster.rememberLiveMix(bus,.5f,0.f)); + assert(native.commit(roster,req,2,epoch,epoch,true,ownerPlan).ok()); + assert(native.acceptedRevision()==3); assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, - [&bank](ChannelId id,float* l,float* r,int n) noexcept { - bank(id,l,r,n); - })); + legacyFx)); assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f*.5f+ (.1f*4.f)*.5f*2.f)*center)); + assert(legacyFallbackCalls==0); assert(!native.render(epoch+1,pins,2,left.data(),right.data(),32,false, - [&bank](ChannelId id,float* l,float* r,int n) noexcept { - bank(id,l,r,n); - })); + legacyFx)); assert(left[31]==0.f&&right[31]==0.f); } From bbce5818608a2a2683228c5298d4e1e739a5e250 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:14:54 +0700 Subject: [PATCH 008/155] fix(M5): atomic FX lease/PCM device epoch and revision admission with non-destructive rollback test --- engine/core/DynamicNativeSessionPublisher.h | 10 +++++++--- tests/live_channel_fx_graph_test.cpp | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index d2d697fa2..149f286d8 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -25,9 +25,11 @@ class DynamicNativeSessionPublisher final { std::shared_ptr owner; // CONTROL-only copy/destruction void* context=nullptr; // unchanged owner.get(), RT raw pointer void (*render)(void*,ChannelId,float*,float*,int) noexcept=nullptr; + std::uint64_t deviceEpoch=0,graphRevision=0; bool valid() const noexcept { - return (!owner&&!context&&!render) || - (owner&&context==owner.get()&&render); + return (!owner&&!context&&!render&&!deviceEpoch&&!graphRevision) || + (owner&&context==owner.get()&&render&& + deviceEpoch>0&&graphRevision>0); } }; private: @@ -66,7 +68,9 @@ class DynamicNativeSessionPublisher final { bool allOutputsDisarmed, FxPlan fx={}) { CommitResult report;report.revision=publisher_.lastRevision(); - if(!fx.valid()) { + if(!fx.valid() || + (fx.owner && (fx.deviceEpoch!=proposedDeviceEpoch || + fx.graphRevision!=expectedRevision+1))) { report.fault=Fault::invalidCandidate;return report; } if(proposedDeviceEpoch==0 || diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 1cd2df115..ad869e21b 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -186,6 +186,7 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { ownerPlan.render=+[](void* ctx,ChannelId id,float* l,float* r,int n) noexcept { (*static_cast(ctx))(id,l,r,n); }; + ownerPlan.deviceEpoch=epoch;ownerPlan.graphRevision=2; assert(ownerPlan.valid()); // A mismatched raw callback context cannot be published or overwrite a // working hardware graph. This is not a UI flag or an unchecked pointer. @@ -226,7 +227,21 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { // Group gain. In real production the control thread must serialize // the same revision/epoch and never recreate vendor state. assert(roster.rememberLiveMix(bus,.5f,0.f)); - assert(native.commit(roster,req,2,epoch,epoch,true,ownerPlan).ok()); + // A structurally new graph must NOT silently accept an old-revision + // FX binding, even when the raw processor pointers are still alive. + assert(native.commit(roster,req,2,epoch,epoch,true,ownerPlan).fault== + DynamicNativeSessionPublisher::Fault::invalidCandidate); + assert(native.acceptedRevision()==2); + Bank refreshed; + assert(Bank::prepare(epoch,3,assignments,refreshed)==Bank::Fault::none); + auto refreshedOwner=std::make_shared(std::move(refreshed)); + auto refreshedPlan=ownerPlan; + refreshedPlan.owner=std::static_pointer_cast(refreshedOwner); + refreshedPlan.context=refreshedOwner.get(); + refreshedPlan.graphRevision=3; + const auto originalProcessors=GainFx::living; + assert(native.commit(roster,req,2,epoch,epoch,true,refreshedPlan).ok()); + assert(GainFx::living==originalProcessors); // reuse, never rebuild VST assert(native.acceptedRevision()==3); assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, legacyFx)); From f34334a3ea0d16f8d632170627455c98e374a9c8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:24:02 +0700 Subject: [PATCH 009/155] test(M5): preserve legacy absolute FX retirement counter baseline; run new native ChannelId fixture after M4 suite --- tests/live_channel_fx_graph_test.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index ad869e21b..f83943ce7 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -254,7 +254,6 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { } int main() { - verifyUniversalChannelIdFxLeaseAndLivePcm(); // R0: existing CH1 FX chain may be rendered inside the SAME prepared // ten-channel routing pass, without creating a second plugin or copying // a processor. Verify exactly one call and zero callback heap allocation. @@ -582,6 +581,11 @@ int main() { assert(graph->monitorOutputLeft()==4&&graph->monitorOutputRight()==5); assert(near(graph->monitorGains()[1],.5f)); } + // Run M5 AFTER the legacy suite: older M4 tests use absolute global + // GainFx::living/released counters as their own lifetime oracle. Running + // M5 before them changes those historical baseline counts, not DSP. + // M5 additionally asserts zero heap and valid vendor leases itself. + verifyUniversalChannelIdFxLeaseAndLivePcm(); // Tests above use a real JUCE AudioProcessor processing seam. Vendor // VST3 formats and sound quality require separate Windows hardware FAT. } From c492f80d611465960d12f36d91a23266c0a5a503 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:31:24 +0700 Subject: [PATCH 010/155] feat(M-U1): atomically prepare/publish full M4 10CH+4AUX VST3 and MAIN/MONITOR PCM on one ChannelId graph --- engine/core/LegacyLiveGraphMigration.h | 4 + .../core/UnifiedLegacyProductionAdmission.h | 153 ++++++++++++++++++ tests/live_channel_fx_graph_test.cpp | 104 ++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 engine/core/UnifiedLegacyProductionAdmission.h diff --git a/engine/core/LegacyLiveGraphMigration.h b/engine/core/LegacyLiveGraphMigration.h index 2358e6724..54a06c3cc 100644 --- a/engine/core/LegacyLiveGraphMigration.h +++ b/engine/core/LegacyLiveGraphMigration.h @@ -44,6 +44,9 @@ struct LegacyMigratedGraph final { 32u*1024u*1024u,8u,static_cast(maxChannelSends+maxAuxSends+2)}}; DynamicPreparedMixerBlock pcm{}; LegacyChannelIds ids{}; + // Exact verified physical SOURCE request, preserved for a single native + // admission. Never reconstruct callback port ordinals from a GUI draft. + DynamicGraphRequest request{}; std::uint64_t revision=0; }; @@ -187,6 +190,7 @@ class LegacyGraphMigration final { next.pcm,error.dynamic)){ error.fault=LegacyMigrationFault::invalidDynamicGraph;return false; } + next.request=std::move(request); next.revision=next.roster.revision(); destination=std::move(next); // publish only after caller's native MUTE/epoch ACK return true; diff --git a/engine/core/UnifiedLegacyProductionAdmission.h b/engine/core/UnifiedLegacyProductionAdmission.h new file mode 100644 index 000000000..b24e0edcc --- /dev/null +++ b/engine/core/UnifiedLegacyProductionAdmission.h @@ -0,0 +1,153 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "LegacyLiveGraphMigration.h" +#include "DynamicChannelFxLeaseBank.h" +#include "DynamicNativeSessionPublisher.h" +#include +#include +#include +#include +#include +#include + +// M-U1: full M4 10CH + 4 AUX + MONITOR PCM and real VST leases are admitted +// as ONE identity-preserving dynamic session. No extra audio callback. +// This is CONTROL-only preparation; the physical callback cutover is a +// separate safety transaction and must select only ONE renderer. +// Special legacy CH1 external/Orbit FX is explicitly REFUSED until the +// actual processor/editor lease is migrated. Never silently discard it. +namespace armix::mixer { +struct VerifiedNativeOutputs final { + int activeOutputChannels=0; // EXACT current enabled callback output count + int mainL=-1,mainR=-1,monitorL=-1,monitorR=-1; + bool monitorEnabled=false; + bool valid() const noexcept { + if(activeOutputChannels<2||activeOutputChannels>256 || + mainL<0||mainR<0||mainL>=activeOutputChannels|| + mainR>=activeOutputChannels||mainL==mainR)return false; + if(!monitorEnabled)return monitorL==-1&&monitorR==-1; + return monitorL>=0&&monitorR>=0&& + monitorL fxOwners{}; + VerifiedNativeOutputs hardware{}; + std::uint64_t deviceEpoch=0,pcmRevision=0; +}; +class UnifiedLegacyProductionAdmission final { +public: + enum class Fault : std::uint8_t { + none,invalidOutputPins,staleHardware,outputArmed, + legacyCh1ExternalFx,staleFxGraph,legacyGraphInvalid, + fxLeaseInvalid,nativeRejected + }; + struct Report final { + Fault fault=Fault::none; + LegacyMigrationError migration{}; + DynamicChannelFxLeaseBank::Fault fx=DynamicChannelFxLeaseBank::Fault::none; + DynamicNativeSessionPublisher::CommitResult native{}; + bool ok() const noexcept {return fault==Fault::none;} + }; + + // Must be invoked on the SAME serialized M4 native control executor as + // hardware APPLY, Show capture and editor state. Prior accepted graph, + // leases and user outputs stay intact on any rejection. + static Report compileAndCommit( + const ChannelRoutingConfig& channels, + std::span callbackOrderedPhysicalPorts, + const SendRequest& sends,const AuxBusRequest& aux, + const std::array& monitorGains, + const LiveChannelFxGraph& acceptedM4Fx, + bool legacyExternalCh1FxActive, + const VerifiedNativeOutputs& hardware, + int maxFrames,std::size_t scratchBudget, + std::uint64_t expectedPcmRevision, + std::uint64_t deviceEpoch,std::uint64_t currentHardwareEpoch, + bool allOutputsDisarmed, + DynamicNativeSessionPublisher& publisher, + UnifiedLegacyAccepted& accepted) { + Report result; + if(!hardware.valid() || + hardware.monitorEnabled!=acceptedM4Fx.monitorEnabled() || + hardware.mainL!=acceptedM4Fx.mainOutputLeft() || + hardware.mainR!=acceptedM4Fx.mainOutputRight() || + (hardware.monitorEnabled && + (hardware.monitorL!=acceptedM4Fx.monitorOutputLeft()|| + hardware.monitorR!=acceptedM4Fx.monitorOutputRight()))) { + result.fault=Fault::invalidOutputPins;return result; + } + if(!deviceEpoch || deviceEpoch!=currentHardwareEpoch) { + result.fault=Fault::staleHardware;return result; + } + if(!allOutputsDisarmed) { + result.fault=Fault::outputArmed;return result; + } + if(legacyExternalCh1FxActive) { + result.fault=Fault::legacyCh1ExternalFx;return result; + } + // FxInstance owns one already-prepared stereo block. Do not let the + // dynamic callback deliver a larger quantum and silently bypass it. + if(maxFrames<1||maxFrames>acceptedM4Fx.capacity()|| + maxFrames>acceptedM4Fx.maxFramesPerPlugin()) { + result.fault=Fault::staleFxGraph;return result; + } + if(expectedPcmRevision!=publisher.acceptedRevision()) { + result.fault=Fault::nativeRejected; + result.native.fault=DynamicNativeSessionPublisher::Fault::staleRevision; + return result; + } + LegacyMigratedGraph candidate; + if(!LegacyGraphMigration::compile( + channels,callbackOrderedPhysicalPorts,sends,aux, + hardware.monitorEnabled,monitorGains,maxFrames,scratchBudget, + candidate,result.migration)) { + result.fault=Fault::legacyGraphInvalid;return result; + } + using Bank=DynamicChannelFxLeaseBank; + std::array lanes{}; + for(int i=0;iformat, + acceptedM4Fx,lanes[i])) { + result.fault=Fault::fxLeaseInvalid; + result.fx=Bank::Fault::missingLegacyIdentity; + return result; + } + } + Bank bank; + result.fx=Bank::prepare(deviceEpoch,expectedPcmRevision+1,lanes,bank); + if(result.fx!=Bank::Fault::none) { + result.fault=Fault::fxLeaseInvalid;return result; + } + auto owner=std::make_shared(std::move(bank)); + DynamicNativeSessionPublisher::FxPlan plan; + plan.owner=std::static_pointer_cast(owner); + plan.context=owner.get(); + plan.render=+[](void* ctx,ChannelId id,float* l,float* r,int n) noexcept { + (*static_cast(ctx))(id,l,r,n); + }; + plan.deviceEpoch=deviceEpoch;plan.graphRevision=expectedPcmRevision+1; + result.native=publisher.commit(candidate.roster,candidate.request, + expectedPcmRevision,deviceEpoch,currentHardwareEpoch, + allOutputsDisarmed,std::move(plan)); + if(!result.native.ok()) { + result.fault=Fault::nativeRejected;return result; + } + UnifiedLegacyAccepted next; + next.graph=std::move(candidate); + next.fxOwners=std::move(owner); + next.hardware=hardware; + next.deviceEpoch=deviceEpoch; + next.pcmRevision=result.native.revision; + accepted=std::move(next); + return result; + } +}; +} // namespace armix::mixer diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index f83943ce7..785091d0d 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -2,6 +2,7 @@ #include "../engine/core/LiveChannelFxGraph.h" #include "../engine/core/DynamicChannelFxLeaseBank.h" #include "../engine/core/DynamicNativeSessionPublisher.h" +#include "../engine/core/UnifiedLegacyProductionAdmission.h" #include "../engine/core/NativeOutputPairTap.h" #include "../engine/core/RealtimeRoutePublisher.h" #if defined(NDEBUG) @@ -253,6 +254,108 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { assert(left[31]==0.f&&right[31]==0.f); } +// M-U1 full-fidelity preparation: 10 CH + 4 AUX + M4 VST owners, +// sparse verified input ports, independent physical MAIN and MONITOR, +// PRE/POST and native Show/epoch rejection. Compare actual old M4 processor +// output with the same owners in ONE new atomic ChannelId publication. +static void verifyMU1LegacyM4FxFullMigrationAndMonitorPcm() { + constexpr std::array ports{3,0,4,7}; + ChannelRoutingConfig channels; + channels.stripsAndMaster.strips[0]={ + SourceMode::mono,3,-1,.5f,-.3f,false,false}; + channels.stripsAndMaster.strips[1]={ + SourceMode::stereo,4,7,.75f,.2f,false,false}; + channels.formats[2]=ChannelFormat::stereo; + channels.stripsAndMaster.master={1.1f,.1f,false,true}; + SendRequest sends; + sends.toMaster[0]=false;sends.count=1; + sends.sends[0]={0,2,SendTap::postFader,.3f,-.3f,true}; + AuxBusRequest aux; + aux.buses[0]={true,true,false,.8f}; + aux.count=1; + aux.sends[0]={1,0,SendTap::postFader,.25f,.1f,true}; + std::array monitorGains{}; + monitorGains[0]=.25f;monitorGains[stripCount]=.3f; + PreparedRenderGraph legacyGraph; + RenderError legacyError; + assert(PreparedRenderGraph::compile(channels,ports,sends, + legacyGraph,legacyError,aux)); + auto legacy=std::make_unique(legacyGraph,32,32); + assert(legacy->setMonitorOutputBus(2,3,4,monitorGains)); + auto ch1=std::make_unique(1.2f); + auto returnFx=std::make_unique(.9f); + ch1->prepareToPlay(48000,32); + returnFx->prepareToPlay(48000,32); + assert(legacy->install(0,std::move(ch1),"CH1 VST3","m4-ch1")); + assert(legacy->install(stripCount,std::move(returnFx),"AUX VST3","m4-aux")); + const auto oldCh1=legacy->insertInstanceId(0,0); + const auto oldAux=legacy->insertInstanceId(stripCount,0); + std::array mono{},unrelated{},stL{},stR{}; + for(int i=0;i<32;++i){ + mono[i]=.2f+.001f*i;unrelated[i]=.8f; + stL[i]=.15f+.002f*i;stR[i]=.35f-.001f*i; + } + const float* physical[]{mono.data(),unrelated.data(),stL.data(),stR.data()}; + std::array legacyL{},legacyR{},legacyML{},legacyMR{}; + assert(legacy->process(physical,4,legacyL.data(),legacyR.data(),32, + nullptr,nullptr,nullptr,legacyML.data(),legacyMR.data())); + DynamicNativeSessionPublisher publisher; + UnifiedLegacyAccepted accepted; + constexpr std::uint64_t epoch=565; + VerifiedNativeOutputs outputs{4,0,1,2,3,true}; + const auto good=UnifiedLegacyProductionAdmission::compileAndCommit( + channels,ports,sends,aux,monitorGains,*legacy,false,outputs, + 32,2u*1024u*1024u,0,epoch,epoch,true,publisher,accepted); + assert(good.ok()); + assert(publisher.acceptedRevision()==1); + assert(accepted.deviceEpoch==epoch&&accepted.pcmRevision==1); + assert(accepted.graph.roster.size()==stripCount+auxBusCount+2); + assert(accepted.graph.request.sources.size()==2); + assert(accepted.fxOwners->insertCount(accepted.graph.ids.inputs[0])==1); + assert(accepted.fxOwners->insertCount(accepted.graph.ids.aux[0])==1); + assert((*accepted.fxOwners->ownerForControl( + accepted.graph.ids.inputs[0],0))->instanceId==oldCh1); + assert((*accepted.fxOwners->ownerForControl( + accepted.graph.ids.aux[0],0))->instanceId==oldAux); + // Actual FX ownership survives the old M4 graph retirement. + legacy.reset(); + std::array dynamicL{},dynamicR{},dynamicML{},dynamicMR{}; + const auto mustNeverCall=[&](ChannelId,float*,float*,int) noexcept { + assert(false && "M4 processor may not render twice"); + }; + const auto before=heapCalls.load(std::memory_order_relaxed); + assert(publisher.render(epoch,physical,4,dynamicL.data(),dynamicR.data(), + 32,false,mustNeverCall, + dynamicML.data(),dynamicMR.data())); + assert(heapCalls.load(std::memory_order_relaxed)==before); + for(int i=0;i<32;++i) { + assert(near(legacyL[i],dynamicL[i])); + assert(near(legacyR[i],dynamicR[i])); + assert(near(legacyML[i],dynamicML[i])); + assert(near(legacyMR[i],dynamicMR[i])); + } + // Faults are non-destructive: no external CH1 Orbit state dropped, no + // wrong-speaker output, no stale hardware, no armed graph recreation. + auto bad=UnifiedLegacyProductionAdmission::compileAndCommit( + channels,ports,sends,aux,monitorGains, + // use a new empty graph only for rejecting BEFORE any instance access + *([](const PreparedRenderGraph& g)->LiveChannelFxGraph* { + static std::unique_ptr candidate; + if(!candidate)candidate=std::make_unique(g,32,32); + return candidate.get(); + })(legacyGraph), + true,outputs,32,2u*1024u*1024u,1,epoch,epoch,true, + publisher,accepted); + assert(bad.fault==UnifiedLegacyProductionAdmission::Fault::invalidOutputPins || + bad.fault==UnifiedLegacyProductionAdmission::Fault::legacyCh1ExternalFx); + assert(publisher.acceptedRevision()==1); + assert(accepted.fxOwners->insertCount(accepted.graph.ids.inputs[0])==1); + assert(!publisher.render(epoch+1,physical,4,dynamicL.data(), + dynamicR.data(),32,false,mustNeverCall, + dynamicML.data(),dynamicMR.data())); + assert(dynamicL[31]==0.f&&dynamicR[31]==0.f); +} + int main() { // R0: existing CH1 FX chain may be rendered inside the SAME prepared // ten-channel routing pass, without creating a second plugin or copying @@ -586,6 +689,7 @@ int main() { // M5 before them changes those historical baseline counts, not DSP. // M5 additionally asserts zero heap and valid vendor leases itself. verifyUniversalChannelIdFxLeaseAndLivePcm(); + verifyMU1LegacyM4FxFullMigrationAndMonitorPcm(); // Tests above use a real JUCE AudioProcessor processing seam. Vendor // VST3 formats and sound quality require separate Windows hardware FAT. } From 2bbf9f08b5495c3ad61b7d8d0ec5190177bdb55c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 06:32:16 +0700 Subject: [PATCH 011/155] test(M-U1): prove M4 VST/PCM + MAIN/MONITOR parity and non-destructive hotplug/CH1/output rejection --- ...CHANNELID_VST3_LEASE_MIGRATION_20261101.md | 8 ++++ tests/live_channel_fx_graph_test.cpp | 37 ++++++++++++++----- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/docs/M5_UNIVERSAL_CHANNELID_VST3_LEASE_MIGRATION_20261101.md b/docs/M5_UNIVERSAL_CHANNELID_VST3_LEASE_MIGRATION_20261101.md index 9a237de74..7e52b2855 100644 --- a/docs/M5_UNIVERSAL_CHANNELID_VST3_LEASE_MIGRATION_20261101.md +++ b/docs/M5_UNIVERSAL_CHANNELID_VST3_LEASE_MIGRATION_20261101.md @@ -36,3 +36,11 @@ Top global console contracts are consistent: 5. Keep existing M4/FAST3 one-APPLY and emergency MUTE, adaptive channel bank R7, P0 #15 0FX crackle evidence and realtime performance counters intact. **Honest status:** This is a substantive native FX/state migration seam with real processor PCM tests, **not yet a publicly usable full dynamic Studio One-equivalent Console**. No physical zero-latency guarantee and no field MAONO PS22 FAT has been executed for this M5 branch. + +## M-U1 full native admission transaction — added after initial M5 bridge + +`engine/core/UnifiedLegacyProductionAdmission.h` now composes the **existing** `LegacyGraphMigration` of the full 10-input + 4-AUX scene, FX PRE/POST sends, MAIN, independent MONITOR, effective mono/stereo format and physical capture port order with the actual M4 `FxInstance` ownership into **one native accepted PCM+VST publication**. `LegacyMigratedGraph.request` is retained verbatim from the validated old physical port map, not recreated from browser controls. A single snapshot binds hardware output callback pairs, exact device epoch, next PCM graph revision and all 14 M4 FX lane leases. Existing committed session/PCM/plugins remain unmodified on failed migration. + +The new native golden test renders real JUCE M4 processors BEFORE the conversion and compares it to output from the same instance objects AFTER the legacy graph owner is destroyed: MAIN L/R and independently routed MONITOR L/R, channel→bus sends and AUX return. It also checks no RT allocation, wrong physical MAIN/MONITOR alias, hotplug epoch, OUTPUT ARMED, external CH1/Orbit owner admission and post-reject audio continuity. A successful test is preparation evidence only; the production callback is NOT yet switched, hardware FAT is still required. + +**Critical safety gate:** an occupied legacy external CH1 FX chain/Orbit is explicitly rejected, not discarded or accidentally duplicated. The next M-U1 phase must migrate that separate owner and Show/editor state, then atomically choose the unified render in `LiveAudioEngine`; only after that can unrestricted +CHANNEL, Group Selected and +FX Return UI become live. diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 785091d0d..362bcd9a6 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -336,20 +336,39 @@ static void verifyMU1LegacyM4FxFullMigrationAndMonitorPcm() { } // Faults are non-destructive: no external CH1 Orbit state dropped, no // wrong-speaker output, no stale hardware, no armed graph recreation. + LiveChannelFxGraph blockedLegacy(legacyGraph,32,32); + assert(blockedLegacy.setMonitorOutputBus(2,3,4,monitorGains)); auto bad=UnifiedLegacyProductionAdmission::compileAndCommit( - channels,ports,sends,aux,monitorGains, - // use a new empty graph only for rejecting BEFORE any instance access - *([](const PreparedRenderGraph& g)->LiveChannelFxGraph* { - static std::unique_ptr candidate; - if(!candidate)candidate=std::make_unique(g,32,32); - return candidate.get(); - })(legacyGraph), + channels,ports,sends,aux,monitorGains,blockedLegacy, true,outputs,32,2u*1024u*1024u,1,epoch,epoch,true, publisher,accepted); - assert(bad.fault==UnifiedLegacyProductionAdmission::Fault::invalidOutputPins || - bad.fault==UnifiedLegacyProductionAdmission::Fault::legacyCh1ExternalFx); + assert(bad.fault==UnifiedLegacyProductionAdmission::Fault::legacyCh1ExternalFx); + auto wrongPins=outputs; + wrongPins.monitorR=0; // same physical output as MAIN + bad=UnifiedLegacyProductionAdmission::compileAndCommit( + channels,ports,sends,aux,monitorGains,blockedLegacy, + false,wrongPins,32,2u*1024u*1024u,1,epoch,epoch,true, + publisher,accepted); + assert(bad.fault==UnifiedLegacyProductionAdmission::Fault::invalidOutputPins); + bad=UnifiedLegacyProductionAdmission::compileAndCommit( + channels,ports,sends,aux,monitorGains,blockedLegacy, + false,outputs,32,2u*1024u*1024u,1,epoch,epoch+1,true, + publisher,accepted); + assert(bad.fault==UnifiedLegacyProductionAdmission::Fault::staleHardware); + bad=UnifiedLegacyProductionAdmission::compileAndCommit( + channels,ports,sends,aux,monitorGains,blockedLegacy, + false,outputs,32,2u*1024u*1024u,1,epoch,epoch,false, + publisher,accepted); + assert(bad.fault==UnifiedLegacyProductionAdmission::Fault::outputArmed); assert(publisher.acceptedRevision()==1); assert(accepted.fxOwners->insertCount(accepted.graph.ids.inputs[0])==1); + assert(publisher.render(epoch,physical,4,dynamicL.data(),dynamicR.data(), + 32,false,mustNeverCall, + dynamicML.data(),dynamicMR.data())); + for(int i=0;i<32;++i){ + assert(near(legacyL[i],dynamicL[i])); + assert(near(legacyMR[i],dynamicMR[i])); + } assert(!publisher.render(epoch+1,physical,4,dynamicL.data(), dynamicR.data(),32,false,mustNeverCall, dynamicML.data(),dynamicMR.data())); From 5dc2f14e4ac5b93a28228d578844d3f09b0e7db8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 09:45:12 +0700 Subject: [PATCH 012/155] test(contracts): follow current v5/v6 entrypoint authority while retaining historical ARD safety checks --- tests/smart_audio_ard_contract_test.mjs | 31 ++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/tests/smart_audio_ard_contract_test.mjs b/tests/smart_audio_ard_contract_test.mjs index 424fcf8a7..24dc69580 100644 --- a/tests/smart_audio_ard_contract_test.mjs +++ b/tests/smart_audio_ard_contract_test.mjs @@ -12,16 +12,31 @@ const ard = read('docs/ARD_SMART_AUDIO_ENGINE_V1_2026-10-25.md'); const impl = read('docs/SMART_AUDIO_ENGINE_IMPLEMENTATION_BLUEPRINT.md'); const issue = 'https://github.com/masarray/arsonmix/issues/15'; const visualLock = 'docs/GUI_BASELINE_LOCK_2026-10-25.md'; +const currentPrd = read('docs/PRD_ARSONMIX_OPERATOR_FIRST_LIVE_MIXER_V5_20261101.md'); +const currentArd = read('docs/ARD_ARSONMIX_UNIVERSAL_REALTIME_CONSOLE_V5_20261101.md'); +const executionLock = read('docs/EXECUTION_LOCK_UNIVERSAL_LIVE_CONSOLE_V6_20261101.md'); -test('all entrypoints direct engineers to canonical ARD and implementation blueprint', () => { - for (const s of [agents, readme]) { - assert.match(s, /ARD_SMART_AUDIO_ENGINE_V1_2026-10-25\.md/); - assert.match(s, /SMART_AUDIO_ENGINE_IMPLEMENTATION_BLUEPRINT\.md/); - assert.ok(s.includes(issue)); - assert.ok(s.includes(visualLock)); +test('active entrypoints follow PRD/ARD v5 and execution lock v6, not retired v1', () => { + for (const content of [agents, readme]) { + assert.match(content, /PRD_ARSONMIX_OPERATOR_FIRST_LIVE_MIXER_V5_20261101\\.md/); + assert.match(content, /ARD_ARSONMIX_UNIVERSAL_REALTIME_CONSOLE_V5_20261101\\.md/); + assert.match(content, /EXECUTION_LOCK_UNIVERSAL_LIVE_CONSOLE_V6_20261101\\.md/); + assert.ok(content.includes(issue), 'hardware crackle blocker must remain visible'); } - assert.match(old, /HISTORICAL 0\.3 DESIGN/); - assert.match(old, /Current architecture \(overrides outdated v0\.3 proposals\)/); + for (const [label, content] of [ + ['PRD v5', currentPrd], ['ARD v5', currentArd], ['Execution lock v6', executionLock] + ]) { + assert.ok(content.includes('ChannelId') || content.includes('channel'), + label + ' must describe real mixer channels'); + } + assert.match(executionLock, /one accepted PCM graph/i); + assert.match(executionLock, /CH11/); + assert.match(executionLock, /rollback/i); + // The old documents still exist as historical technical references. + // They are no longer the active instruction linked by repo entrypoints. + assert.ok(read(visualLock).length > 100); + assert.match(old, /HISTORICAL 0\\.3 DESIGN/); + assert.match(old, /Current architecture \\(overrides outdated v0\\.3 proposals\\)/); }); test('ARD covers device-clock, realtime and hardware acceptance without false shipping claims', () => { for (const concept of [ From 8364d53e387c4a5eb2ffa929bf7bb0791c27efff Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 09:45:32 +0700 Subject: [PATCH 013/155] test(contracts): correct literal regex escaping for v5/v6 authority check --- tests/smart_audio_ard_contract_test.mjs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/smart_audio_ard_contract_test.mjs b/tests/smart_audio_ard_contract_test.mjs index 24dc69580..d91a64486 100644 --- a/tests/smart_audio_ard_contract_test.mjs +++ b/tests/smart_audio_ard_contract_test.mjs @@ -18,9 +18,9 @@ const executionLock = read('docs/EXECUTION_LOCK_UNIVERSAL_LIVE_CONSOLE_V6_202611 test('active entrypoints follow PRD/ARD v5 and execution lock v6, not retired v1', () => { for (const content of [agents, readme]) { - assert.match(content, /PRD_ARSONMIX_OPERATOR_FIRST_LIVE_MIXER_V5_20261101\\.md/); - assert.match(content, /ARD_ARSONMIX_UNIVERSAL_REALTIME_CONSOLE_V5_20261101\\.md/); - assert.match(content, /EXECUTION_LOCK_UNIVERSAL_LIVE_CONSOLE_V6_20261101\\.md/); + assert.match(content, /PRD_ARSONMIX_OPERATOR_FIRST_LIVE_MIXER_V5_20261101\.md/); + assert.match(content, /ARD_ARSONMIX_UNIVERSAL_REALTIME_CONSOLE_V5_20261101\.md/); + assert.match(content, /EXECUTION_LOCK_UNIVERSAL_LIVE_CONSOLE_V6_20261101\.md/); assert.ok(content.includes(issue), 'hardware crackle blocker must remain visible'); } for (const [label, content] of [ @@ -35,8 +35,8 @@ test('active entrypoints follow PRD/ARD v5 and execution lock v6, not retired v1 // The old documents still exist as historical technical references. // They are no longer the active instruction linked by repo entrypoints. assert.ok(read(visualLock).length > 100); - assert.match(old, /HISTORICAL 0\\.3 DESIGN/); - assert.match(old, /Current architecture \\(overrides outdated v0\\.3 proposals\\)/); + assert.match(old, /HISTORICAL 0\.3 DESIGN/); + assert.match(old, /Current architecture \(overrides outdated v0\.3 proposals\)/); }); test('ARD covers device-clock, realtime and hardware acceptance without false shipping claims', () => { for (const concept of [ From 4e80c4b561e3625b7515f25d3a6fffb2f719961c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 09:58:49 +0700 Subject: [PATCH 014/155] engine(m-u1): preserve mono source pan through stereo processing and assert M4-to-ChannelId PCM parity --- engine/core/DynamicPreparedMixerBlock.h | 37 ++++++++++----- tests/live_channel_fx_graph_test.cpp | 63 +++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 13 deletions(-) diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index 9f02c9834..8ffcc3d44 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -58,6 +58,7 @@ class DynamicPreparedMixerBlock final { ChannelRole role=ChannelRole::input; int inputL=-1,inputR=-1; bool inputStereo=false,enabled=false; + bool monoPan=false; // mono source/processing, independent of VST rack width float gainL=1.f,gainR=1.f; std::size_t first=0,last=0,slot=0; }; @@ -78,6 +79,17 @@ class DynamicPreparedMixerBlock final { return {std::bit_cast(static_cast(both)), std::bit_cast(static_cast(both>>32))}; } + // True microphone mono uses equal-power PAN even when a stereo VST rack + // processes its duplicated L/R PCM. A stereo physical source uses + // balance PAN unless explicitly folded to mono processing. Computing + // the coefficient is CONTROL-only; the callback reads one atomic pair. + static StereoGainPair coefficients(bool monoPan,float gain,float pan) noexcept { + if(monoPan) + return {gain*std::sqrt(.5f*(1.f-pan)), + gain*std::sqrt(.5f*(1.f+pan))}; + return {gain*(pan>0.f?1.f-pan:1.f), + gain*(pan<0.f?1.f+pan:1.f)}; + } struct ChannelTarget final { static_assert(std::atomic::is_always_lock_free, "Realtime stereo mixer requires lock-free 64-bit atomic targets"); @@ -106,13 +118,9 @@ class DynamicPreparedMixerBlock final { if(!id.value || !std::isfinite(gain) || gain<0.f || gain>4.f || !std::isfinite(pan) || pan< -1.f || pan>1.f)return false; for(std::size_t i=0;i0.f?1.f-pan:1.f); - const float right=mono?gain*std::sqrt(.5f*(1.f+pan)): - gain*(pan<0.f?1.f+pan:1.f); + const auto gains=coefficients(lanes_[i].monoPan,gain,pan); channelTargets_[i].both.store( - packGainPair(left,right),std::memory_order_release); + packGainPair(gains.left,gains.right),std::memory_order_release); return true; } return false; @@ -189,13 +197,7 @@ class DynamicPreparedMixerBlock final { Lane lane; lane.id=row.id;lane.format=row.format;lane.role=row.role; lane.enabled=!row.mute; - if(row.format==ProcessingFormat::mono) { - lane.gainL=row.faderLinear*std::sqrt(0.5f*(1.f-row.pan)); - lane.gainR=row.faderLinear*std::sqrt(0.5f*(1.f+row.pan)); - }else{ - lane.gainL=row.faderLinear*(row.pan>0.f?1.f-row.pan:1.f); - lane.gainR=row.faderLinear*(row.pan<0.f?1.f+row.pan:1.f); - } + lane.monoPan=row.format==ProcessingFormat::mono; next.lanes_.push_back(lane); } if(main==notScheduled){error.fault=DynamicGraphFault::noMaster;return false;} @@ -215,6 +217,15 @@ class DynamicPreparedMixerBlock final { } lane.inputL=patch.inputL;lane.inputR=patch.inputR; lane.inputStereo=patch.stereo; + // The channel SOURCE and the INSERT PROCESSING FORMAT are + // independent. Mono mic -> stereo VST still retains mono PAN. + if(!patch.stereo)lane.monoPan=true; + } + for(std::size_t i=0;i cases{{ + {false,false,-.6f},{false,true,-.6f}, + {false,true,.6f},{true,false,.6f}, + {true,false,-.6f},{true,true,.6f} + }}; + constexpr std::array ports{3,7}; + std::array mic{},micR{}; + for(int i=0;i<32;++i){ + mic[i]=.15f+.001f*i; + micR[i]=.35f-.002f*i; + } + const float* physical[]{mic.data(),micR.data()}; + constexpr std::uint64_t epoch=800; + const auto noFx=+[](ChannelId,float*,float*,int) noexcept {}; + for(const auto& choice:cases) { + ChannelRoutingConfig cfg; + cfg.stripsAndMaster.strips[0]={ + choice.sourceStereo?SourceMode::stereo:SourceMode::mono, + 3,choice.sourceStereo?7:-1,.7f,choice.pan,false,false + }; + cfg.formats[0]=choice.processStereo? + ChannelFormat::stereo:ChannelFormat::mono; + SendRequest sends;AuxBusRequest aux; + PreparedRenderGraph oldRoute;RenderError legacyError; + assert(PreparedRenderGraph::compile( + cfg,ports,sends,oldRoute,legacyError,aux)); + auto old=std::make_unique(oldRoute,32,32); + assert(old->setStripControl(0,.7f,choice.pan, + !choice.sourceStereo||!choice.processStereo, + false,false)); + std::array oldL{},oldR{},nativeL{},nativeR{}; + assert(old->process(physical,2,oldL.data(),oldR.data(),32)); + DynamicNativeSessionPublisher native; + UnifiedLegacyAccepted accepted; + std::array monitor{}; + VerifiedNativeOutputs outs{2,0,1,-1,-1,false}; + auto admission=UnifiedLegacyProductionAdmission::compileAndCommit( + cfg,ports,sends,aux,monitor,*old,false,outs, + 32,2u*1024u*1024u,0,epoch,epoch,true,native,accepted); + assert(admission.ok()); + const auto before=heapCalls.load(std::memory_order_relaxed); + assert(native.render(epoch,physical,2,nativeL.data(), + nativeR.data(),32,false,noFx)); + assert(heapCalls.load(std::memory_order_relaxed)==before); + for(int i=0;i<32;++i){ + assert(near(nativeL[i],oldL[i])); + assert(near(nativeR[i],oldR[i])); + } + // A stale physical endpoint must fail silent and not change ACK. + assert(!native.render(epoch+1,physical,2,nativeL.data(), + nativeR.data(),32,false,noFx)); + assert(nativeL[31]==0.f&&nativeR[31]==0.f); + assert(native.acceptedRevision()==1); + } +} + int main() { // R0: existing CH1 FX chain may be rendered inside the SAME prepared // ten-channel routing pass, without creating a second plugin or copying @@ -819,6 +881,7 @@ int main() { verifyUniversalChannelIdFxLeaseAndLivePcm(); verifyMU1LegacyM4FxFullMigrationAndMonitorPcm(); verifyOccupiedExternalCh1Owner(); + verifySourceFormatIndependentPanPcmParity(); // Tests above use a real JUCE AudioProcessor processing seam. Vendor // VST3 formats and sound quality require separate Windows hardware FAT. } From 96c87c70793cae9ce24fb948c9def8bd3cbd33d2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 10:00:22 +0700 Subject: [PATCH 015/155] fix(integration): align native ACK with opaque WebView IDs and reject lossy ChannelId tokens --- .../CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md | 7 +- integration/ConsoleNativeContractV6.h | 64 ++++++++++++++++--- tests/console_native_integration_test.cpp | 47 ++++++++++++-- 3 files changed, 101 insertions(+), 17 deletions(-) diff --git a/docs/CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md b/docs/CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md index 2fddeb837..4aa21b134 100644 --- a/docs/CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md +++ b/docs/CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md @@ -8,7 +8,7 @@ This document describes **implemented integration types and executable PCM/readb - \`tests/console_native_integration_test.cpp\` renders actual native offline PCM for IN1→CH7, IN2→CH2, sends to MONITOR, Group Selected with exclusive primary OUT, parallel wet FX Return, stale-device/invalid-pin rollback and mute. The test refuses to call this offline graph physically LIVE. ## Fields (target UI serialization) -All \`ChannelId\`, destination IDs and request IDs are decimal **strings** in JS (64-bit native identity must not be downcast to Number). Only version 6 represents these roles. Sample: +**Wire synchronization v6 (integration patch):** `ChannelId` and destination IDs are canonical unsigned **decimal strings**, never JS Number; `requestId` is a bounded printable **opaque string** per WebView session (e.g. `gui-live:41`) echoed unchanged by ACK, not a native integer or a global monotonically increasing counter. `device.epoch`, `graph.revision` and roster revisions are JS-safe integers on the *current* GUI branch; native must reject values beyond 2^53-1 until both ends migrate together. Only v6 represents these roles. Sample: \`\`\`json { "schemaVersion": 6, @@ -35,7 +35,7 @@ All \`ChannelId\`, destination IDs and request IDs are decimal **strings** in JS \`\`\` The snippet is **illustrative**, not evidence that physical INPUT 1 is bound to ChannelId 7. A device callback pin number is not a sparse Windows hardware pin ID. The native source/physical-output owner must supply separate verified \`sourceBinding\` and actual \`OUTPUT ARMED\` readback. No fallback to IN1 or mock data if missing. -Intent envelope: \`{requestId,deviceEpoch,baseGraphRevision,baseRosterRevision,operation,targetChannelId}\`. A single native writer should reject stale epoch/revision, a previously completed duplicate ID and unsupported operations, then dispatch an existing native graph edit. ACK reports the same requestId, accepted/rejected, **current accepted** revisions and precise reason. An accepted graph **does not** imply physically audible LIVE: a full-fidelity production callback plus verified device/output gate is needed. +Intent envelope: `{requestId,deviceEpoch,baseRevision,baseRosterRevision,op,targetChannelId,payload}` as currently emitted by GUI #271. Native maps `baseRevision` to the internal `baseGraphRevision`, checks exact device epoch and accepted revisions, canonical decimal ChannelIds, and validates the operation against **runtime native supportedOps**, not the UI fixture. A single native writer maintains a **bounded recent completed-ID cache** (not an arbitrary numerical sequence comparator) across editor reconnects and rejects duplicate IDs, stale epoch/revision and unsupported operations before dispatching an existing accepted native graph edit. This adapter is control-plane *preflight* and does not yet instantiate that native writer. ACK reports the same requestId, accepted/rejected, **current accepted** revisions and precise reason. An accepted graph **does not** imply physically audible LIVE: a full-fidelity production callback plus verified device/output gate is needed. ## Invariants and merge gate 1. On rejected native intent, the accepted graph revision, source bindings and PCM remain unchanged. Never send an optimistic UI 'LIVE'. @@ -45,3 +45,6 @@ Intent envelope: \`{requestId,deviceEpoch,baseGraphRevision,baseRosterRevision,o 5. ENGINE owns adding source/FX readback from the native accepted snapshot in #266. GUI owns serialization/rendering in #268. Integration test owner does not edit those files. **Scope note:** This is one integration prerequisite, not the full Universal Live Console milestone. Do not merge this test as a claim that CH11, Group or FX Return have shipped. + +## Wire identity / duplicate ACK regression (2026-11-01) +The integration C++ test now proves an opaque `requestId` is echoed unchanged in both accepted and rejected replies, previously completed requests are rejected even across multiple editor IDs, a new editor restarting from sequence 1 is permitted, invalid control characters/overlong tokens are rejected, and native uint64 ChannelId strings reject overflow, leading zero and UI-fixture aliases. Snapshot projection refuses a JS-unsafe epoch/revision. The actual native WebView command dispatcher in ENGINE #266 must implement this v6 mapping and ACK/replay; the existence of the C++ test is not evidence of production bridge or physical sound. diff --git a/integration/ConsoleNativeContractV6.h b/integration/ConsoleNativeContractV6.h index 05fda42a3..7397c8bf5 100644 --- a/integration/ConsoleNativeContractV6.h +++ b/integration/ConsoleNativeContractV6.h @@ -3,6 +3,9 @@ #include "../engine/core/DynamicAcceptedSession.h" #include #include +#include +#include +#include #include #include #include @@ -22,7 +25,7 @@ struct ConsoleIntentV6 final { patchInput, patchOutput, addChannel, groupSelected, addFxReturn, setInsert, setSend, setMix, recallShow }; - std::uint64_t requestId=0; // monotonic per live connection; never a strip index + std::string requestId; // Opaque per-WebView-session token, echoed exactly in ACK. std::uint64_t deviceEpoch=0,baseGraphRevision=0,baseRosterRevision=0; Operation operation=Operation::patchInput; ChannelId target{}; @@ -33,14 +36,27 @@ enum class IntentFaultV6 : std::uint8_t { staleGraph, staleRoster }; -// This is a preflight ONLY. The real JUCE control writer applies the native -// intent and returns ACK. lastCompletedId comes from that writer: do not -// mutate it here, or attempt to ACK a draft UI edit. +// The GUI sends an opaque string ('gui...:sequence'). Numeric <= comparison +// between different GUI incarnations is INVALID; an old editor reconnect can +// legally send a lower sequence. The existing native control writer owns a +// bounded recently-completed request-ID cache and supplies a VIEW of it here. +// This function does not retain IDs, emit ACK, create DSP or change the graph. +// Reject malformed IDs before they enter native diagnostic logs. +inline bool validConsoleRequestId(std::string_view id) noexcept { + if(id.empty() || id.size()>128)return false; + return std::all_of(id.begin(),id.end(),[](unsigned char ch) noexcept { + return ch>=0x21 && ch<=0x7e; + }); +} inline IntentFaultV6 validateConsoleIntent( const ConsoleIntentV6& intent,std::uint64_t actualDeviceEpoch, - std::uint64_t lastCompletedId,const DynamicAcceptedSession& accepted) noexcept { - if(!intent.requestId)return IntentFaultV6::invalidRequest; - if(intent.requestId<=lastCompletedId)return IntentFaultV6::duplicateOrOldRequest; + std::span completedRequestIds, + const DynamicAcceptedSession& accepted) noexcept { + if(!validConsoleRequestId(intent.requestId)) + return IntentFaultV6::invalidRequest; + if(std::find(completedRequestIds.begin(),completedRequestIds.end(), + std::string_view(intent.requestId))!=completedRequestIds.end()) + return IntentFaultV6::duplicateOrOldRequest; if(!actualDeviceEpoch || intent.deviceEpoch!=actualDeviceEpoch) return IntentFaultV6::staleDevice; if(intent.baseGraphRevision!=accepted.acceptedGraphRevision()) @@ -50,9 +66,29 @@ inline IntentFaultV6 validateConsoleIntent( return IntentFaultV6::none; } +// ChannelId is a native uint64 but a JSON string, *never* JavaScript Number. +// Reject malformed/overflowed/noncanonical identities instead of sending an +// intent to a guessed strip ordinal. Caller verifies this ID exists in the +// exact accepted native graph before authorizing a command. +inline bool parseNativeChannelId(std::string_view token,ChannelId& out) noexcept { + if(token.empty() || (token.size()>1 && token.front()=='0'))return false; + std::uint64_t value=0; + for(const char ch:token) { + if(ch<'0'||ch>'9')return false; + const auto digit=static_cast(ch-'0'); + if(value>(std::numeric_limits::max()-digit)/10u) + return false; + value=value*10u+digit; + } + if(value==0)return false; // Zero is the explicit unconnected OUT sentinel. + out=ChannelId{value};return true; +} + + struct ConsoleAckV6 final { enum class Status : std::uint8_t { acceptedGraph, rejected }; - std::uint64_t requestId=0,deviceEpoch=0,graphRevision=0,rosterRevision=0; + std::string requestId; // Must match user's opaque intent byte-for-byte. + std::uint64_t deviceEpoch=0,graphRevision=0,rosterRevision=0; Status status=Status::rejected; IntentFaultV6 preflight=IntentFaultV6::none; DynamicAcceptedSession::Fault nativeFault=DynamicAcceptedSession::Fault::none; @@ -65,7 +101,7 @@ struct ConsoleAckV6 final { inline ConsoleAckV6 consoleAckFromNative( const ConsoleIntentV6& intent,IntentFaultV6 preflight, const DynamicAcceptedSession& accepted, - const DynamicAcceptedSession::Result* nativeResult=nullptr) noexcept { + const DynamicAcceptedSession::Result* nativeResult=nullptr) { ConsoleAckV6 ack; ack.requestId=intent.requestId;ack.deviceEpoch=intent.deviceEpoch; ack.graphRevision=accepted.acceptedGraphRevision(); @@ -78,6 +114,10 @@ inline ConsoleAckV6 consoleAckFromNative( ack.status=ConsoleAckV6::Status::acceptedGraph; return ack; // Never claim productionCallbackLive here. } +inline std::string_view consoleWireAckStatus(const ConsoleAckV6& ack) noexcept { + return ack.status==ConsoleAckV6::Status::acceptedGraph + ?std::string_view{"ACCEPTED"}:std::string_view{"REJECTED"}; +} struct ConsoleSendV6 final { std::string destinationId; // Decimal string avoids JS Number precision loss. @@ -127,7 +167,13 @@ inline bool projectAcceptedConsoleV6( const DynamicAcceptedSession& native,std::uint64_t deviceEpoch, std::uint64_t exactGraphRevision, ConsoleAcceptedReadbackV6& destination) { + // device epoch and structural revisions are sent to the current GUI as + // JS safe integers; never allow precision loss until both native and GUI + // migrate them together to versioned decimal strings. + constexpr std::uint64_t maxJsInteger=9007199254740991ULL; if(!deviceEpoch || !exactGraphRevision || + deviceEpoch>maxJsInteger || exactGraphRevision>maxJsInteger || + native.acceptedRosterRevision()>maxJsInteger || native.acceptedGraphRevision()!=exactGraphRevision)return false; const auto* view=native.acceptedRouting(deviceEpoch,exactGraphRevision); if(!view || view->rosterRevision!=native.acceptedRosterRevision() || diff --git a/tests/console_native_integration_test.cpp b/tests/console_native_integration_test.cpp index b9c66d79b..e9b452996 100644 --- a/tests/console_native_integration_test.cpp +++ b/tests/console_native_integration_test.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include using namespace armix::mixer; @@ -72,18 +74,47 @@ int main() { assert(!snap.capabilities.group&&!snap.capabilities.fxReturn); ConsoleIntentV6 intent; - intent.requestId=41;intent.deviceEpoch=epoch; + intent.requestId="gui-live:41";intent.deviceEpoch=epoch; intent.baseGraphRevision=2;intent.baseRosterRevision=2; intent.operation=ConsoleIntentV6::Operation::groupSelected; intent.target=ch7; - assert(validateConsoleIntent(intent,epoch,40,native)==IntentFaultV6::none); - assert(validateConsoleIntent(intent,epoch,41,native)==IntentFaultV6::duplicateOrOldRequest); - assert(validateConsoleIntent(intent,epoch+1,40,native)==IntentFaultV6::staleDevice); + // Multiple WebViews can coexist/reconnect. Dedup by opaque request ID, + // NOT by numeric sequence: 'gui-new:1' remains valid after 'gui-old:41'. + const std::array completedIds{ + "gui-old:41","gui-live:40"}; + const std::array completedIncluding{ + "gui-live:41","gui-old:41","gui-live:40"}; + assert(validateConsoleIntent(intent,epoch,completedIds,native)==IntentFaultV6::none); + assert(validateConsoleIntent(intent,epoch,completedIncluding,native) + ==IntentFaultV6::duplicateOrOldRequest); + assert(validateConsoleIntent(intent,epoch+1,completedIds,native) + ==IntentFaultV6::staleDevice); intent.baseGraphRevision=1; - assert(validateConsoleIntent(intent,epoch,40,native)==IntentFaultV6::staleGraph); + assert(validateConsoleIntent(intent,epoch,completedIds,native) + ==IntentFaultV6::staleGraph); intent.baseGraphRevision=2;intent.baseRosterRevision=1; - assert(validateConsoleIntent(intent,epoch,40,native)==IntentFaultV6::staleRoster); + assert(validateConsoleIntent(intent,epoch,completedIds,native) + ==IntentFaultV6::staleRoster); intent.baseRosterRevision=2; + intent.requestId="gui-new:1"; + assert(validateConsoleIntent(intent,epoch,completedIds,native)==IntentFaultV6::none); + intent.requestId="gui-live:41"; + assert(validConsoleRequestId(intent.requestId)); + intent.requestId="gui\nbad:42"; + assert(validateConsoleIntent(intent,epoch,completedIds,native) + ==IntentFaultV6::invalidRequest); + intent.requestId=std::string(129,'x'); + assert(validateConsoleIntent(intent,epoch,completedIds,native) + ==IntentFaultV6::invalidRequest); + intent.requestId="gui-live:41"; + ChannelId parsed{}; + assert(parseNativeChannelId("18446744073709551615",parsed) && + parsed.value==std::numeric_limits::max()); + assert(!parseNativeChannelId("18446744073709551616",parsed)); + assert(!parseNativeChannelId("ch-07",parsed)); + assert(!parseNativeChannelId("07",parsed)); + assert(!parseNativeChannelId("0",parsed)); + assert(parseNativeChannelId(std::to_string(ch7.value),parsed) && parsed==ch7); std::array a{},b{},left{},right{},ml{},mr{}; a.fill(.2f);b.fill(.4f); @@ -108,6 +139,8 @@ int main() { assert(!stale.ok()); auto nack=consoleAckFromNative(intent,IntentFaultV6::none,native,&stale); assert(nack.status==ConsoleAckV6::Status::rejected); + assert(nack.requestId==intent.requestId); + assert(consoleWireAckStatus(nack)=="REJECTED"); assert(nack.graphRevision==2 && !nack.productionCallbackLive); const auto prev=snap; assert(!projectAcceptedConsoleV6(native,epoch+1,2,snap)); @@ -121,6 +154,8 @@ int main() { group=added.edit.createdIds[0]; auto ack=consoleAckFromNative(intent,IntentFaultV6::none,native,&added); assert(ack.status==ConsoleAckV6::Status::acceptedGraph); + assert(ack.requestId=="gui-live:41"); + assert(consoleWireAckStatus(ack)=="ACCEPTED"); assert(ack.graphRevision==3 && !ack.productionCallbackLive); assert(projectAcceptedConsoleV6(native,epoch,3,snap)); assert(find(snap,ch7)->primaryOutId==std::to_string(group.value)); From cf3f2b94bed3d95ae0b1700d385372c20a403217 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 10:06:39 +0700 Subject: [PATCH 016/155] feat(integration): lossless flat native v6 readback and typed role wire parity --- .../CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md | 5 +- integration/ConsoleNativeContractV6.h | 54 ++++++++++++++++--- tests/console_native_integration_test.cpp | 19 +++++++ 3 files changed, 71 insertions(+), 7 deletions(-) diff --git a/docs/CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md b/docs/CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md index 4aa21b134..09eecbbb7 100644 --- a/docs/CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md +++ b/docs/CONSOLE_BRIDGE_INTEGRATION_CONTRACT_V6.md @@ -8,7 +8,7 @@ This document describes **implemented integration types and executable PCM/readb - \`tests/console_native_integration_test.cpp\` renders actual native offline PCM for IN1→CH7, IN2→CH2, sends to MONITOR, Group Selected with exclusive primary OUT, parallel wet FX Return, stale-device/invalid-pin rollback and mute. The test refuses to call this offline graph physically LIVE. ## Fields (target UI serialization) -**Wire synchronization v6 (integration patch):** `ChannelId` and destination IDs are canonical unsigned **decimal strings**, never JS Number; `requestId` is a bounded printable **opaque string** per WebView session (e.g. `gui-live:41`) echoed unchanged by ACK, not a native integer or a global monotonically increasing counter. `device.epoch`, `graph.revision` and roster revisions are JS-safe integers on the *current* GUI branch; native must reject values beyond 2^53-1 until both ends migrate together. Only v6 represents these roles. Sample: +**Wire synchronization v6 (integration patch):** `ChannelId` and destination IDs are canonical unsigned **decimal strings**, never JS Number; `requestId` is a bounded printable **opaque string** per WebView session (e.g. `gui-live:41`) echoed unchanged by ACK, not a native integer or a global monotonically increasing counter. `device.epoch`, `graph.revision` and roster revisions are canonical decimal **strings** on GUI #271; native must preserve all uint64 bits and GUI compares with BigInt. Only v6 represents these roles. Sample: \`\`\`json { "schemaVersion": 6, @@ -48,3 +48,6 @@ Intent envelope: `{requestId,deviceEpoch,baseRevision,baseRosterRevision,op,targ ## Wire identity / duplicate ACK regression (2026-11-01) The integration C++ test now proves an opaque `requestId` is echoed unchanged in both accepted and rejected replies, previously completed requests are rejected even across multiple editor IDs, a new editor restarting from sequence 1 is permitted, invalid control characters/overlong tokens are rejected, and native uint64 ChannelId strings reject overflow, leading zero and UI-fixture aliases. Snapshot projection refuses a JS-unsafe epoch/revision. The actual native WebView command dispatcher in ENGINE #266 must implement this v6 mapping and ACK/replay; the existence of the C++ test is not evidence of production bridge or physical sound. + +## Serialization-ready accepted readback (no fake physical LIVE) +`toConsoleWireReadbackV6` converts the accepted native revision to decimal-string tokens and role/format text values expected by GUI #271: INPUT, GROUP, FX_RETURN, MONITOR, MAIN; MONO/STEREO. Golden C++ tests now include >2^53 numeric preservation. This helper is a **control-thread DTO** only. It neither emits JUCE JSON nor supplies actual device pins, VST3 state, callback ownership or hardware sound, which remain ENGINE #266's integration responsibility. diff --git a/integration/ConsoleNativeContractV6.h b/integration/ConsoleNativeContractV6.h index 7397c8bf5..7b40f3085 100644 --- a/integration/ConsoleNativeContractV6.h +++ b/integration/ConsoleNativeContractV6.h @@ -167,13 +167,8 @@ inline bool projectAcceptedConsoleV6( const DynamicAcceptedSession& native,std::uint64_t deviceEpoch, std::uint64_t exactGraphRevision, ConsoleAcceptedReadbackV6& destination) { - // device epoch and structural revisions are sent to the current GUI as - // JS safe integers; never allow precision loss until both native and GUI - // migrate them together to versioned decimal strings. - constexpr std::uint64_t maxJsInteger=9007199254740991ULL; + // GUI v6 uses canonical decimal-string uint64 revisions and BigInt. if(!deviceEpoch || !exactGraphRevision || - deviceEpoch>maxJsInteger || exactGraphRevision>maxJsInteger || - native.acceptedRosterRevision()>maxJsInteger || native.acceptedGraphRevision()!=exactGraphRevision)return false; const auto* view=native.acceptedRouting(deviceEpoch,exactGraphRevision); if(!view || view->rosterRevision!=native.acceptedRosterRevision() || @@ -203,4 +198,51 @@ inline bool projectAcceptedConsoleV6( destination=std::move(next); return true; } + +inline std::string_view consoleWireRole(ChannelRole role) noexcept { + switch(role) { + case ChannelRole::input: return "INPUT"; + case ChannelRole::group: return "GROUP"; + case ChannelRole::fxReturn: return "FX_RETURN"; + case ChannelRole::monitor: return "MONITOR"; + case ChannelRole::main: return "MAIN"; + } + return "UNKNOWN"; +} +struct ConsoleWireChannelV6 final { + std::string id,role,processingFormat,name,primaryOutId; + std::vector sends; + std::size_t primaryInputCount=0,parallelSendInputCount=0; + bool sourcePinVerified=false,actualPcmPresent=false; +}; +struct ConsoleWireReadbackV6 final { + std::uint32_t schemaVersion=6; + std::string deviceEpoch,graphRevision,rosterRevision,mainId,monitorId; + std::vector channels; + ProductionCapabilitiesV6 capabilities{}; + bool productionCallbackLive=false; +}; +// Control-only serialization model, NOT a device, JSON emitter or audio renderer. +inline ConsoleWireReadbackV6 toConsoleWireReadbackV6( + const ConsoleAcceptedReadbackV6& a) { + ConsoleWireReadbackV6 out; + out.deviceEpoch=std::to_string(a.deviceEpoch); + out.graphRevision=std::to_string(a.graphRevision); + out.rosterRevision=std::to_string(a.rosterRevision); + out.mainId=a.mainId;out.monitorId=a.monitorId; + out.capabilities=a.capabilities;out.productionCallbackLive=a.productionCallbackLive; + out.channels.reserve(a.channels.size()); + for(const auto& c:a.channels) { + ConsoleWireChannelV6 ch; + ch.id=c.id;ch.role=std::string(consoleWireRole(c.role)); + ch.processingFormat=c.format==ProcessingFormat::mono?"MONO":"STEREO"; + ch.name=c.name;ch.primaryOutId=c.primaryOutId;ch.sends=c.sends; + ch.primaryInputCount=c.primaryInputCount; + ch.parallelSendInputCount=c.parallelSendInputCount; + ch.sourcePinVerified=c.sourcePinVerified; + ch.actualPcmPresent=c.actualPcmPresent; + out.channels.push_back(std::move(ch)); + } + return out; +} } // namespace armix::integration diff --git a/tests/console_native_integration_test.cpp b/tests/console_native_integration_test.cpp index e9b452996..8b08ae9a8 100644 --- a/tests/console_native_integration_test.cpp +++ b/tests/console_native_integration_test.cpp @@ -72,6 +72,19 @@ int main() { assert(!snap.productionCallbackLive); assert(!snap.capabilities.universalLive()); assert(!snap.capabilities.group&&!snap.capabilities.fxReturn); + const auto firstWire=toConsoleWireReadbackV6(snap); + assert(firstWire.schemaVersion==6 && firstWire.deviceEpoch=="69"); + assert(firstWire.graphRevision=="2" && firstWire.rosterRevision=="2"); + assert(firstWire.channels[6].id==std::to_string(ch7.value)); + assert(firstWire.channels[6].role=="INPUT"); + assert(firstWire.channels[6].processingFormat=="MONO"); + assert(!firstWire.productionCallbackLive); + auto huge=snap; + huge.deviceEpoch=std::numeric_limits::max(); + huge.graphRevision=9007199254740993ULL; + const auto encoded=toConsoleWireReadbackV6(huge); + assert(encoded.deviceEpoch=="18446744073709551615"); + assert(encoded.graphRevision=="9007199254740993"); ConsoleIntentV6 intent; intent.requestId="gui-live:41";intent.deviceEpoch=epoch; @@ -161,6 +174,9 @@ int main() { assert(find(snap,ch7)->primaryOutId==std::to_string(group.value)); assert(find(snap,ch2)->primaryOutId==std::to_string(group.value)); assert(find(snap,group)->primaryInputCount==2); + const auto groupWire=toConsoleWireReadbackV6(snap); + assert(groupWire.channels.back().role=="GROUP" && + groupWire.channels.back().primaryInputCount==2); assert(render()&&approx(left[31],(.2f+.4f)*center*2.f)); assert(approx(ml[31],(.2f*.2f+.4f*.3f)*center)); @@ -174,6 +190,9 @@ int main() { assert(liveCh7 && liveCh7->primaryOutId==std::to_string(group.value)); assert(liveCh7->sends.size()==2); // MONITOR remains, wet SEND added assert(find(snap,wet)->parallelSendInputCount==1); + const auto returnWire=toConsoleWireReadbackV6(snap); + assert(returnWire.channels.back().role=="FX_RETURN" && + returnWire.channels.back().parallelSendInputCount==1); assert(render()); assert(approx(left[31],(.2f+.4f)*center*2.f+.2f*center*.25f*.5f)); assert(approx(ml[31],(.2f*.2f+.4f*.3f)*center)); From 5f91b10e023c482294a36280be2d8585034d4c97 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 10:31:16 +0700 Subject: [PATCH 017/155] test(console-v6): assert GROUP and FX Return by stable ChannelId, never roster tail --- tests/console_native_integration_test.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/console_native_integration_test.cpp b/tests/console_native_integration_test.cpp index 8b08ae9a8..8413b4a69 100644 --- a/tests/console_native_integration_test.cpp +++ b/tests/console_native_integration_test.cpp @@ -175,8 +175,15 @@ int main() { assert(find(snap,ch2)->primaryOutId==std::to_string(group.value)); assert(find(snap,group)->primaryInputCount==2); const auto groupWire=toConsoleWireReadbackV6(snap); - assert(groupWire.channels.back().role=="GROUP" && - groupWire.channels.back().primaryInputCount==2); + // The accepted roster order is NOT the operator display order. Resolve + // the actual accepted ChannelId, never assume a newly added bus is last. + const auto groupWireIt=std::find_if(groupWire.channels.begin(), + groupWire.channels.end(),[&](const auto& c) { + return c.id==std::to_string(group.value); + }); + assert(groupWireIt!=groupWire.channels.end()); + assert(groupWireIt->role=="GROUP" && + groupWireIt->primaryInputCount==2); assert(render()&&approx(left[31],(.2f+.4f)*center*2.f)); assert(approx(ml[31],(.2f*.2f+.4f*.3f)*center)); @@ -191,8 +198,13 @@ int main() { assert(liveCh7->sends.size()==2); // MONITOR remains, wet SEND added assert(find(snap,wet)->parallelSendInputCount==1); const auto returnWire=toConsoleWireReadbackV6(snap); - assert(returnWire.channels.back().role=="FX_RETURN" && - returnWire.channels.back().parallelSendInputCount==1); + const auto returnWireIt=std::find_if(returnWire.channels.begin(), + returnWire.channels.end(),[&](const auto& c) { + return c.id==std::to_string(wet.value); + }); + assert(returnWireIt!=returnWire.channels.end()); + assert(returnWireIt->role=="FX_RETURN" && + returnWireIt->parallelSendInputCount==1); assert(render()); assert(approx(left[31],(.2f+.4f)*center*2.f+.2f*center*.25f*.5f)); assert(approx(ml[31],(.2f*.2f+.4f*.3f)*center)); From dd55b8fb95f745b61d58f7d62a239e195f9f16ca Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 11:11:48 +0700 Subject: [PATCH 018/155] feat(engine): add truthful JUCE control-thread Console v6 source and fail-closed ACK adapter --- src/ConsoleLiveBridgeV6.h | 195 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 src/ConsoleLiveBridgeV6.h diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h new file mode 100644 index 000000000..3e67562db --- /dev/null +++ b/src/ConsoleLiveBridgeV6.h @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include +#include +#include +#include + +// Native Console v6 adapter, exclusively on the JUCE MESSAGE/CONTROL thread. +// This projects the real M4 callback/device readback WITHOUT promoting its +// fixed strip indexes to fictitious ChannelIds. The production ChannelId +// migration must replace this deliberately fail-closed G0 capability gate. +// It never owns PCM, clones VST3, or calls the audio device from the browser. +namespace armix::console { +class LiveConsoleBridgeV6 final { +public: + static constexpr int schemaVersion=6; + + // Source: LiveAudioEngine::status() with its real JUCE callback telemetry, + // driver active masks and epoch. No browser invented physical pins. + static juce::var snapshot(const juce::var& live) { + const auto route=live.getProperty("dryRoutingLab",{}); + const auto ep=decimalFromNative(route.getProperty("epoch",juce::var())); + auto result=std::make_unique(); + result->setProperty("schemaVersion",schemaVersion); + result->setProperty("productionCallbackLive",false); + + auto device=std::make_unique(); + device->setProperty("epoch",ep); + device->setProperty("backend",live.getProperty("driver","").toString()); + device->setProperty("captureDevice",live.getProperty("inputDevice","").toString()); + device->setProperty("playbackDevice",live.getProperty("outputDevice","").toString()); + device->setProperty("sampleRate",live.getProperty("rate",juce::var())); + device->setProperty("bufferFrames",live.getProperty("buffer",juce::var())); + const bool routeAccepted=static_cast(route.getProperty("ready",false)) && + static_cast(route.getProperty("hasAcceptedRoute",false)); + const bool direct=static_cast(live.getProperty("directRouteAuthorized",false)); + const bool armed=static_cast(live.getProperty("monitor",false)) && + static_cast(live.getProperty("connected",false)) && + direct && routeAccepted; + device->setProperty("outputArmed",armed); + const auto physicalInputs=route.getProperty("ports",juce::var()); + device->setProperty("inputEndpoints",physicalInputs.isArray() + ?physicalInputs:juce::var(juce::Array{})); + juce::Array outputs; + if(const auto* enabled=route.getProperty("outputPorts",juce::var()).getArray()) { + for(int i=0;isize();++i){ + const auto p=enabled->getReference(i); + if(!p.isInt())continue; + auto item=std::make_unique(); + item->setProperty("port",p); + item->setProperty("callback",i); + outputs.add(juce::var(item.release())); + } + } + device->setProperty("outputEndpoints",juce::var(outputs)); + result->setProperty("device",juce::var(device.release())); + + // No universal roster or stable ChannelId exists in the installed M4 + // audio callback yet. In particular, never present "CH10 FX Return" + // as a true wet FX_RETURN node and never advertise +CHANNEL/GROUP. + auto graph=std::make_unique(); + graph->setProperty("revision","0"); + graph->setProperty("rosterRevision","0"); + graph->setProperty("channels",juce::var(juce::Array{})); + graph->setProperty("destinations",juce::var(juce::Array{})); + auto capabilities=std::make_unique(); + capabilities->setProperty("callbackOwnsChannelIds",false); + capabilities->setProperty("fullVendorFxMigration",false); + capabilities->setProperty("showAndOutputParity",false); + capabilities->setProperty("physicalCaptureMapped",false); + capabilities->setProperty("dynamicChannels",false); + capabilities->setProperty("groups",false); + capabilities->setProperty("fxReturns",false); + capabilities->setProperty("monitor",false); + capabilities->setProperty("sendsOnFaders",false); + capabilities->setProperty("supportedOps",juce::var(juce::Array{})); + graph->setProperty("capabilities",juce::var(capabilities.release())); + result->setProperty("graph",juce::var(graph.release())); + + auto telemetry=std::make_unique(); + const auto peak=static_cast(live.getProperty("inputPeak",0.0)); + const auto callbackCount=static_cast(live.getProperty("callbackCount",0.0)); + const auto callbackInputs=static_cast(live.getProperty("callbackInputChannels",0)); + const bool raw=static_cast(live.getProperty("connected",false)) && + callbackCount>0 && callbackInputs>0 && peak>0.0005; + telemetry->setProperty("rawCapturePresent",raw); + telemetry->setProperty("rawCapturePeak",peak); + telemetry->setProperty("mainPcmPresent",armed && + static_cast(live.getProperty("peak",0.0))>0.0002); + telemetry->setProperty("monitorPcmPresent",armed && + static_cast(route.getProperty("monitorPeakL",0.0))>0.0002); + telemetry->setProperty("channelMeterRmsPeak",juce::var(juce::Array{})); + result->setProperty("telemetry",juce::var(telemetry.release())); + + // Separate LEGACY diagnostic metadata cannot be mistaken for accepted + // ChannelId graph revisions. Output remains governed by old M4. + auto legacy=std::make_unique(); + legacy->setProperty("active",static_cast(route.getProperty("active",false))); + legacy->setProperty("routeAccepted",routeAccepted); + legacy->setProperty("routingRevision",decimalFromNative( + route.getProperty("revision",juce::var()))); + legacy->setProperty("channelPeaks",route.getProperty("channelPeaks", + juce::var(juce::Array{}))); + result->setProperty("legacyM4",juce::var(legacy.release())); + return juce::var(result.release()); + } + + // Exact native wire: opaque, unique-per-editor requestId and uint64 + // canonical DECIMAL STRINGS, never a lossy double / JS Number cast. + // This G0 adapter has no supported mutating operation: an invalid/stale + // request or unsupported role must preserve the currently audible M4. + juce::var rejectUnsupportedIntent(const juce::var& intent, + const juce::var& acceptedSnapshot) { + const auto request=intent.getProperty("requestId",juce::var()); + const auto id=request.isString()?request.toString():juce::String{}; + auto ack=std::make_unique(); + ack->setProperty("requestId",id); + ack->setProperty("status","REJECTED"); + const auto device=acceptedSnapshot.getProperty("device",{}); + const auto graph=acceptedSnapshot.getProperty("graph",{}); + const auto epoch=device.getProperty("epoch","0").toString(); + ack->setProperty("deviceEpoch",epoch); + ack->setProperty("graphRevision",graph.getProperty("revision","0")); + ack->setProperty("rosterRevision",graph.getProperty("rosterRevision","0")); + juce::String fault="UNIVERSAL_CALLBACK_NOT_READY"; + if(!validRequestId(id))fault="INVALID_REQUEST_ID"; + else if(completed_.find(id.toStdString())!=completed_.end()) + fault="DUPLICATE_REQUEST_ID"; + else { + completed_.insert(id.toStdString()); + // G0 is fail closed by design. Distinguish malformed/stale wire + // from a legitimate mutation that requires the M4->M5 cutover. + std::uint64_t asked=0,baseGraph=0,baseRoster=0; + const bool wellFormed=decodeDecimal(intent.getProperty("deviceEpoch",{}),asked) && + decodeDecimal(intent.getProperty("baseGraphRevision",{}),baseGraph) && + decodeDecimal(intent.getProperty("baseRosterRevision",{}),baseRoster) && + intent.getProperty("operation",{}).isString(); + if(!wellFormed)fault="INVALID_DECIMAL_WIRE"; + else if(intent.getProperty("deviceEpoch",{}).toString()!=epoch) + fault="STALE_DEVICE_EPOCH"; + else if(intent.getProperty("baseGraphRevision",{}).toString()!= + graph.getProperty("revision","0").toString() || + intent.getProperty("baseRosterRevision",{}).toString()!= + graph.getProperty("rosterRevision","0").toString()) + fault="STALE_GRAPH_REVISION"; + else { + const auto target=intent.getProperty("targetChannelId",juce::var()); + std::uint64_t ignored=0; + if(!target.isVoid() && !decodeDecimal(target,ignored)) + fault="INVALID_CHANNEL_ID"; + } + } + ack->setProperty("errorCode",fault); + ack->setProperty("productionCallbackLive",false); + return juce::var(ack.release()); + } + + static bool decodeDecimal(const juce::var& raw,std::uint64_t& result) noexcept { + if(!raw.isString())return false; + const auto str=raw.toString(); + if(str.isEmpty()||str.length()>20 || + (str.length()>1 && str[0]=='0'))return false; + std::uint64_t n=0; + for(int i=0;i'9')return false; + const auto digit=static_cast(c-'0'); + if(n>(std::numeric_limits::max()-digit)/10)return false; + n=n*10+digit; + } + result=n;return true; + } + +private: + static juce::String decimalFromNative(const juce::var& value) { + if(!(value.isInt()||value.isInt64()))return "0"; + const auto n=static_cast(value); + return n>=0?juce::String(n):juce::String("0"); + } + static bool validRequestId(const juce::String& id) noexcept { + if(id.isEmpty()||id.length()>128)return false; + for(int i=0;i='a'&&c<='z')||(c>='A'&&c<='Z')|| + (c>='0'&&c<='9')||c==':'||c=='_'||c=='-'||c=='.'; + if(!acceptable)return false; + } + return true; + } + // No eviction-based replay window while this browser connection exists. + // Only control thread touches this; RT callback never sees request IDs. + std::unordered_set completed_; +}; +} // namespace armix::console From b2417e7573a5244a707a04b677e3eb53b898b180 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 11:12:16 +0700 Subject: [PATCH 019/155] feat(engine): connect actual JUCE M4 status to native v6 subscribe/ACK wire without faking callback cutover --- src/Main.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/Main.cpp b/src/Main.cpp index c4258b25e..8bf88f3d4 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -5,6 +5,7 @@ #include #include #include "LiveAudioEngine.h" +#include "ConsoleLiveBridgeV6.h" #include "ArSonMixStartupSplash.h" #include "VstOrbitController.h" #include "../engine/core/OrbitDistanceMapping.h" @@ -219,6 +220,25 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr }) .withEventListener ("arMixParameter", [this] (juce::var args) { onParameter (args); }) .withEventListener ("arMixAction", [this] (juce::var args) { onAction (args); }) + .withEventListener ("arMixConsoleSubscribe", [this] (juce::var args) { + // G0: a real M4 device/callback snapshot, never synthetic + // ChannelId LIVE status before the M5 production cutover. + if (args.getProperty("protocol","").toString()!="v6") return; + consoleSubscribed_=true; + if (browser_.loaded) emitNativeConsoleSnapshot(engine_.status()); + }) + .withEventListener ("arMixConsoleIntent", [this] (juce::var args) { + // No native v6 mutation can be accepted while the installed + // audio callback still owns fixed M4 lanes. Rejection + // retains the existing VST3/Orbit/Show/MAIN output. + auto status=engine_.status(); + const auto snap=armix::console::LiveConsoleBridgeV6::snapshot(status); + const auto ack=consoleBridge_.rejectUnsupportedIntent(args,snap); + if (browser_.loaded) { + browser_.emitEventIfBrowserIsVisible("arMixConsoleAck",ack); + emitNativeConsoleSnapshot(status); + } + }) .withResourceProvider (assetFor)) { settingsDirectory().createDirectory(); @@ -262,6 +282,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr private: LiveAudioEngine engine_; + armix::console::LiveConsoleBridgeV6 consoleBridge_; + bool consoleSubscribed_=false; VstOrbitController orbit_; juce::int64 fxGraphRevision_ = 1; // control-thread monotonic graph generation PluginCatalog catalog_; @@ -500,6 +522,13 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr browser_.emitEventIfBrowserIsVisible ("arMixNotice", juce::var (o.release())); } + void emitNativeConsoleSnapshot(const juce::var& engineStatus) + { + if(browser_.loaded && consoleSubscribed_) + browser_.emitEventIfBrowserIsVisible("arMixConsoleSnapshot", + armix::console::LiveConsoleBridgeV6::snapshot(engineStatus)); + } + void emitCatalog() { if (browser_.loaded) @@ -2566,6 +2595,10 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if (startupError_.isNotEmpty() && !bool (state.getProperty ("connected", false))) state.getDynamicObject()->setProperty ("error", startupError_); browser_.emitEventIfBrowserIsVisible ("arMixStatus", state); + // Four status readbacks/second on the control thread. No JUCE + // callback mutation, graph pointer lease or extra signal engine. + if(consoleSubscribed_ && timerTicks_%3==0) + emitNativeConsoleSnapshot(state); } }; From 9844e2544db5297132f9bc98a4183cdb96c0fada Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 11:12:19 +0700 Subject: [PATCH 020/155] fix(engine): retain JUCE output pin var lifetime through native readback --- src/ConsoleLiveBridgeV6.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 3e67562db..920d2c2c0 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -43,7 +43,8 @@ class LiveConsoleBridgeV6 final { device->setProperty("inputEndpoints",physicalInputs.isArray() ?physicalInputs:juce::var(juce::Array{})); juce::Array outputs; - if(const auto* enabled=route.getProperty("outputPorts",juce::var()).getArray()) { + const auto enabledOutputPins=route.getProperty("outputPorts",juce::var()); + if(const auto* enabled=enabledOutputPins.getArray()) { for(int i=0;isize();++i){ const auto p=enabled->getReference(i); if(!p.isInt())continue; From b004c4ddb8a438017549cac5122518b14413f057 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 11:13:04 +0700 Subject: [PATCH 021/155] test(engine): actual M4 JUCE callback evidence to lossless v6 snapshot and fail-closed intents --- tests/live_channel_fx_graph_test.cpp | 99 ++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index b26420781..36f3da4b6 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -5,6 +5,7 @@ #include "../engine/core/UnifiedLegacyProductionAdmission.h" #include "../engine/core/NativeOutputPairTap.h" #include "../engine/core/RealtimeRoutePublisher.h" +#include "../src/ConsoleLiveBridgeV6.h" #if defined(NDEBUG) #undef NDEBUG #endif @@ -511,6 +512,103 @@ static void verifySourceFormatIndependentPanPcmParity() { } } +// G0: This is the real JUCE device/callback STATUS -> v6 Console wire, +// not a dry ChannelId graph or simulated universal engine. It must report +// measured M4 PCM while all unsupported ChannelId operations stay CLOSED. +static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { + using Bridge=armix::console::LiveConsoleBridgeV6; + auto route=std::make_unique(); + constexpr juce::int64 epoch=9007199254740993LL; // beyond JS Number safety + route->setProperty("epoch",epoch); + route->setProperty("revision",juce::int64(77)); + route->setProperty("active",true); + route->setProperty("ready",true); + route->setProperty("hasAcceptedRoute",true); + juce::Array ports; + auto port=std::make_unique(); + port->setProperty("port",2);port->setProperty("callback",0); + port->setProperty("label","ASIO Input 3"); + ports.add(juce::var(port.release())); + route->setProperty("ports",juce::var(ports)); + juce::Array outputs; + outputs.add(1);outputs.add(4); + route->setProperty("outputPorts",juce::var(outputs)); + juce::Array levels; + levels.add(.125);levels.add(0.0); + route->setProperty("channelPeaks",juce::var(levels)); + auto status=std::make_unique(); + status->setProperty("dryRoutingLab",juce::var(route.release())); + status->setProperty("driver","ASIO TEST"); + status->setProperty("inputDevice","TEST CAPTURE"); + status->setProperty("outputDevice","TEST RENDER"); + status->setProperty("connected",true); + status->setProperty("directRouteAuthorized",true); + status->setProperty("monitor",true); + status->setProperty("callbackCount",juce::int64(12)); + status->setProperty("callbackInputChannels",1); + status->setProperty("inputPeak",.25); + status->setProperty("peak",.125); + status->setProperty("rate",48000); + status->setProperty("buffer",128); + const auto live=juce::var(status.release()); + auto snap=Bridge::snapshot(live); + auto device=snap.getProperty("device",{}); + auto graph=snap.getProperty("graph",{}); + auto measured=snap.getProperty("telemetry",{}); + assert(snap.getProperty("schemaVersion",0)==6); + assert(!static_cast(snap.getProperty("productionCallbackLive",true))); + assert(device.getProperty("epoch","").toString()=="9007199254740993"); + assert(static_cast(device.getProperty("outputArmed",false))); + assert(static_cast(measured.getProperty("rawCapturePresent",false))); + assert(static_cast(measured.getProperty("mainPcmPresent",false))); + assert(graph.getProperty("revision","").toString()=="0"); + assert(graph.getProperty("rosterRevision","").toString()=="0"); + assert(graph.getProperty("channels",{}).getArray()->isEmpty()); + const auto caps=graph.getProperty("capabilities",{}); + assert(!static_cast(caps.getProperty("callbackOwnsChannelIds",true))); + assert(caps.getProperty("supportedOps",{}).getArray()->isEmpty()); + auto ins=device.getProperty("inputEndpoints",{}); + auto outs=device.getProperty("outputEndpoints",{}); + assert(ins.getArray()->size()==1 && outs.getArray()->size()==2); + assert(ins.getArray()->getReference(0).getProperty("port",0)==2); + assert(outs.getArray()->getReference(0).getProperty("port",0)==1); + assert(outs.getArray()->getReference(1).getProperty("port",0)==4); + const auto diagnostic=snap.getProperty("legacyM4",{}); + assert(diagnostic.getProperty("routingRevision","").toString()=="77"); + Bridge bridge; + const auto intent=[&](const juce::String& req,const juce::String& ep, + const juce::String& rev="0") { + auto o=std::make_unique(); + o->setProperty("requestId",req); + o->setProperty("deviceEpoch",ep); + o->setProperty("baseGraphRevision",rev); + o->setProperty("baseRosterRevision","0"); + o->setProperty("operation","SET_SOURCE"); + o->setProperty("targetChannelId","18446744073709551615"); + return juce::var(o.release()); + }; + const auto pending=intent("editor:nonce:1","9007199254740993"); + auto ack=bridge.rejectUnsupportedIntent(pending,snap); + assert(ack.getProperty("requestId","").toString()=="editor:nonce:1"); + assert(ack.getProperty("status","").toString()=="REJECTED"); + assert(ack.getProperty("errorCode","").toString()=="UNIVERSAL_CALLBACK_NOT_READY"); + assert(ack.getProperty("graphRevision","").toString()=="0"); + assert(bridge.rejectUnsupportedIntent(pending,snap) + .getProperty("errorCode","").toString()=="DUPLICATE_REQUEST_ID"); + assert(bridge.rejectUnsupportedIntent(intent("editor:nonce:2","9007199254740992"),snap) + .getProperty("errorCode","").toString()=="STALE_DEVICE_EPOCH"); + assert(bridge.rejectUnsupportedIntent(intent("editor:nonce:3","9007199254740993","9"),snap) + .getProperty("errorCode","").toString()=="STALE_GRAPH_REVISION"); + std::uint64_t decoded=0; + assert(Bridge::decodeDecimal(juce::var("18446744073709551615"),decoded)); + assert(decoded==std::numeric_limits::max()); + assert(!Bridge::decodeDecimal(juce::var("18446744073709551616"),decoded)); + assert(!Bridge::decodeDecimal(juce::var("01"),decoded)); + assert(!Bridge::decodeDecimal(juce::var(9007199254740993.0),decoded)); + // No request above mutates the genuinely accepted M4 hardware route. + assert(live.getProperty("dryRoutingLab",{}).getProperty("revision",0)==77); +} + int main() { // R0: existing CH1 FX chain may be rendered inside the SAME prepared // ten-channel routing pass, without creating a second plugin or copying @@ -882,6 +980,7 @@ int main() { verifyMU1LegacyM4FxFullMigrationAndMonitorPcm(); verifyOccupiedExternalCh1Owner(); verifySourceFormatIndependentPanPcmParity(); + verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch(); // Tests above use a real JUCE AudioProcessor processing seam. Vendor // VST3 formats and sound quality require separate Windows hardware FAT. } From 8704484c6b68de75c0ef81eeb4d509fb01ea4499 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 11:20:52 +0700 Subject: [PATCH 022/155] feat(engine): reuse #272 canonical uint64/opaque ID codec; exact per-pin raw PCM; bounded dedup --- src/ConsoleLiveBridgeV6.h | 69 ++++++++++++++++++++-------- tests/live_channel_fx_graph_test.cpp | 7 +++ 2 files changed, 57 insertions(+), 19 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 920d2c2c0..64297c9ce 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -1,7 +1,10 @@ // SPDX-License-Identifier: AGPL-3.0-only #pragma once #include +#include "../integration/ConsoleNativeContractV6.h" #include +#include +#include #include #include #include @@ -39,9 +42,35 @@ class LiveConsoleBridgeV6 final { static_cast(live.getProperty("connected",false)) && direct && routeAccepted; device->setProperty("outputArmed",armed); + // Exact enabled physical pin maps to JUCE callback ordinal; raw + // samples are measured by the installed input callback BEFORE MUTE. + // Omit per-pin evidence if the native observation is unavailable. const auto physicalInputs=route.getProperty("ports",juce::var()); - device->setProperty("inputEndpoints",physicalInputs.isArray() - ?physicalInputs:juce::var(juce::Array{})); + const auto perPort=live.getProperty("captureCallbackPeaks",juce::var()); + const auto* observed=perPort.getArray(); + juce::Array inputEndpoints; + if(const auto* pins=physicalInputs.getArray()) + for(const auto& pin:*pins) { + const auto cb=static_cast(pin.getProperty("callback",-1)); + const auto phys=pin.getProperty("port",juce::var()); + if(!phys.isInt()||cb<0)continue; + auto obj=std::make_unique(); + obj->setProperty("port",phys); + obj->setProperty("callback",cb); + obj->setProperty("label",pin.getProperty("label","")); + if(observed && cbsize()) { + const auto value=observed->getReference(cb); + if(value.isDouble()||value.isInt()) { + const auto peak=static_cast(value); + if(std::isfinite(peak)&&peak>=0.) { + obj->setProperty("rawPeak",peak); + obj->setProperty("rawPresent",peak>0.0005); + } + } + } + inputEndpoints.add(juce::var(obj.release())); + } + device->setProperty("inputEndpoints",juce::var(inputEndpoints)); juce::Array outputs; const auto enabledOutputPins=route.getProperty("outputPorts",juce::var()); if(const auto* enabled=enabledOutputPins.getArray()) { @@ -115,6 +144,7 @@ class LiveConsoleBridgeV6 final { const juce::var& acceptedSnapshot) { const auto request=intent.getProperty("requestId",juce::var()); const auto id=request.isString()?request.toString():juce::String{}; + const auto requestBytes=id.toStdString(); auto ack=std::make_unique(); ack->setProperty("requestId",id); ack->setProperty("status","REJECTED"); @@ -125,11 +155,17 @@ class LiveConsoleBridgeV6 final { ack->setProperty("graphRevision",graph.getProperty("revision","0")); ack->setProperty("rosterRevision",graph.getProperty("rosterRevision","0")); juce::String fault="UNIVERSAL_CALLBACK_NOT_READY"; - if(!validRequestId(id))fault="INVALID_REQUEST_ID"; - else if(completed_.find(id.toStdString())!=completed_.end()) + if(!armix::integration::validConsoleRequestId(requestBytes)) + fault="INVALID_REQUEST_ID"; + else if(completed_.find(requestBytes)!=completed_.end()) fault="DUPLICATE_REQUEST_ID"; else { - completed_.insert(id.toStdString()); + if(recentIds_.size()==maxRecentIds) { + completed_.erase(recentIds_.front()); + recentIds_.pop_front(); + } + recentIds_.push_back(requestBytes); + completed_.insert(requestBytes); // G0 is fail closed by design. Distinguish malformed/stale wire // from a legitimate mutation that requires the M4->M5 cutover. std::uint64_t asked=0,baseGraph=0,baseRoster=0; @@ -147,8 +183,11 @@ class LiveConsoleBridgeV6 final { fault="STALE_GRAPH_REVISION"; else { const auto target=intent.getProperty("targetChannelId",juce::var()); - std::uint64_t ignored=0; - if(!target.isVoid() && !decodeDecimal(target,ignored)) + armix::mixer::ChannelId channel{}; + if(!target.isVoid() && + (!target.isString() || + !armix::integration::parseNativeChannelId( + target.toString().toStdString(),channel))) fault="INVALID_CHANNEL_ID"; } } @@ -179,18 +218,10 @@ class LiveConsoleBridgeV6 final { const auto n=static_cast(value); return n>=0?juce::String(n):juce::String("0"); } - static bool validRequestId(const juce::String& id) noexcept { - if(id.isEmpty()||id.length()>128)return false; - for(int i=0;i='a'&&c<='z')||(c>='A'&&c<='Z')|| - (c>='0'&&c<='9')||c==':'||c=='_'||c=='-'||c=='.'; - if(!acceptable)return false; - } - return true; - } - // No eviction-based replay window while this browser connection exists. - // Only control thread touches this; RT callback never sees request IDs. + static constexpr std::size_t maxRecentIds=256; + // Bounded completed IDs on the serialized message thread, never the + // native RT callback. Replayed old requests remain nonmutating in G0. std::unordered_set completed_; + std::deque recentIds_; }; } // namespace armix::console diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 36f3da4b6..8dd2962dd 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -547,6 +547,9 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { status->setProperty("callbackCount",juce::int64(12)); status->setProperty("callbackInputChannels",1); status->setProperty("inputPeak",.25); + juce::Array perPort; + perPort.add(.25); + status->setProperty("captureCallbackPeaks",juce::var(perPort)); status->setProperty("peak",.125); status->setProperty("rate",48000); status->setProperty("buffer",128); @@ -571,6 +574,10 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { auto outs=device.getProperty("outputEndpoints",{}); assert(ins.getArray()->size()==1 && outs.getArray()->size()==2); assert(ins.getArray()->getReference(0).getProperty("port",0)==2); + assert(static_cast(ins.getArray()->getReference(0) + .getProperty("rawPeak",0.0))==.25); + assert(static_cast(ins.getArray()->getReference(0) + .getProperty("rawPresent",false))); assert(outs.getArray()->getReference(0).getProperty("port",0)==1); assert(outs.getArray()->getReference(1).getProperty("port",0)==4); const auto diagnostic=snap.getProperty("legacyM4",{}); From 9efdc752cca6411effe7c531359b0d5c9acac666 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 11:35:06 +0700 Subject: [PATCH 023/155] feat(engine): first-sound physical MONO source transaction on installed M4 callback, preserving VST3/Show and rollback; fix MSVC tests --- src/LiveAudioEngine.h | 19 ++++++- src/LiveDryRoutingLab.h | 75 ++++++++++++++++++++++++++++ src/NativeVerifiedSourcePatch.h | 63 +++++++++++++++++++++++ tests/live_channel_fx_graph_test.cpp | 64 ++++++++++++++++++++++-- 4 files changed, 214 insertions(+), 7 deletions(-) create mode 100644 src/NativeVerifiedSourcePatch.h diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index a80004bf0..178c8eb7e 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1058,14 +1058,29 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback } juce::String switchDryRoutingLabSource(int strip,std::uint64_t epoch, std::uint64_t revision,const juce::String& mode, - int left,int right) noexcept { + int left,int right) { if(independent_.active()||routeReconfiguring_.load(std::memory_order_acquire)|| handoff_.busy()||!directFence_.permitted()|| diagnosticRoute_.load(std::memory_order_acquire) !=armix::diagnostics::Route::normal|| savedDirectSetup_||savedLiveSetup_) return "SOURCE SWITCH: live DIRECT device or graph unavailable"; - return dryRoutingLab_.switchPhysicalSource(strip,epoch,revision,mode,left,right); + auto* device=deviceManager_.getCurrentAudioDevice(); + if(!device)return "SOURCE: active DIRECT audio device unavailable"; + // True first-input SOURCE selection is a control-prepared native graph + // transaction, not a browser-side APPLY or alternate callback. A + // single verified mono capture pin is a supported source. + try { + return dryRoutingLab_.repatchPhysicalSource( + strip,epoch,revision,mode,left,right, + directFence_.permitted(),independent_.active(), + graphOwned_->count,formats_,device->getCurrentSampleRate(), + juce::jmax(32,device->getCurrentBufferSizeSamples())); + } catch(const std::exception& ex) { + return "SOURCE: native prepare failed; prior audio kept: " + juce::String(ex.what()); + } catch(...) { + return "SOURCE: native prepare failed; prior audio kept"; + } } bool setDryRoutingLabParameter(int strip,std::uint64_t epoch, std::uint64_t revision,const juce::String& parameter, diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 3f4631e71..464daa857 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -6,6 +6,7 @@ #include "../engine/core/DynamicChannelFxLeaseBank.h" #include "VstBusLayout.h" #include "../engine/core/NativeDryRouteCommand.h" +#include "NativeVerifiedSourcePatch.h" #include "../engine/device/JuceActivePortSnapshot.h" #include "../engine/core/RealtimeRoutePublisher.h" #include "../engine/device/LiveInputPortRegistry.h" @@ -412,6 +413,11 @@ class LiveDryRoutingLab final { // displays an acknowledged immutable copy; draft changes // never update this until graph publication succeeds. acceptedRoute_=explicitSelection?command:juce::var(); + // Retain the REAL prepared (possibly UNPATCHED/SILENT) M4 + // input topology so a single native SOURCE selection can + // compile the first mono route. No UI draft is authoritative. + sourceTemplate_=command; + acceptedFxSelections_=selections; // Release-store only AFTER a valid immutable graph publishes. // Even if OUTPUT is mistakenly armed, unpatched renders never // enter ANY channel/master vendor DSP or produce sound. @@ -487,6 +493,71 @@ class LiveDryRoutingLab final { return {}; } + // A source changing from NONE to MONO/STEREO needs a new prepared + // topology. A source changing physical pin within the same format uses + // the existing zero-heap atomic source switch above. Both cases are + // handled through ONE native command and ONE ACK, not GUI APPLY wizard. + // All heavy preparation/reuse and deep cloning happen on message thread. + juce::String repatchPhysicalSource(int strip,std::uint64_t expectedEpoch, + std::uint64_t expectedRevision,const juce::String& mode, + int physicalLeft,int physicalRight,bool directPermitted, + bool independentClock,int occupiedCh1Fx, + juce::AudioPluginFormatManager& formats,double sampleRate, + int deviceFrames) + { + if(!ready() || !registryValid_.load(std::memory_order_acquire) || + topologyFault_.load(std::memory_order_acquire) || + expectedEpoch!=epoch() || expectedRevision!=revision() || + !sourceTemplate_.isObject()) + return "SOURCE: native device, graph or accepted template stale"; + const auto sourceRows=sourceTemplate_.getProperty("channels",juce::var()); + const auto* rows=sourceRows.getArray(); + if(!rows || strip<0 || strip>=count || rows->size()!=count) + return "SOURCE: target channel unavailable"; + // Preserve the proven live-safe atomic path for an already scheduled + // channel. Never force a vendor graph rebuild for ordinary pin moves. + if(hasExplicitRoute() && + rows->getReference(strip).getProperty("mode",{}).toString()==mode) + return switchPhysicalSource(strip,expectedEpoch,expectedRevision, + mode,physicalLeft,physicalRight); + const int available=portCount_.load(std::memory_order_acquire); + if(available<=0||available>armix::device::LiveInputPortRegistry::limit) + return "SOURCE: driver did not verify active capture pins"; + std::array pins{}; + for(int i=0;i(available)}, + expectedEpoch,expectedRevision,staged); + if(error.isNotEmpty())return error; + // Preserve every currently ACKed fader, pan, MUTE and SOLO. The + // template may predate atomic live controls; reusing it verbatim + // would silently reset a musician's mix after a SOURCE selection. + auto stagedRows=staged.getProperty("channels",juce::var()); + auto* editable=stagedRows.getArray(); + if(!editable || editable->size()!=count) + return "SOURCE: prepared input document malformed"; + for(int i=0;igetReference(i).getDynamicObject(); + if(!row)return "SOURCE: missing acknowledged channel control"; + const auto& c=channelEdits_[i]; + row->setProperty("gain",static_cast(c.linear)); + row->setProperty("pan",static_cast(c.pan)); + row->setProperty("mute",c.mute); + row->setProperty("solo",c.solo); + } + if(expectedEpoch!=epoch() || expectedRevision!=revision() || + !registryValid_.load(std::memory_order_acquire)) + return "SOURCE: device changed during preparation; accepted mix preserved"; + // Same M4 publisher, same plugin lease/FX state and physical MAIN + // outputs. Existing 256-frame topology crossfade is performed by + // its ONE installed callback. Compilation/publish failures roll back. + return apply(staged,directPermitted,independentClock,occupiedCh1Fx, + acceptedFxSelections_,formats,sampleRate,deviceFrames,true); + } + // 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 @@ -693,6 +764,8 @@ class LiveDryRoutingLab final { fxCount_.store(0,std::memory_order_relaxed); fxReused_.store(0,std::memory_order_relaxed); acceptedRoute_=juce::var(); // control-thread STOP only + sourceTemplate_=juce::var(); + acceptedFxSelections_=FxSelections{}; for(auto& n:auxFxNames_)n.clear(); for(auto& p:channelPeaks_)p.store(0.f,std::memory_order_relaxed); for(auto& p:channelPeaksL_)p.store(0.f,std::memory_order_relaxed); @@ -1052,6 +1125,8 @@ class LiveDryRoutingLab final { std::array,auxCount> auxPeaks_{}; std::atomic auxCountActive_{0},auxSendCount_{0}; juce::var acceptedRoute_; // native ACK only, no UI preview/localStorage truth + juce::var sourceTemplate_; // last prepared M4 template, including SILENT/NONE startup + FxSelections acceptedFxSelections_{}; // CONTROL ONLY: original VST3 identity for FX reuse // 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_{}; diff --git a/src/NativeVerifiedSourcePatch.h b/src/NativeVerifiedSourcePatch.h new file mode 100644 index 000000000..6ca6f4d78 --- /dev/null +++ b/src/NativeVerifiedSourcePatch.h @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include +#include +#include +#include + +// Message-thread SOURCE transaction: one verified input selection from an +// initially SILENT M4 session, without modifying the accepted Show or FX +// until the whole graph/epoch has compiled. Both MAIN and auxiliary outputs +// remain owned by the existing one JUCE production callback. +namespace armix::mixer { +struct NativeVerifiedSourcePatch final { + static juce::String prepare(const juce::var& accepted, + int channel,const juce::String& mode,int physicalLeft,int physicalRight, + std::span enabledPhysicalPorts, + std::uint64_t actualEpoch,std::uint64_t actualRevision, + juce::var& destination) + { + if(!actualEpoch || + actualEpoch>static_cast(std::numeric_limits::max()) || + actualRevision>static_cast(std::numeric_limits::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()) + return "SOURCE: select an enabled physical capture pin"; + if(static_cast(accepted.getProperty("deviceEpoch",juce::var(-1))) != + static_cast(actualEpoch)) + return "SOURCE: device epoch changed; accepted patch preserved"; + bool validLeft=false,validRight=false; + for(const int port:enabledPhysicalPorts) { + if(port==physicalLeft)validLeft=true; + if(port==physicalRight)validRight=true; + } + if(!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 + // mutate the still-audible accepted routing snapshot. + auto copy=juce::JSON::parse(juce::JSON::toString(accepted,false)); + if(!copy.isObject()) + return "SOURCE: cannot clone accepted native patch"; + auto channels=copy.getProperty("channels",juce::var()); + auto* list=channels.getArray(); + if(!list || list->size()!=10 || !list->getReference(channel).isObject()) + return "SOURCE: accepted patch channel layout unavailable"; + auto* row=list->getReference(channel).getDynamicObject(); + row->setProperty("mode",mode); + row->setProperty("left",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. + copy.getDynamicObject()->setProperty("deviceEpoch",static_cast(actualEpoch)); + copy.getDynamicObject()->setProperty("revision",static_cast(actualRevision)); + destination=std::move(copy); + return {}; + } +}; +} // namespace armix::mixer diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 8dd2962dd..a0ca9fb4e 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -6,6 +6,7 @@ #include "../engine/core/NativeOutputPairTap.h" #include "../engine/core/RealtimeRoutePublisher.h" #include "../src/ConsoleLiveBridgeV6.h" +#include "../src/NativeVerifiedSourcePatch.h" #if defined(NDEBUG) #undef NDEBUG #endif @@ -558,7 +559,7 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { auto device=snap.getProperty("device",{}); auto graph=snap.getProperty("graph",{}); auto measured=snap.getProperty("telemetry",{}); - assert(snap.getProperty("schemaVersion",0)==6); + assert(static_cast(snap.getProperty("schemaVersion",0))==6); assert(!static_cast(snap.getProperty("productionCallbackLive",true))); assert(device.getProperty("epoch","").toString()=="9007199254740993"); assert(static_cast(device.getProperty("outputArmed",false))); @@ -573,13 +574,13 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { auto ins=device.getProperty("inputEndpoints",{}); auto outs=device.getProperty("outputEndpoints",{}); assert(ins.getArray()->size()==1 && outs.getArray()->size()==2); - assert(ins.getArray()->getReference(0).getProperty("port",0)==2); + assert(static_cast(ins.getArray()->getReference(0).getProperty("port",0))==2); assert(static_cast(ins.getArray()->getReference(0) .getProperty("rawPeak",0.0))==.25); assert(static_cast(ins.getArray()->getReference(0) .getProperty("rawPresent",false))); - assert(outs.getArray()->getReference(0).getProperty("port",0)==1); - assert(outs.getArray()->getReference(1).getProperty("port",0)==4); + assert(static_cast(outs.getArray()->getReference(0).getProperty("port",0))==1); + assert(static_cast(outs.getArray()->getReference(1).getProperty("port",0))==4); const auto diagnostic=snap.getProperty("legacyM4",{}); assert(diagnostic.getProperty("routingRevision","").toString()=="77"); Bridge bridge; @@ -613,7 +614,59 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(!Bridge::decodeDecimal(juce::var("01"),decoded)); assert(!Bridge::decodeDecimal(juce::var(9007199254740993.0),decoded)); // No request above mutates the genuinely accepted M4 hardware route. - assert(live.getProperty("dryRoutingLab",{}).getProperty("revision",0)==77); + assert(static_cast(live.getProperty("dryRoutingLab",{}).getProperty("revision",0))==77); +} + +// G1 physical First Sound: one enabled callback pin becomes a MONO +// production source in ONE native mutation. No fabricated stereo IN1/IN1, +// no accidental modification of the last accepted M4 request on failure. +static void verifyFirstSoundOnePinNativeSourceDraft() { + using armix::mixer::NativeVerifiedSourcePatch; + auto command=std::make_unique(); + command->setProperty("deviceEpoch",juce::int64(17)); + command->setProperty("revision",juce::int64(8)); + juce::Array sources; + for(int c=0;c<10;++c) { + auto ch=std::make_unique(); + ch->setProperty("mode","NONE"); + ch->setProperty("left",-1); + ch->setProperty("right",-1); + ch->setProperty("gain",.25); + ch->setProperty("pan",0.0); + sources.add(juce::var(ch.release())); + } + command->setProperty("channels",juce::var(sources)); + const auto accepted=juce::var(command.release()); + const std::array physical{{5}}; + juce::var candidate; + assert(NativeVerifiedSourcePatch::prepare(accepted,6,"MONO",5,-1, + physical,17,9,candidate).isEmpty()); + const auto draftChannels=candidate.getProperty("channels",juce::var()); + const auto* acceptedChannels=accepted.getProperty("channels",juce::var()).getArray(); + const auto* changed=draftChannels.getArray(); + assert(changed && changed->size()==10 && acceptedChannels && + acceptedChannels->size()==10); + assert(changed->getReference(6).getProperty("mode","").toString()=="MONO"); + assert(static_cast(changed->getReference(6).getProperty("left",-1))==5); + assert(static_cast(changed->getReference(6).getProperty("right",0))==-1); + assert(acceptedChannels->getReference(6).getProperty("mode","").toString()=="NONE"); + assert(candidate.getProperty("revision",{}).toString()=="9"); + candidate=juce::var(); + assert(NativeVerifiedSourcePatch::prepare(accepted,6,"STEREO",5,5, + physical,17,9,candidate).isNotEmpty()); + assert(candidate.isVoid()); + assert(NativeVerifiedSourcePatch::prepare(accepted,6,"STEREO",5,7, + physical,17,9,candidate).isNotEmpty()); + assert(NativeVerifiedSourcePatch::prepare(accepted,6,"MONO",4,-1, + physical,17,9,candidate).isNotEmpty()); + assert(NativeVerifiedSourcePatch::prepare(accepted,6,"MONO",5,-1, + physical,18,9,candidate).isNotEmpty()); + assert(acceptedChannels->getReference(6).getProperty("mode","").toString()=="NONE"); + const std::array stereoPhysical{{5,7}}; + assert(NativeVerifiedSourcePatch::prepare(accepted,2,"STEREO",5,7, + stereoPhysical,17,9,candidate).isEmpty()); + const auto stereoRows=candidate.getProperty("channels",juce::var()); + assert(stereoRows.getArray()->getReference(2).getProperty("mode","").toString()=="STEREO"); } int main() { @@ -988,6 +1041,7 @@ int main() { verifyOccupiedExternalCh1Owner(); verifySourceFormatIndependentPanPcmParity(); verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch(); + verifyFirstSoundOnePinNativeSourceDraft(); // Tests above use a real JUCE AudioProcessor processing seam. Vendor // VST3 formats and sound quality require separate Windows hardware FAT. } From dbc81de2a9f3c9ff53119a9098821e453c6b6477 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 11:35:48 +0700 Subject: [PATCH 024/155] fix(engine): hold JUCE var lifetime when asserting accepted source rollback --- tests/live_channel_fx_graph_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index a0ca9fb4e..46fa1bbbd 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -642,7 +642,8 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { assert(NativeVerifiedSourcePatch::prepare(accepted,6,"MONO",5,-1, physical,17,9,candidate).isEmpty()); const auto draftChannels=candidate.getProperty("channels",juce::var()); - const auto* acceptedChannels=accepted.getProperty("channels",juce::var()).getArray(); + const auto sourceBefore=accepted.getProperty("channels",juce::var()); + const auto* acceptedChannels=sourceBefore.getArray(); const auto* changed=draftChannels.getArray(); assert(changed && changed->size()==10 && acceptedChannels && acceptedChannels->size()==10); From fa5af9eee962191343c1494deb28419f1432296e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 12:50:55 +0700 Subject: [PATCH 025/155] engine(s0): canonical native v8 wire serializer, compiled C++ fixture generator and deterministic unready fixture --- engine/core/ConsolePuzzleV8Wire.h | 130 ++++++++++++++++++ tests/console_puzzle_v8_fixture.cpp | 34 +++++ tests/fixtures/console-v8-native-unready.json | 1 + 3 files changed, 165 insertions(+) create mode 100644 engine/core/ConsolePuzzleV8Wire.h create mode 100644 tests/console_puzzle_v8_fixture.cpp create mode 100644 tests/fixtures/console-v8-native-unready.json diff --git a/engine/core/ConsolePuzzleV8Wire.h b/engine/core/ConsolePuzzleV8Wire.h new file mode 100644 index 000000000..41d4a2300 --- /dev/null +++ b/engine/core/ConsolePuzzleV8Wire.h @@ -0,0 +1,130 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include +#include +#include +#include + +// One native wire serializer shared by JUCE control-thread producer and +// deterministic S0 fixture generator. NO DSP or callback ownership here. +// Physical ports and PCM measurements MUST come from actual native status. +namespace armix::console { +struct PuzzleV8Pin final { + int port=-1,callback=-1; + std::string label; + bool hasRawPeak=false; + double rawPeak=0.0; +}; +struct PuzzleV8Snapshot final { + std::string epoch="0",backend,captureDevice,playbackDevice; + std::string graphRevision="0",rosterRevision="0",legacyRoutingRevision="0"; + int sampleRate=0,bufferFrames=0; + bool outputArmed=false,rawCapturePresent=false; + bool mainPcmPresent=false,monitorPcmPresent=false; + double rawCapturePeak=0.0; + bool legacyActive=false,legacyRouteAccepted=false; + std::vector inputs,outputs; + // Installed M4 callback does NOT own a ChannelId graph yet. + bool productionCallbackLive=false; +}; +struct PuzzleV8Ack final { + std::string requestId,status="REJECTED",deviceEpoch="0"; + std::string graphRevision="0",rosterRevision="0"; + std::string errorCode="UNIVERSAL_CALLBACK_NOT_READY"; +}; +class PuzzleV8Wire final { + static std::string quote(const std::string& in) { + std::string out="\""; + static constexpr char hex[]="0123456789abcdef"; + for(const unsigned char c:in) { + switch(c) { + case '"':out+="\\\"";break; + case '\\':out+="\\\\";break; + case '\n':out+="\\n";break; + case '\r':out+="\\r";break; + case '\t':out+="\\t";break; + default: + if(c<32) {out+="\\u00";out+=hex[c>>4];out+=hex[c&15];} + else out+=static_cast(c); + } + } + return out+'"'; + } + static const char* bit(bool b) noexcept{return b?"true":"false";} + static std::string number(double n) { + if(!std::isfinite(n)||n<0.)return "null"; + char buffer[80]{}; + std::snprintf(buffer,sizeof(buffer),"%.9g",n); + return buffer; + } + static std::string pins(const std::vector& list) { + std::string s="["; + for(const auto& p:list) { + if(p.port<0||p.callback<0)continue; + if(s.size()>1)s+=','; + s+="{\"port\":"+std::to_string(p.port)+",\"callback\":"+ + std::to_string(p.callback)+",\"label\":"+quote(p.label); + if(p.hasRawPeak && std::isfinite(p.rawPeak) && p.rawPeak>=0.) { + s+=",\"rawPeak\":"+number(p.rawPeak)+ + ",\"rawPresent\":"+bit(p.rawPeak>0.0005); + } + s+='}'; + } + return s+"]"; + } + static std::string enabled(const std::vector& list) { + std::string s="["; + for(const auto& p:list){ + if(p.port<0||p.callback<0)continue; + if(s.size()>1)s+=','; + s+=std::to_string(p.port); + } + return s+"]"; + } +public: + static std::string snapshot(const PuzzleV8Snapshot& s) { + // Complete v8 mandatory wire even while callback is not universal. + // ChannelId and revisions are decimal strings; no JSON double. + return "{\"schemaVersion\":6,\"productionCallbackLive\":"+ + std::string(bit(s.productionCallbackLive))+ + ",\"device\":{\"epoch\":"+quote(s.epoch)+ + ",\"backend\":"+quote(s.backend)+ + ",\"captureDevice\":"+quote(s.captureDevice)+ + ",\"playbackDevice\":"+quote(s.playbackDevice)+ + ",\"inputEndpoints\":"+pins(s.inputs)+ + ",\"outputEndpoints\":"+pins(s.outputs)+ + ",\"enabledInputs\":"+enabled(s.inputs)+ + ",\"enabledOutputs\":"+enabled(s.outputs)+ + ",\"sampleRate\":"+(s.sampleRate>0?std::to_string(s.sampleRate):"null")+ + ",\"bufferFrames\":"+(s.bufferFrames>0?std::to_string(s.bufferFrames):"null")+ + ",\"outputArmed\":"+bit(s.outputArmed)+ + "},\"graph\":{\"revision\":"+quote(s.graphRevision)+ + ",\"rosterRevision\":"+quote(s.rosterRevision)+ + ",\"channels\":[],\"destinations\":[],\"capabilities\":{" + "\"callbackOwnsChannelIds\":false,\"fullVendorFxMigration\":false," + "\"showAndOutputParity\":false,\"physicalCaptureMapped\":false," + "\"dynamicChannels\":false,\"groups\":false,\"fxReturns\":false," + "\"monitor\":false,\"sendsOnFaders\":false,\"supportedOps\":[]}}," + "\"telemetry\":{\"rawCapturePresent\":"+bit(s.rawCapturePresent)+ + ",\"rawCapturePeak\":"+number(s.rawCapturePeak)+ + ",\"mainPcmPresent\":"+bit(s.mainPcmPresent)+ + ",\"monitorPcmPresent\":"+bit(s.monitorPcmPresent)+ + ",\"channelMeterRmsPeak\":[]},\"legacyM4\":{\"active\":"+ + bit(s.legacyActive)+",\"routeAccepted\":"+bit(s.legacyRouteAccepted)+ + ",\"routingRevision\":"+quote(s.legacyRoutingRevision)+"}}"; + } + static std::string ack(const PuzzleV8Ack& a) { + return "{\"requestId\":"+quote(a.requestId)+ + ",\"status\":"+quote(a.status)+ + ",\"deviceEpoch\":"+quote(a.deviceEpoch)+ + ",\"graphRevision\":"+quote(a.graphRevision)+ + ",\"rosterRevision\":"+quote(a.rosterRevision)+ + ",\"errorCode\":"+quote(a.errorCode)+"}"; + } + static std::string fixture(const PuzzleV8Snapshot& s,const PuzzleV8Ack& a) { + return "{\"producer\":\"native-cpp-v8-s0-unready\",\"snapshot\":"+ + snapshot(s)+",\"ack\":"+ack(a)+"}\n"; + } +}; +} // namespace armix::console diff --git a/tests/console_puzzle_v8_fixture.cpp b/tests/console_puzzle_v8_fixture.cpp new file mode 100644 index 000000000..05c59f095 --- /dev/null +++ b/tests/console_puzzle_v8_fixture.cpp @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Portable C++ fixture generator, SAME serializer as runtime. +// g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic -Iengine/core tests/console_puzzle_v8_fixture.cpp -o /tmp/arsonmix-v8-fixture +// /tmp/arsonmix-v8-fixture > tests/fixtures/console-v8-native-unready.json +#include "../engine/core/ConsolePuzzleV8Wire.h" +#include +#include +#include +int main(int argc,char** argv) { + using namespace armix::console; + PuzzleV8Snapshot snapshot; + // No audio driver exists in deterministic CI. UNREADY is the only + // truthful native state: zero invented physical pins or PCM and no fake + // ChannelIds from M4 presentation indices. + snapshot.epoch="0"; + PuzzleV8Ack ack; + ack.requestId="native-fixture-session:1"; + const auto json=PuzzleV8Wire::fixture(snapshot,ack); + assert(json.find("\"enabledInputs\":[]")!=std::string::npos); + assert(json.find("\"productionCallbackLive\":false")!=std::string::npos); + assert(json.find("\"supportedOps\":[]")!=std::string::npos); + if(argc>1 && std::string(argv[1])=="--negative") { + snapshot.inputs.push_back({5,0,"Mic 1",true,0.125}); + snapshot.outputs.push_back({2,0,"OUT3",false,0.}); + const auto withPins=PuzzleV8Wire::snapshot(snapshot); + assert(withPins.find("\"enabledInputs\":[5]")!=std::string::npos); + assert(withPins.find("\"enabledOutputs\":[2]")!=std::string::npos); + assert(withPins.find("\"rawPeak\":0.125")!=std::string::npos); + assert(PuzzleV8Wire::ack(ack).find("native-fixture-session:1")!=std::string::npos); + return 0; + } + std::cout< Date: Sun, 1 Nov 2026 12:51:31 +0700 Subject: [PATCH 026/155] engine(s0): route real JUCE snapshot and ACK through single native v8 wire producer --- src/ConsoleLiveBridgeV6.h | 190 +++++++++++++++----------------------- 1 file changed, 75 insertions(+), 115 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 64297c9ce..959ed5f10 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -2,6 +2,7 @@ #pragma once #include #include "../integration/ConsoleNativeContractV6.h" +#include "../engine/core/ConsolePuzzleV8Wire.h" #include #include #include @@ -22,118 +23,77 @@ class LiveConsoleBridgeV6 final { // Source: LiveAudioEngine::status() with its real JUCE callback telemetry, // driver active masks and epoch. No browser invented physical pins. static juce::var snapshot(const juce::var& live) { - const auto route=live.getProperty("dryRoutingLab",{}); - const auto ep=decimalFromNative(route.getProperty("epoch",juce::var())); - auto result=std::make_unique(); - result->setProperty("schemaVersion",schemaVersion); - result->setProperty("productionCallbackLive",false); - - auto device=std::make_unique(); - device->setProperty("epoch",ep); - device->setProperty("backend",live.getProperty("driver","").toString()); - device->setProperty("captureDevice",live.getProperty("inputDevice","").toString()); - device->setProperty("playbackDevice",live.getProperty("outputDevice","").toString()); - device->setProperty("sampleRate",live.getProperty("rate",juce::var())); - device->setProperty("bufferFrames",live.getProperty("buffer",juce::var())); - const bool routeAccepted=static_cast(route.getProperty("ready",false)) && + // Single actual native producer for both JUCE WebView and S0 + // fixture. No JSON shape authored by the JS/GUI. + PuzzleV8Snapshot w; + const auto route=live.getProperty("dryRoutingLab",juce::var()); + w.epoch=decimalFromNative(route.getProperty("epoch",juce::var())).toStdString(); + w.legacyRoutingRevision=decimalFromNative( + route.getProperty("revision",juce::var())).toStdString(); + w.legacyActive=static_cast(route.getProperty("active",false)); + w.legacyRouteAccepted=static_cast(route.getProperty("ready",false)) && static_cast(route.getProperty("hasAcceptedRoute",false)); - const bool direct=static_cast(live.getProperty("directRouteAuthorized",false)); - const bool armed=static_cast(live.getProperty("monitor",false)) && - static_cast(live.getProperty("connected",false)) && - direct && routeAccepted; - device->setProperty("outputArmed",armed); - // Exact enabled physical pin maps to JUCE callback ordinal; raw - // samples are measured by the installed input callback BEFORE MUTE. - // Omit per-pin evidence if the native observation is unavailable. - const auto physicalInputs=route.getProperty("ports",juce::var()); - const auto perPort=live.getProperty("captureCallbackPeaks",juce::var()); - const auto* observed=perPort.getArray(); - juce::Array inputEndpoints; - if(const auto* pins=physicalInputs.getArray()) - for(const auto& pin:*pins) { - const auto cb=static_cast(pin.getProperty("callback",-1)); - const auto phys=pin.getProperty("port",juce::var()); - if(!phys.isInt()||cb<0)continue; - auto obj=std::make_unique(); - obj->setProperty("port",phys); - obj->setProperty("callback",cb); - obj->setProperty("label",pin.getProperty("label","")); - if(observed && cbsize()) { - const auto value=observed->getReference(cb); - if(value.isDouble()||value.isInt()) { - const auto peak=static_cast(value); - if(std::isfinite(peak)&&peak>=0.) { - obj->setProperty("rawPeak",peak); - obj->setProperty("rawPresent",peak>0.0005); + w.backend=live.getProperty("driver","").toString().toStdString(); + w.captureDevice=live.getProperty("inputDevice","").toString().toStdString(); + w.playbackDevice=live.getProperty("outputDevice","").toString().toStdString(); + const double rate=static_cast(live.getProperty("rate",0.)); + if(std::isfinite(rate) && rate>0. && rate<=384000.) + w.sampleRate=static_cast(rate); + const int frames=static_cast(live.getProperty("buffer",0)); + if(frames>0)w.bufferFrames=frames; + const bool connected=static_cast(live.getProperty("connected",false)); + w.outputArmed=connected && w.legacyRouteAccepted && + static_cast(live.getProperty("monitor",false)) && + static_cast(live.getProperty("directRouteAuthorized",false)); + const auto peak=static_cast(live.getProperty("inputPeak",0.)); + if(std::isfinite(peak) && peak>=0.)w.rawCapturePeak=peak; + w.rawCapturePresent=connected && + static_cast(live.getProperty("callbackCount",0.))>0. && + static_cast(live.getProperty("callbackInputChannels",0))>0 && + w.rawCapturePeak>0.0005; + w.mainPcmPresent=w.outputArmed && + static_cast(live.getProperty("peak",0.))>0.0002; + w.monitorPcmPresent=w.outputArmed && + static_cast(route.getProperty("monitorPeakL",0.))>0.0002; + const auto pins=route.getProperty("ports",juce::var()); + const auto peaks=live.getProperty("captureCallbackPeaks",juce::var()); + const auto* readings=peaks.getArray(); + if(const auto* physical=pins.getArray()) + for(const auto& p:*physical) { + const auto number=p.getProperty("port",juce::var()); + const auto ordinal=p.getProperty("callback",juce::var()); + if(!number.isInt()||!ordinal.isInt())continue; + PuzzleV8Pin pin; + pin.port=static_cast(number); + pin.callback=static_cast(ordinal); + if(pin.port<0 || pin.callback<0)continue; + pin.label=p.getProperty("label","").toString().toStdString(); + if(readings && pin.callbacksize()) { + const auto value=readings->getReference(pin.callback); + if(value.isInt()||value.isDouble()) { + const auto peakValue=static_cast(value); + if(std::isfinite(peakValue)&&peakValue>=0.) { + pin.hasRawPeak=true;pin.rawPeak=peakValue; } } } - inputEndpoints.add(juce::var(obj.release())); + w.inputs.push_back(std::move(pin)); } - device->setProperty("inputEndpoints",juce::var(inputEndpoints)); - juce::Array outputs; - const auto enabledOutputPins=route.getProperty("outputPorts",juce::var()); - if(const auto* enabled=enabledOutputPins.getArray()) { - for(int i=0;isize();++i){ - const auto p=enabled->getReference(i); - if(!p.isInt())continue; - auto item=std::make_unique(); - item->setProperty("port",p); - item->setProperty("callback",i); - outputs.add(juce::var(item.release())); + const auto outputs=route.getProperty("outputPorts",juce::var()); + if(const auto* ports=outputs.getArray()) + for(int ordinal=0;ordinalsize();++ordinal) { + const auto value=ports->getReference(ordinal); + if(!value.isInt())continue; + const int physical=static_cast(value); + if(physical<0)continue; + w.outputs.push_back({physical,ordinal,{},{},0.}); } - } - device->setProperty("outputEndpoints",juce::var(outputs)); - result->setProperty("device",juce::var(device.release())); - - // No universal roster or stable ChannelId exists in the installed M4 - // audio callback yet. In particular, never present "CH10 FX Return" - // as a true wet FX_RETURN node and never advertise +CHANNEL/GROUP. - auto graph=std::make_unique(); - graph->setProperty("revision","0"); - graph->setProperty("rosterRevision","0"); - graph->setProperty("channels",juce::var(juce::Array{})); - graph->setProperty("destinations",juce::var(juce::Array{})); - auto capabilities=std::make_unique(); - capabilities->setProperty("callbackOwnsChannelIds",false); - capabilities->setProperty("fullVendorFxMigration",false); - capabilities->setProperty("showAndOutputParity",false); - capabilities->setProperty("physicalCaptureMapped",false); - capabilities->setProperty("dynamicChannels",false); - capabilities->setProperty("groups",false); - capabilities->setProperty("fxReturns",false); - capabilities->setProperty("monitor",false); - capabilities->setProperty("sendsOnFaders",false); - capabilities->setProperty("supportedOps",juce::var(juce::Array{})); - graph->setProperty("capabilities",juce::var(capabilities.release())); - result->setProperty("graph",juce::var(graph.release())); - - auto telemetry=std::make_unique(); - const auto peak=static_cast(live.getProperty("inputPeak",0.0)); - const auto callbackCount=static_cast(live.getProperty("callbackCount",0.0)); - const auto callbackInputs=static_cast(live.getProperty("callbackInputChannels",0)); - const bool raw=static_cast(live.getProperty("connected",false)) && - callbackCount>0 && callbackInputs>0 && peak>0.0005; - telemetry->setProperty("rawCapturePresent",raw); - telemetry->setProperty("rawCapturePeak",peak); - telemetry->setProperty("mainPcmPresent",armed && - static_cast(live.getProperty("peak",0.0))>0.0002); - telemetry->setProperty("monitorPcmPresent",armed && - static_cast(route.getProperty("monitorPeakL",0.0))>0.0002); - telemetry->setProperty("channelMeterRmsPeak",juce::var(juce::Array{})); - result->setProperty("telemetry",juce::var(telemetry.release())); - - // Separate LEGACY diagnostic metadata cannot be mistaken for accepted - // ChannelId graph revisions. Output remains governed by old M4. - auto legacy=std::make_unique(); - legacy->setProperty("active",static_cast(route.getProperty("active",false))); - legacy->setProperty("routeAccepted",routeAccepted); - legacy->setProperty("routingRevision",decimalFromNative( - route.getProperty("revision",juce::var()))); - legacy->setProperty("channelPeaks",route.getProperty("channelPeaks", - juce::var(juce::Array{}))); - result->setProperty("legacyM4",juce::var(legacy.release())); - return juce::var(result.release()); + // Authoritative installed renderer is still the old M4 PCM graph. + // Never promote CH10's label to a real wet FX_RETURN or advertise + // universal CREATE/GROUP/INSERT until one ChannelId callback owns it. + w.productionCallbackLive=false; + const auto bytes=PuzzleV8Wire::snapshot(w); + return juce::JSON::parse(juce::String::fromUTF8(bytes.c_str())); } // Exact native wire: opaque, unique-per-editor requestId and uint64 @@ -145,15 +105,9 @@ class LiveConsoleBridgeV6 final { const auto request=intent.getProperty("requestId",juce::var()); const auto id=request.isString()?request.toString():juce::String{}; const auto requestBytes=id.toStdString(); - auto ack=std::make_unique(); - ack->setProperty("requestId",id); - ack->setProperty("status","REJECTED"); const auto device=acceptedSnapshot.getProperty("device",{}); const auto graph=acceptedSnapshot.getProperty("graph",{}); const auto epoch=device.getProperty("epoch","0").toString(); - ack->setProperty("deviceEpoch",epoch); - ack->setProperty("graphRevision",graph.getProperty("revision","0")); - ack->setProperty("rosterRevision",graph.getProperty("rosterRevision","0")); juce::String fault="UNIVERSAL_CALLBACK_NOT_READY"; if(!armix::integration::validConsoleRequestId(requestBytes)) fault="INVALID_REQUEST_ID"; @@ -191,9 +145,15 @@ class LiveConsoleBridgeV6 final { fault="INVALID_CHANNEL_ID"; } } - ack->setProperty("errorCode",fault); - ack->setProperty("productionCallbackLive",false); - return juce::var(ack.release()); + PuzzleV8Ack ack; + ack.requestId=requestBytes; + ack.status="REJECTED"; + ack.deviceEpoch=epoch.toStdString(); + ack.graphRevision=graph.getProperty("revision","0").toString().toStdString(); + ack.rosterRevision=graph.getProperty("rosterRevision","0").toString().toStdString(); + ack.errorCode=fault.toStdString(); + const auto bytes=PuzzleV8Wire::ack(ack); + return juce::JSON::parse(juce::String::fromUTF8(bytes.c_str())); } static bool decodeDecimal(const juce::var& raw,std::uint64_t& result) noexcept { From 03f8bfd876474857848b993031d7ca47304ff9bd Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 12:52:17 +0700 Subject: [PATCH 027/155] test(engine): compare exact native C++ fixture bytes to JUCE producer, validate v8 required pin arrays and ACK --- tests/live_channel_fx_graph_test.cpp | 67 ++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 46fa1bbbd..afd18d6b7 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -18,6 +18,9 @@ #include #include #include +#include +#include +#include using namespace armix::mixer; static std::atomic heapCalls{0}; @@ -574,6 +577,13 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { auto ins=device.getProperty("inputEndpoints",{}); auto outs=device.getProperty("outputEndpoints",{}); assert(ins.getArray()->size()==1 && outs.getArray()->size()==2); + const auto acceptedInputs=device.getProperty("enabledInputs",{}); + const auto acceptedOutputs=device.getProperty("enabledOutputs",{}); + assert(acceptedInputs.getArray() && acceptedInputs.getArray()->size()==1); + assert(acceptedOutputs.getArray() && acceptedOutputs.getArray()->size()==2); + assert(static_cast(acceptedInputs.getArray()->getReference(0))==2); + assert(static_cast(acceptedOutputs.getArray()->getReference(0))==1); + assert(static_cast(acceptedOutputs.getArray()->getReference(1))==4); assert(static_cast(ins.getArray()->getReference(0).getProperty("port",0))==2); assert(static_cast(ins.getArray()->getReference(0) .getProperty("rawPeak",0.0))==.25); @@ -670,6 +680,62 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { assert(stereoRows.getArray()->getReference(2).getProperty("mode","").toString()=="STEREO"); } +// V8 S0: a C++ fixture, built with the SAME header serializer installed in +// JUCE WebView, never hand-maintained by GUI/FAT. No real audio device exists +// for this UNREADY fixture and it intentionally has no dynamic capabilities. +static void verifyNativePuzzleV8FixtureAndWire() { + using namespace armix::console; + PuzzleV8Snapshot fixtureSource; + fixtureSource.epoch="0"; + PuzzleV8Ack rejected; + rejected.requestId="native-fixture-session:1"; + const auto expected=PuzzleV8Wire::fixture(fixtureSource,rejected); + const auto fixtureFile=std::filesystem::path(__FILE__).parent_path()/ + "fixtures"/"console-v8-native-unready.json"; + std::ifstream source(fixtureFile,std::ios::binary); + assert(source.is_open()); + const std::string checked((std::istreambuf_iterator(source)), + std::istreambuf_iterator()); + assert(expected==checked); + const auto parsed=juce::JSON::parse(juce::String::fromUTF8(expected.c_str())); + assert(parsed.isObject()); + const auto snap=parsed.getProperty("snapshot",{}); + const auto device=snap.getProperty("device",{}); + const auto graph=snap.getProperty("graph",{}); + const auto telem=snap.getProperty("telemetry",{}); + const auto ack=parsed.getProperty("ack",{}); + assert(static_cast(snap.getProperty("schemaVersion",0))==6); + assert(!static_cast(snap.getProperty("productionCallbackLive",true))); + assert(device.getProperty("enabledInputs",{}).getArray()->isEmpty()); + assert(device.getProperty("enabledOutputs",{}).getArray()->isEmpty()); + assert(device.getProperty("inputEndpoints",{}).getArray()->isEmpty()); + assert(device.getProperty("outputEndpoints",{}).getArray()->isEmpty()); + assert(device.getProperty("sampleRate",{}).isVoid()); + assert(graph.getProperty("channels",{}).getArray()->isEmpty()); + assert(graph.getProperty("capabilities",{}) + .getProperty("supportedOps",{}).getArray()->isEmpty()); + assert(!static_cast(telem.getProperty("mainPcmPresent",true))); + assert(ack.getProperty("requestId","").toString()=="native-fixture-session:1"); + assert(ack.getProperty("status","").toString()=="REJECTED"); + PuzzleV8Snapshot withPins; + withPins.inputs.push_back({5,0,"Mic \"1\"\n",true,.25}); + withPins.outputs.push_back({7,0,"PHYS OUT8",false,0.}); + const auto physical=juce::JSON::parse(juce::String::fromUTF8( + PuzzleV8Wire::snapshot(withPins).c_str())); + const auto physicalDev=physical.getProperty("device",{}); + const auto inputMask=physicalDev.getProperty("enabledInputs",{}); + const auto outputMask=physicalDev.getProperty("enabledOutputs",{}); + assert(inputMask.getArray()->size()==1 && + static_cast(inputMask.getArray()->getReference(0))==5); + assert(outputMask.getArray()->size()==1 && + static_cast(outputMask.getArray()->getReference(0))==7); + const auto in=physicalDev.getProperty("inputEndpoints",{}); + assert(in.getArray()->getReference(0).getProperty("label","").toString()== + "Mic \"1\"\n"); + assert(static_cast(in.getArray()->getReference(0) + .getProperty("rawPeak",0.))==.25); +} + int main() { // R0: existing CH1 FX chain may be rendered inside the SAME prepared // ten-channel routing pass, without creating a second plugin or copying @@ -1043,6 +1109,7 @@ int main() { verifySourceFormatIndependentPanPcmParity(); verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch(); verifyFirstSoundOnePinNativeSourceDraft(); + verifyNativePuzzleV8FixtureAndWire(); // Tests above use a real JUCE AudioProcessor processing seam. Vendor // VST3 formats and sound quality require separate Windows hardware FAT. } From d1a5ce5f842a352d1d04146cc6261c0e1635c6a1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 12:59:10 +0700 Subject: [PATCH 028/155] engine(s0): adopt exact v8 four-event native fixture ABI, valid epoch/port IDs and compiled --emit-console-s0-json --- engine/core/ConsolePuzzleV8Wire.h | 31 ++++++++++++++++++--------- src/ConsoleLiveBridgeV6.h | 7 +++++- tests/console_puzzle_v8_fixture.cpp | 2 +- tests/live_channel_fx_graph_test.cpp | 32 +++++++++++++++++++++++++--- 4 files changed, 57 insertions(+), 15 deletions(-) diff --git a/engine/core/ConsolePuzzleV8Wire.h b/engine/core/ConsolePuzzleV8Wire.h index 41d4a2300..0a7484355 100644 --- a/engine/core/ConsolePuzzleV8Wire.h +++ b/engine/core/ConsolePuzzleV8Wire.h @@ -17,7 +17,7 @@ struct PuzzleV8Pin final { double rawPeak=0.0; }; struct PuzzleV8Snapshot final { - std::string epoch="0",backend,captureDevice,playbackDevice; + std::string epoch="1",backend,captureDevice,playbackDevice; std::string graphRevision="0",rosterRevision="0",legacyRoutingRevision="0"; int sampleRate=0,bufferFrames=0; bool outputArmed=false,rawCapturePresent=false; @@ -58,13 +58,16 @@ class PuzzleV8Wire final { std::snprintf(buffer,sizeof(buffer),"%.9g",n); return buffer; } - static std::string pins(const std::vector& list) { + static std::string pins(const std::vector& list,const char* kind) { std::string s="["; for(const auto& p:list) { - if(p.port<0||p.callback<0)continue; + if(p.port<0||p.port>255||p.callback<0)continue; if(s.size()>1)s+=','; - s+="{\"port\":"+std::to_string(p.port)+",\"callback\":"+ - std::to_string(p.callback)+",\"label\":"+quote(p.label); + s+="{\"id\":"+quote(std::string(kind)+":"+std::to_string(p.port))+ + ",\"port\":"+std::to_string(p.port)+",\"callback\":"+ + std::to_string(p.callback)+",\"label\":"+ + quote(p.label.empty()?std::string(kind)+" "+std::to_string(p.port+1):p.label)+ + ",\"active\":true"; if(p.hasRawPeak && std::isfinite(p.rawPeak) && p.rawPeak>=0.) { s+=",\"rawPeak\":"+number(p.rawPeak)+ ",\"rawPresent\":"+bit(p.rawPeak>0.0005); @@ -76,7 +79,7 @@ class PuzzleV8Wire final { static std::string enabled(const std::vector& list) { std::string s="["; for(const auto& p:list){ - if(p.port<0||p.callback<0)continue; + if(p.port<0||p.port>255||p.callback<0)continue; if(s.size()>1)s+=','; s+=std::to_string(p.port); } @@ -92,8 +95,8 @@ class PuzzleV8Wire final { ",\"backend\":"+quote(s.backend)+ ",\"captureDevice\":"+quote(s.captureDevice)+ ",\"playbackDevice\":"+quote(s.playbackDevice)+ - ",\"inputEndpoints\":"+pins(s.inputs)+ - ",\"outputEndpoints\":"+pins(s.outputs)+ + ",\"inputEndpoints\":"+pins(s.inputs,"in")+ + ",\"outputEndpoints\":"+pins(s.outputs,"out")+ ",\"enabledInputs\":"+enabled(s.inputs)+ ",\"enabledOutputs\":"+enabled(s.outputs)+ ",\"sampleRate\":"+(s.sampleRate>0?std::to_string(s.sampleRate):"null")+ @@ -123,8 +126,16 @@ class PuzzleV8Wire final { ",\"errorCode\":"+quote(a.errorCode)+"}"; } static std::string fixture(const PuzzleV8Snapshot& s,const PuzzleV8Ack& a) { - return "{\"producer\":\"native-cpp-v8-s0-unready\",\"snapshot\":"+ - snapshot(s)+",\"ack\":"+ack(a)+"}\n"; + const auto state=snapshot(s); + const auto command="{\"requestId\":"+quote(a.requestId)+ + ",\"deviceEpoch\":"+quote(s.epoch)+ + ",\"baseGraphRevision\":"+quote(s.graphRevision)+ + ",\"baseRosterRevision\":"+quote(s.rosterRevision)+ + ",\"operation\":\"SET_SOURCE\",\"targetChannelId\":null,\"payload\":{}}"; + return "{\"events\":[{\"event\":\"arMixConsoleSnapshot\",\"payload\":"+ + state+"},{\"event\":\"arMixConsoleIntent\",\"payload\":"+command+ + "},{\"event\":\"arMixConsoleAck\",\"payload\":"+ack(a)+ + "},{\"event\":\"arMixConsoleSnapshot\",\"payload\":"+state+"}]}\n"; } }; } // namespace armix::console diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 959ed5f10..c412200fc 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -27,7 +27,12 @@ class LiveConsoleBridgeV6 final { // fixture. No JSON shape authored by the JS/GUI. PuzzleV8Snapshot w; const auto route=live.getProperty("dryRoutingLab",juce::var()); - w.epoch=decimalFromNative(route.getProperty("epoch",juce::var())).toStdString(); + // The control session has an epoch even before a driver is opened. + // 1 is the UNREADY session generation, NOT a fabricated physical + // source; any later verified device epoch supersedes this token. + auto actualEpoch=decimalFromNative(route.getProperty("epoch",juce::var())); + if(actualEpoch=="0")actualEpoch="1"; + w.epoch=actualEpoch.toStdString(); w.legacyRoutingRevision=decimalFromNative( route.getProperty("revision",juce::var())).toStdString(); w.legacyActive=static_cast(route.getProperty("active",false)); diff --git a/tests/console_puzzle_v8_fixture.cpp b/tests/console_puzzle_v8_fixture.cpp index 05c59f095..7ab2ca61e 100644 --- a/tests/console_puzzle_v8_fixture.cpp +++ b/tests/console_puzzle_v8_fixture.cpp @@ -12,7 +12,7 @@ int main(int argc,char** argv) { // No audio driver exists in deterministic CI. UNREADY is the only // truthful native state: zero invented physical pins or PCM and no fake // ChannelIds from M4 presentation indices. - snapshot.epoch="0"; + snapshot.epoch="1"; PuzzleV8Ack ack; ack.requestId="native-fixture-session:1"; const auto json=PuzzleV8Wire::fixture(snapshot,ack); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index afd18d6b7..cd84e3133 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -699,14 +700,29 @@ static void verifyNativePuzzleV8FixtureAndWire() { assert(expected==checked); const auto parsed=juce::JSON::parse(juce::String::fromUTF8(expected.c_str())); assert(parsed.isObject()); - const auto snap=parsed.getProperty("snapshot",{}); + const auto events=parsed.getProperty("events",{}); + assert(events.getArray()&&events.getArray()->size()==4); + const auto snap=events.getArray()->getReference(0).getProperty("payload",{}); const auto device=snap.getProperty("device",{}); const auto graph=snap.getProperty("graph",{}); const auto telem=snap.getProperty("telemetry",{}); - const auto ack=parsed.getProperty("ack",{}); + const auto cmd=events.getArray()->getReference(1).getProperty("payload",{}); + const auto ack=events.getArray()->getReference(2).getProperty("payload",{}); + const auto repeated=events.getArray()->getReference(3).getProperty("payload",{}); + assert(cmd.getProperty("requestId","").toString()== + ack.getProperty("requestId","").toString()); + assert(cmd.getProperty("deviceEpoch","").toString()=="1"); + assert(juce::JSON::toString(snap)==juce::JSON::toString(repeated)); + // The same installed JUCE bridge must produce this UNREADY event state. + const auto native=armix::console::LiveConsoleBridgeV6::snapshot(juce::var()); + assert(juce::JSON::toString(snap)==juce::JSON::toString(native)); + armix::console::LiveConsoleBridgeV6 runtime; + const auto realAck=runtime.rejectUnsupportedIntent(cmd,native); + assert(juce::JSON::toString(ack)==juce::JSON::toString(realAck)); assert(static_cast(snap.getProperty("schemaVersion",0))==6); assert(!static_cast(snap.getProperty("productionCallbackLive",true))); assert(device.getProperty("enabledInputs",{}).getArray()->isEmpty()); + assert(device.getProperty("epoch","").toString()=="1"); assert(device.getProperty("enabledOutputs",{}).getArray()->isEmpty()); assert(device.getProperty("inputEndpoints",{}).getArray()->isEmpty()); assert(device.getProperty("outputEndpoints",{}).getArray()->isEmpty()); @@ -732,11 +748,21 @@ static void verifyNativePuzzleV8FixtureAndWire() { const auto in=physicalDev.getProperty("inputEndpoints",{}); assert(in.getArray()->getReference(0).getProperty("label","").toString()== "Mic \"1\"\n"); + assert(in.getArray()->getReference(0).getProperty("id","").toString()=="in:5"); + assert(static_cast(in.getArray()->getReference(0).getProperty("active",false))); assert(static_cast(in.getArray()->getReference(0) .getProperty("rawPeak",0.))==.25); } -int main() { +int main(int argc,char** argv) { + if(argc==2 && std::string(argv[1])=="--emit-console-s0-json") { + verifyNativePuzzleV8FixtureAndWire(); + armix::console::PuzzleV8Snapshot s; + armix::console::PuzzleV8Ack ack; + ack.requestId="native-fixture-session:1"; + std::cout< Date: Sun, 1 Nov 2026 12:59:40 +0700 Subject: [PATCH 029/155] test(engine): check in 4-event JSON output from portable native C++ v8 generator --- tests/fixtures/console-v8-native-unready.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/console-v8-native-unready.json b/tests/fixtures/console-v8-native-unready.json index fef9d99ac..c4b3d9549 100644 --- a/tests/fixtures/console-v8-native-unready.json +++ b/tests/fixtures/console-v8-native-unready.json @@ -1 +1 @@ -{"producer":"native-cpp-v8-s0-unready","snapshot":{"schemaVersion":6,"productionCallbackLive":false,"device":{"epoch":"0","backend":"","captureDevice":"","playbackDevice":"","inputEndpoints":[],"outputEndpoints":[],"enabledInputs":[],"enabledOutputs":[],"sampleRate":null,"bufferFrames":null,"outputArmed":false},"graph":{"revision":"0","rosterRevision":"0","channels":[],"destinations":[],"capabilities":{"callbackOwnsChannelIds":false,"fullVendorFxMigration":false,"showAndOutputParity":false,"physicalCaptureMapped":false,"dynamicChannels":false,"groups":false,"fxReturns":false,"monitor":false,"sendsOnFaders":false,"supportedOps":[]}},"telemetry":{"rawCapturePresent":false,"rawCapturePeak":0,"mainPcmPresent":false,"monitorPcmPresent":false,"channelMeterRmsPeak":[]},"legacyM4":{"active":false,"routeAccepted":false,"routingRevision":"0"}},"ack":{"requestId":"native-fixture-session:1","status":"REJECTED","deviceEpoch":"0","graphRevision":"0","rosterRevision":"0","errorCode":"UNIVERSAL_CALLBACK_NOT_READY"}} +{"events":[{"event":"arMixConsoleSnapshot","payload":{"schemaVersion":6,"productionCallbackLive":false,"device":{"epoch":"1","backend":"","captureDevice":"","playbackDevice":"","inputEndpoints":[],"outputEndpoints":[],"enabledInputs":[],"enabledOutputs":[],"sampleRate":null,"bufferFrames":null,"outputArmed":false},"graph":{"revision":"0","rosterRevision":"0","channels":[],"destinations":[],"capabilities":{"callbackOwnsChannelIds":false,"fullVendorFxMigration":false,"showAndOutputParity":false,"physicalCaptureMapped":false,"dynamicChannels":false,"groups":false,"fxReturns":false,"monitor":false,"sendsOnFaders":false,"supportedOps":[]}},"telemetry":{"rawCapturePresent":false,"rawCapturePeak":0,"mainPcmPresent":false,"monitorPcmPresent":false,"channelMeterRmsPeak":[]},"legacyM4":{"active":false,"routeAccepted":false,"routingRevision":"0"}}},{"event":"arMixConsoleIntent","payload":{"requestId":"native-fixture-session:1","deviceEpoch":"1","baseGraphRevision":"0","baseRosterRevision":"0","operation":"SET_SOURCE","targetChannelId":null,"payload":{}}},{"event":"arMixConsoleAck","payload":{"requestId":"native-fixture-session:1","status":"REJECTED","deviceEpoch":"1","graphRevision":"0","rosterRevision":"0","errorCode":"UNIVERSAL_CALLBACK_NOT_READY"}},{"event":"arMixConsoleSnapshot","payload":{"schemaVersion":6,"productionCallbackLive":false,"device":{"epoch":"1","backend":"","captureDevice":"","playbackDevice":"","inputEndpoints":[],"outputEndpoints":[],"enabledInputs":[],"enabledOutputs":[],"sampleRate":null,"bufferFrames":null,"outputArmed":false},"graph":{"revision":"0","rosterRevision":"0","channels":[],"destinations":[],"capabilities":{"callbackOwnsChannelIds":false,"fullVendorFxMigration":false,"showAndOutputParity":false,"physicalCaptureMapped":false,"dynamicChannels":false,"groups":false,"fxReturns":false,"monitor":false,"sendsOnFaders":false,"supportedOps":[]}},"telemetry":{"rawCapturePresent":false,"rawCapturePeak":0,"mainPcmPresent":false,"monitorPcmPresent":false,"channelMeterRmsPeak":[]},"legacyM4":{"active":false,"routeAccepted":false,"routingRevision":"0"}}}]} From c87ec28b3175eab18648e78430c056e1fe6d2aef Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 13:22:54 +0700 Subject: [PATCH 030/155] fix(engine): source routing schema-v2 MONO pin transaction with independent processing width and native PCM plan; repair S0 epoch CTest --- src/NativeVerifiedSourcePatch.h | 16 +++++++ tests/live_channel_fx_graph_test.cpp | 68 +++++++++++++++++++++++++++- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/NativeVerifiedSourcePatch.h b/src/NativeVerifiedSourcePatch.h index 6ca6f4d78..36734ce4a 100644 --- a/src/NativeVerifiedSourcePatch.h +++ b/src/NativeVerifiedSourcePatch.h @@ -49,6 +49,22 @@ struct NativeVerifiedSourcePatch final { if(!list || list->size()!=10 || !list->getReference(channel).isObject()) return "SOURCE: accepted patch channel layout unavailable"; auto* row=list->getReference(channel).getDynamicObject(); + // Native routing v2 separates SOURCE format from the processing + // channel width. A source is not audible if only the old "mode" + // field changes: NativeDryRouteCommand::decode will reject the stale + // sourceKind/sourceFormat. Keep selected channelFormat intact so a + // one-pin MONO microphone may feed STEREO processing without IN2. + const auto schema=copy.getProperty("schemaVersion",juce::var()); + if(!schema.isVoid() && (!schema.isInt() || + (static_cast(schema)!=1 && static_cast(schema)!=2))) + return "SOURCE: unsupported accepted native route version"; + if(schema.isInt() && static_cast(schema)==2) { + 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("sourceFormat",mode); + } row->setProperty("mode",mode); row->setProperty("left",physicalLeft); row->setProperty("right",mode=="STEREO"?physicalRight:-1); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index dd25e5b1e..273bd877b 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -7,6 +7,7 @@ #include "../engine/core/RealtimeRoutePublisher.h" #include "../src/ConsoleLiveBridgeV6.h" #include "../src/NativeVerifiedSourcePatch.h" +#include "../engine/core/NativeDryRouteCommand.h" #if defined(NDEBUG) #undef NDEBUG #endif @@ -679,6 +680,71 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { stereoPhysical,17,9,candidate).isEmpty()); const auto stereoRows=candidate.getProperty("channels",juce::var()); assert(stereoRows.getArray()->getReference(2).getProperty("mode","").toString()=="STEREO"); + + // Real production route schema v2: distinguish physical SOURCE from + // channel PROCESSING width, and compile the accepted plan on the same + // NativeDryRouteCommand path used by LiveDryRoutingLab::apply(). + auto typed=juce::JSON::parse(juce::JSON::toString(accepted,false)); + typed.getDynamicObject()->setProperty("schemaVersion",2); + const auto typedSource=typed.getProperty("channels",{}); + for(auto& value:*typedSource.getArray()) { + auto* obj=value.getDynamicObject(); + assert(obj); + obj->setProperty("sourceKind","NONE"); + obj->setProperty("sourceFormat","NONE"); + obj->setProperty("channelFormat","STEREO"); + obj->setProperty("main",true); + obj->setProperty("mute",false); + obj->setProperty("solo",false); + } + juce::var typedNew; + assert(NativeVerifiedSourcePatch::prepare(typed,6,"MONO",5,-1, + physical,17,9,typedNew).isEmpty()); + const auto newRows=typedNew.getProperty("channels",{}); + const auto newCh=newRows.getArray()->getReference(6); + assert(newCh.getProperty("sourceKind","").toString()=="PHYSICAL"); + assert(newCh.getProperty("sourceFormat","").toString()=="MONO"); + assert(newCh.getProperty("channelFormat","").toString()=="STEREO"); + assert(static_cast(newCh.getProperty("right",0))==-1); + armix::mixer::NativeDryRouteCommand decoded; + juce::String error; + assert(armix::mixer::NativeDryRouteCommand::decode(typedNew,decoded,error)); + assert(decoded.channels.stripsAndMaster.strips[6].source== + armix::mixer::SourceMode::mono); + assert(decoded.channels.formats[6]==armix::mixer::ChannelFormat::stereo); + armix::mixer::ChannelRoutingPlan routed; + armix::mixer::LayoutError issue; + assert(armix::mixer::ChannelRoutingPlan::compile( + decoded.channels,physical,routed,issue)); + assert(routed.base.strips[6].inputA==0); + assert(routed.effectiveFormats[6]==armix::mixer::ChannelFormat::stereo); + const std::array mic{{.25f,.5f,.75f,1.f}}; + const float* nativePins[]{mic.data()}; + std::array routedL{},routedR{}; + assert(routed.base.extractSource(6,nativePins,1, + routedL.data(),routedR.data(),4)); + assert(routedL==mic && routedR==mic); + juce::var denied; + assert(NativeVerifiedSourcePatch::prepare(typed,6,"STEREO",5,5, + physical,17,9,denied).isNotEmpty()); + assert(denied.isVoid()); + assert(typedSource.getArray()->getReference(6) + .getProperty("sourceKind","").toString()=="NONE"); + + // SOURCE STEREO can be folded into MONO processing independently. + auto typedFold=juce::JSON::parse(juce::JSON::toString(typed,false)); + auto foldedRows=typedFold.getProperty("channels",{}); + foldedRows.getArray()->getReference(2).getDynamicObject() + ->setProperty("channelFormat","MONO"); + juce::var stereoFold; + assert(NativeVerifiedSourcePatch::prepare(typedFold,2,"STEREO",5,7, + stereoPhysical,17,9,stereoFold).isEmpty()); + assert(armix::mixer::NativeDryRouteCommand::decode( + stereoFold,decoded,error)); + assert(armix::mixer::ChannelRoutingPlan::compile( + decoded.channels,stereoPhysical,routed,issue)); + assert(routed.effectiveFormats[2]==armix::mixer::ChannelFormat::mono); + assert(routed.foldStereoToMono[2]); } // V8 S0: a C++ fixture, built with the SAME header serializer installed in @@ -687,7 +753,7 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { static void verifyNativePuzzleV8FixtureAndWire() { using namespace armix::console; PuzzleV8Snapshot fixtureSource; - fixtureSource.epoch="0"; + fixtureSource.epoch="1"; PuzzleV8Ack rejected; rejected.requestId="native-fixture-session:1"; rejected.deviceEpoch=fixtureSource.epoch; From c58f06f8e6d9cbf4ed170d5cc16173812b44deed Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 13:26:04 +0700 Subject: [PATCH 031/155] =?UTF-8?q?test(engine):=20execute=20installed=20M?= =?UTF-8?q?4=20channel=20FX=20PCM=20IN5=E2=86=92CH07=E2=86=92MAIN,=20mute/?= =?UTF-8?q?fader=20and=20no=20realtime=20heap=20on=20source-v2=20transacti?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/live_channel_fx_graph_test.cpp | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 273bd877b..dd25e3a2b 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -724,6 +724,36 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { assert(routed.base.extractSource(6,nativePins,1, routedL.data(),routedR.data(),4)); assert(routedL==mic && routedR==mic); + + // The *installed M4 native PCM renderer*, not DynamicPreparedMixerBlock: + // actual physical IN5 callback[0] -> independent CH07 -> stereo MAIN. + // Exercise the same LiveChannelFxGraph::process invoked by + // LiveDryRoutingLab::process from the sole JUCE hardware callback. + armix::mixer::PreparedRenderGraph prepared; + armix::mixer::RenderError renderError; + assert(armix::mixer::PreparedRenderGraph::compile( + decoded.channels,physical,decoded.sends,prepared,renderError,decoded.aux)); + armix::mixer::LiveChannelFxGraph production(prepared,64,64); + assert(production.setMainOutputPair(0,1,2)); + std::array mainL{},mainR{}; + armix::mixer::RenderLevels levels; + const auto beforeCallback=heapCalls.load(std::memory_order_relaxed); + assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); + assert(heapCalls.load(std::memory_order_relaxed)==beforeCallback); + assert(mainL[0] > 0.f && mainR[0] > 0.f && + std::isfinite(mainL[0]) && std::isfinite(mainR[0])); + assert(near(mainL[0],mainR[0])); + assert(levels.channelPeak[6] > 0.f); + assert(levels.channelPeak[1] == 0.f); // CH02 unpatched, no fake PCM. + assert(production.setStripControl(6,.25f,0.f,true,true,false)); + mainL.fill(1.f);mainR.fill(1.f); + const auto beforeMute=heapCalls.load(std::memory_order_relaxed); + assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); + assert(heapCalls.load(std::memory_order_relaxed)==beforeMute); + for(int n=0;n<4;++n)assert(mainL[n]==0.f && mainR[n]==0.f); + assert(production.setStripControl(6,.25f,0.f,true,false,false)); + assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); + assert(mainL[0]>0.f&&mainR[0]>0.f); juce::var denied; assert(NativeVerifiedSourcePatch::prepare(typed,6,"STEREO",5,5, physical,17,9,denied).isNotEmpty()); From 75ea5f44a7cf020dd61489f4759851c18795ba9d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 13:32:26 +0700 Subject: [PATCH 032/155] fix(engine): use JUCE DynamicObject one-argument getProperty in schema v2 source transaction --- src/NativeVerifiedSourcePatch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NativeVerifiedSourcePatch.h b/src/NativeVerifiedSourcePatch.h index 36734ce4a..ca9927d87 100644 --- a/src/NativeVerifiedSourcePatch.h +++ b/src/NativeVerifiedSourcePatch.h @@ -59,7 +59,7 @@ struct NativeVerifiedSourcePatch final { (static_cast(schema)!=1 && static_cast(schema)!=2))) return "SOURCE: unsupported accepted native route version"; if(schema.isInt() && static_cast(schema)==2) { - const auto width=row->getProperty("channelFormat",{}).toString(); + const auto width=row->getProperty("channelFormat").toString(); if(width!="MONO" && width!="STEREO") return "SOURCE: native processing format missing or invalid"; row->setProperty("sourceKind","PHYSICAL"); From 4683ce64d3bf7fb71e6353b75fe60cef976372ec Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 14:49:03 +0700 Subject: [PATCH 033/155] test(engine): verify production CH07 MUTE declick ramp and steady silence, not abrupt first-sample cutoff --- tests/live_channel_fx_graph_test.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index dd25e3a2b..247688818 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -745,12 +745,22 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { assert(near(mainL[0],mainR[0])); assert(levels.channelPeak[6] > 0.f); assert(levels.channelPeak[1] == 0.f); // CH02 unpatched, no fake PCM. + // The real strip deliberately de-clicks MUTE over up to 64 frames: + // a transition is NOT an immediate memset. Verify sample-by-sample + // monotonic fade and that steady muted blocks are truly silent. assert(production.setStripControl(6,.25f,0.f,true,true,false)); mainL.fill(1.f);mainR.fill(1.f); const auto beforeMute=heapCalls.load(std::memory_order_relaxed); assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); assert(heapCalls.load(std::memory_order_relaxed)==beforeMute); + assert(mainL[0]>0.f && mainR[0]>0.f); + assert(mainL[0]>mainL[1] && mainL[1]>mainL[2]); + assert(mainR[0]>mainR[1] && mainR[1]>mainR[2]); + assert(near(mainL[3],0.f) && near(mainR[3],0.f)); + mainL.fill(1.f);mainR.fill(1.f); + assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); for(int n=0;n<4;++n)assert(mainL[n]==0.f && mainR[n]==0.f); + assert(levels.channelPeak[6]==0.f); assert(production.setStripControl(6,.25f,0.f,true,false,false)); assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); assert(mainL[0]>0.f&&mainR[0]>0.f); From d4035eb66361db48311d927a91986a12d95621b9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 14:50:06 +0700 Subject: [PATCH 034/155] test(engine): PCM-accurate CH07 de-click gate and native VST3 owner preservation across verified physical source swap --- tests/live_channel_fx_graph_test.cpp | 67 +++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 247688818..cd8eca838 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -754,8 +754,13 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); assert(heapCalls.load(std::memory_order_relaxed)==beforeMute); assert(mainL[0]>0.f && mainR[0]>0.f); - assert(mainL[0]>mainL[1] && mainL[1]>mainL[2]); - assert(mainR[0]>mainR[1] && mainR[1]>mainR[2]); + // RAW physical microphone samples increase across the test block. + // Compare actual per-frame GAIN envelope after removing input amplitude, + // otherwise a correct fade is incorrectly rejected as nonmonotonic. + assert(mainL[0]/mic[0]>mainL[1]/mic[1] && + mainL[1]/mic[1]>mainL[2]/mic[2]); + assert(mainR[0]/mic[0]>mainR[1]/mic[1] && + mainR[1]/mic[1]>mainR[2]/mic[2]); assert(near(mainL[3],0.f) && near(mainR[3],0.f)); mainL.fill(1.f);mainR.fill(1.f); assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); @@ -785,6 +790,64 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { decoded.channels,stereoPhysical,routed,issue)); assert(routed.effectiveFormats[2]==armix::mixer::ChannelFormat::mono); assert(routed.foldStereoToMono[2]); + + // SOURCE/VST3 lifecycle migration at production M4 graph granularity: + // both verified physical pins belong to one unchanged device epoch. + // Selecting another MONO pin must preserve the very SAME prepared + // JUCE processor (state/editor/tail identity), not silently rebuild it. + juce::var beforeSwap; + assert(NativeVerifiedSourcePatch::prepare( + typed,6,"MONO",5,-1,stereoPhysical,17,9,beforeSwap).isEmpty()); + armix::mixer::NativeDryRouteCommand oldCommand; + assert(armix::mixer::NativeDryRouteCommand::decode( + beforeSwap,oldCommand,error)); + armix::mixer::PreparedRenderGraph oldPlan; + assert(armix::mixer::PreparedRenderGraph::compile( + oldCommand.channels,stereoPhysical,oldCommand.sends,oldPlan, + renderError,oldCommand.aux)); + auto firstFxGraph=std::make_unique( + oldPlan,64,64); + auto nativeFx=std::make_unique(2.f); + nativeFx->prepareToPlay(48000,64); + assert(firstFxGraph->install(6,std::move(nativeFx), + "CH07 native vendor FX","ch07-stable-vendor-id")); + const auto* originalInstance=firstFxGraph->instanceProcessor(6); + assert(originalInstance!=nullptr); + const std::array secondPin{{.1f,.2f,.3f,.4f}}; + const float* twoNativeInputs[]{mic.data(),secondPin.data()}; + std::array oldMainL{},oldMainR{}; + const auto beforeOldRender=heapCalls.load(std::memory_order_relaxed); + assert(firstFxGraph->process(twoNativeInputs,2,oldMainL.data(), + oldMainR.data(),4)); + assert(heapCalls.load(std::memory_order_relaxed)==beforeOldRender); + assert(oldMainL[0]>0.f && oldMainR[0]>0.f); + juce::var afterSwap; + assert(NativeVerifiedSourcePatch::prepare( + beforeSwap,6,"MONO",7,-1,stereoPhysical,17,10,afterSwap).isEmpty()); + armix::mixer::NativeDryRouteCommand switchedCommand; + assert(armix::mixer::NativeDryRouteCommand::decode( + afterSwap,switchedCommand,error)); + armix::mixer::PreparedRenderGraph switchedPlan; + assert(armix::mixer::PreparedRenderGraph::compile( + switchedCommand.channels,stereoPhysical,switchedCommand.sends, + switchedPlan,renderError,switchedCommand.aux)); + auto secondFxGraph=std::make_unique( + switchedPlan,64,64); + assert(secondFxGraph->reuseAt(6,0,*firstFxGraph,0,"ch07-stable-vendor-id")); + assert(secondFxGraph->instanceProcessor(6)==originalInstance); + firstFxGraph.reset(); // old control graph retired; vendor must stay alive + assert(secondFxGraph->instanceProcessor(6)==originalInstance); + std::array newMainL{},newMainR{}; + const auto beforeNewRender=heapCalls.load(std::memory_order_relaxed); + assert(secondFxGraph->process(twoNativeInputs,2,newMainL.data(), + newMainR.data(),4)); + assert(heapCalls.load(std::memory_order_relaxed)==beforeNewRender); + assert(newMainL[0]>0.f && newMainR[0]>0.f); + // Exactly one FX call and one real new source: 0.1 / 0.25 amplitude. + assert(near(newMainL[0]/oldMainL[0],.4f)); + assert(near(newMainR[0]/oldMainR[0],.4f)); + assert(typedSource.getArray()->getReference(6) + .getProperty("mode","").toString()=="NONE"); } // V8 S0: a C++ fixture, built with the SAME header serializer installed in From 157bf6950b6cf3943b60ea45daf6e142a9f14cb7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 14:53:42 +0700 Subject: [PATCH 035/155] fix(engine/RT): preserve 64-sample channel MUTE/PRE-send envelope across variable JUCE callback sizes; source/VST identity PCM regression --- engine/core/PreparedMixerBlock.h | 26 +++++++++++++++++++++----- tests/live_channel_fx_graph_test.cpp | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 7d58a411f..038803ecb 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -411,18 +411,32 @@ class PreparedMixerBlock final { const float targetGate=routeAudible?1.f:0.f; if(!rampPrimed_[strip]) { preGate_[strip]=targetGate; + preGateTarget_[strip]=targetGate; + preRampRemaining_[strip]=0; lastGainL_[strip]=gl; lastGainR_[strip]=gr; rampPrimed_[strip]=true; } - const int ramp=std::min(frames,64); - const float dGate=(targetGate-preGate_[strip])/ramp; + // The MUTE/PRE-SEND de-click is 64 AUDIO SAMPLES, not one + // callback: variable 4/16/32-frame JUCE quanta must not turn + // a musical 64-frame transition into a hard-edge pop. + // The target can reverse mid-ramp; continue from the current + // coefficient and restart a full 64-sample envelope. + if(targetGate!=preGateTarget_[strip]) { + preGateTarget_[strip]=targetGate; + preRampRemaining_[strip]=64; + } float gate=preGate_[strip]; + int remaining=preRampRemaining_[strip]; for(int f=0;f0) { + gate+=(targetGate-gate)/static_cast(remaining); + --remaining; + } else gate=targetGate; l[f]*=gate;r[f]*=gate; } - preGate_[strip]=targetGate; + preGate_[strip]=gate; + preRampRemaining_[strip]=remaining; } graph.sends.dispatch(strip,SendTap::preFader,l,r, left_.data(),right_.data(),frames); @@ -577,7 +591,9 @@ class PreparedMixerBlock final { std::array left_{}; std::array right_{}; std::array auxLeft_{},auxRight_{}; - std::array preGate_{},lastGainL_{},lastGainR_{}; + std::array preGate_{},preGateTarget_{}, + lastGainL_{},lastGainR_{}; + std::array preRampRemaining_{}; std::array,stripCount> physicalTarget_{}; std::array physicalBlend_{}; std::array,maxAuxSends> auxTarget_{}; diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index cd8eca838..b231237bb 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -761,6 +761,18 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { mainL[1]/mic[1]>mainL[2]/mic[2]); assert(mainR[0]/mic[0]>mainR[1]/mic[1] && mainR[1]/mic[1]>mainR[2]/mic[2]); + assert(mainL[3]>0.f && mainR[3]>0.f); // 4/64 frames, not a hard mute + // Sixteen small callback blocks complete EXACTLY the same 64-sample + // ramp as one 64-frame callback, without RT heap allocations. + float previousTail=mainL[3]/mic[3]; + for(int blockIndex=1;blockIndex<16;++blockIndex) { + const auto heapBefore=heapCalls.load(std::memory_order_relaxed); + assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); + assert(heapCalls.load(std::memory_order_relaxed)==heapBefore); + const float normalizedTail=mainL[3]/mic[3]; + assert(normalizedTail<=previousTail+1.e-5f); + previousTail=normalizedTail; + } assert(near(mainL[3],0.f) && near(mainR[3],0.f)); mainL.fill(1.f);mainR.fill(1.f); assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); @@ -769,6 +781,15 @@ static void verifyFirstSoundOnePinNativeSourceDraft() { assert(production.setStripControl(6,.25f,0.f,true,false,false)); assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); assert(mainL[0]>0.f&&mainR[0]>0.f); + assert(mainL[3]>mainL[0]); // unmute ramps, never spikes to unity + for(int k=1;k<16;++k) + assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); + assert(mainL[3]>0.f); + // A rapid re-MUTE in the middle of an unmute envelope does not + // interpolate from stale unity or introduce a discontinuity. + assert(production.setStripControl(6,.25f,0.f,true,true,false)); + assert(production.process(nativePins,1,mainL.data(),mainR.data(),4,&levels)); + assert(mainL[0]>0.f); juce::var denied; assert(NativeVerifiedSourcePatch::prepare(typed,6,"STEREO",5,5, physical,17,9,denied).isNotEmpty()); From 9fbff70ec7c1a67e3bd572917cfc7695d830a7f6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 15:05:39 +0700 Subject: [PATCH 036/155] feat(engine S1): route native ConsoleIntent SOURCE/fader/pan/mute/solo to installed JUCE M4 audio callback with exact epoch/revision ACK, preserve FX and fail closed universal --- src/ConsoleLiveBridgeV6.h | 130 ++++++++++++++++++++++++++++++++++++++ src/Main.cpp | 16 +++-- 2 files changed, 139 insertions(+), 7 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index c412200fc..0e38add0c 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include #include @@ -35,6 +37,11 @@ class LiveConsoleBridgeV6 final { w.epoch=actualEpoch.toStdString(); w.legacyRoutingRevision=decimalFromNative( route.getProperty("revision",juce::var())).toStdString(); + // This is the actual accepted fixed-M4 production revision, NOT + // fabricated universal ChannelIds or an offline graph revision. + // It fences the existing installed callback's SOURCE/RT controls. + if(static_cast(route.getProperty("ready",false))) + w.graphRevision=w.legacyRoutingRevision; w.legacyActive=static_cast(route.getProperty("active",false)); w.legacyRouteAccepted=static_cast(route.getProperty("ready",false)) && static_cast(route.getProperty("hasAcceptedRoute",false)); @@ -161,6 +168,129 @@ class LiveConsoleBridgeV6 final { return juce::JSON::parse(juce::String::fromUTF8(bytes.c_str())); } + + // S1 production bridge: operate the ACTUALLY INSTALLED M4 graph through + // LiveAudioEngine. A Legacy M4 lane is addressed by decimal "1".."10" + // only for this explicit internal migration transport. This does NOT + // claim that callbackOwnsChannelIds, CH11, GROUP or FX_RETURN exist. + // The same native audio owner, plugin editor and Show remain installed. + template + juce::var processProductionIntent(const juce::var& intent, + const juce::var& acceptedSnapshot, + Engine& engine) { + const auto request=intent.getProperty("requestId",{}); + const auto requestId=request.isString()?request.toString():juce::String{}; + const auto bytes=requestId.toStdString(); + const auto device=acceptedSnapshot.getProperty("device",{}); + const auto graph=acceptedSnapshot.getProperty("graph",{}); + const auto epoch=device.getProperty("epoch","0").toString(); + const auto oldRev=graph.getProperty("revision","0").toString(); + const auto oldRoster=graph.getProperty("rosterRevision","0").toString(); + juce::String error; + bool accepted=false; + if(!armix::integration::validConsoleRequestId(bytes))error="INVALID_REQUEST_ID"; + else if(completed_.find(bytes)!=completed_.end())error="DUPLICATE_REQUEST_ID"; + else { + if(recentIds_.size()==maxRecentIds) { + completed_.erase(recentIds_.front()); + recentIds_.pop_front(); + } + recentIds_.push_back(bytes); + completed_.insert(bytes); + std::uint64_t ep=0,rev=0,roster=0,channelId=0; + const auto target=intent.getProperty("targetChannelId",{}); + const auto payload=intent.getProperty("payload",{}); + const auto operation=intent.getProperty("operation",{}).toString(); + if(!decodeDecimal(intent.getProperty("deviceEpoch",{}),ep) || + !decodeDecimal(intent.getProperty("baseGraphRevision",{}),rev) || + !decodeDecimal(intent.getProperty("baseRosterRevision",{}),roster)) + error="INVALID_DECIMAL_WIRE"; + else if(intent.getProperty("deviceEpoch",{}).toString()!=epoch) + error="STALE_DEVICE_EPOCH"; + else if(intent.getProperty("baseGraphRevision",{}).toString()!=oldRev || + intent.getProperty("baseRosterRevision",{}).toString()!=oldRoster) + error="STALE_GRAPH_REVISION"; + else if(!target.isString() || !decodeDecimal(target,channelId) || + channelId<1 || channelId>10) + error="INVALID_LEGACY_CHANNEL_ID"; + else if(!engine.dryRoutingLabActive() || + engine.dryRoutingLabEpoch()!=ep || + engine.dryRoutingLabRevision()!=rev) + error="PRODUCTION_GRAPH_NOT_ADMITTED"; + else if(!payload.isObject())error="INVALID_PAYLOAD"; + else { + const int lane=static_cast(channelId-1); + if(operation=="SET_SOURCE") { + const auto id=payload.getProperty("portId",{}).toString(); + int left=-1; + if(parsePortId(id,"in:",left)) { + const auto rightId=payload.getProperty("rightPortId",{}).toString(); + int right=-1; + const auto format=payload.getProperty("sourceFormat","MONO").toString(); + if(format=="STEREO" && !parsePortId(rightId,"in:",right)) + error="INVALID_STEREO_RIGHT_PIN"; + else if(format!="MONO"&&format!="STEREO") + error="INVALID_SOURCE_FORMAT"; + else error=engine.switchDryRoutingLabSource( + lane,ep,rev,format,left,right); + } else error="INVALID_PHYSICAL_INPUT_PORT"; + accepted=error.isEmpty(); + } else if(operation=="SET_FADER"||operation=="SET_PAN"|| + operation=="SET_MUTE"||operation=="SET_SOLO") { + const bool binary=operation=="SET_MUTE"||operation=="SET_SOLO"; + const auto value=payload.getProperty(binary?"value":"valueDb",{}); + juce::String key; + float control=0.f; + if(binary) { + const auto b=payload.getProperty("value",{}); + const auto on=payload.getProperty("enabled",b); + if(!on.isBool())error="INVALID_BOOLEAN_CONTROL"; + else control=static_cast(on)?1.f:0.f; + } else { + const auto number=payload.getProperty( + operation=="SET_FADER"?"valueDb":"value",{}); + if(!number.isInt()&&!number.isDouble()) + error="INVALID_NUMERIC_CONTROL"; + else { + const double v=static_cast(number); + if(!std::isfinite(v))error="NON_FINITE_CONTROL"; + else control=static_cast(v); + } + } + if(error.isEmpty()) { + if(operation=="SET_FADER")key="faderDb"; + else if(operation=="SET_PAN")key="pan"; + else if(operation=="SET_MUTE")key="mute"; + else key="solo"; + accepted=engine.setDryRoutingLabParameter( + lane,ep,rev,key,control); + if(!accepted)error="NATIVE_CONTROL_REJECTED"; + } + } else error="UNSUPPORTED_UNIVERSAL_OPERATION"; + } + } + const auto after=armix::console::LiveConsoleBridgeV6::snapshot(engine.status()); + const auto afterGraph=after.getProperty("graph",{}); + PuzzleV8Ack ack; + ack.requestId=bytes; + ack.status=accepted?"ACCEPTED":"REJECTED"; + ack.deviceEpoch=after.getProperty("device",{}).getProperty("epoch",epoch).toString().toStdString(); + ack.graphRevision=afterGraph.getProperty("revision",oldRev).toString().toStdString(); + ack.rosterRevision=afterGraph.getProperty("rosterRevision",oldRoster).toString().toStdString(); + ack.errorCode=error.toStdString(); + const auto json=PuzzleV8Wire::ack(ack); + return juce::JSON::parse(juce::String::fromUTF8(json.c_str())); + } + + static bool parsePortId(const juce::String& wire,const char* prefix,int& physical) { + if(!wire.startsWith(prefix))return false; + const auto text=wire.substring(static_cast(std::char_traits::length(prefix))); + std::uint64_t value=0; + if(!decodeDecimal(juce::var(text),value)||value>255)return false; + physical=static_cast(value); + return true; + } + static bool decodeDecimal(const juce::var& raw,std::uint64_t& result) noexcept { if(!raw.isString())return false; const auto str=raw.toString(); diff --git a/src/Main.cpp b/src/Main.cpp index 8bf88f3d4..0f0b906f4 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -228,15 +228,17 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if (browser_.loaded) emitNativeConsoleSnapshot(engine_.status()); }) .withEventListener ("arMixConsoleIntent", [this] (juce::var args) { - // No native v6 mutation can be accepted while the installed - // audio callback still owns fixed M4 lanes. Rejection - // retains the existing VST3/Orbit/Show/MAIN output. - auto status=engine_.status(); - const auto snap=armix::console::LiveConsoleBridgeV6::snapshot(status); - const auto ack=consoleBridge_.rejectUnsupportedIntent(args,snap); + // S1: actual installed JUCE production path, never a + // dry-only C++ model or WebAudio replica. Only admitted + // fixed-M4 SOURCE and RT controls can mutate sound; CH11, + // GROUP/FX_RETURN remain rejected until one ChannelId + // callback really owns them. + const auto snapshot=armix::console::LiveConsoleBridgeV6::snapshot(engine_.status()); + const auto ack=consoleBridge_.processProductionIntent( + args,snapshot,engine_); if (browser_.loaded) { browser_.emitEventIfBrowserIsVisible("arMixConsoleAck",ack); - emitNativeConsoleSnapshot(status); + emitNativeConsoleSnapshot(engine_.status()); } }) .withResourceProvider (assetFor)) From 034826972dae9c7055d3bf135c1fd3372fb862fa Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 15:12:04 +0700 Subject: [PATCH 037/155] feat(engine S1): native live accepted fader/mute/solo/pan readback for real installed channels, Console ACK/PCM truth; preserve canonical S0 fixture on Windows --- src/ConsoleLiveBridgeV6.h | 12 +++++++++++- src/LiveDryRoutingLab.h | 22 +++++++++++++++++++++- tests/live_channel_fx_graph_test.cpp | 9 ++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 0e38add0c..6ca392b28 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -105,7 +105,17 @@ class LiveConsoleBridgeV6 final { // universal CREATE/GROUP/INSERT until one ChannelId callback owns it. w.productionCallbackLive=false; const auto bytes=PuzzleV8Wire::snapshot(w); - return juce::JSON::parse(juce::String::fromUTF8(bytes.c_str())); + auto actual=juce::JSON::parse(juce::String::fromUTF8(bytes.c_str())); + // Optional diagnosed M4 accepted controls are sourced from the + // installed JUCE control thread, not stale immutable routing faders. + // UNREADY fixture stays byte-identical; these are NOT ChannelIds. + const auto controls=route.getProperty("liveChannelControls",juce::var()); + if(controls.isArray()) { + const auto legacy=actual.getProperty("legacyM4",{}); + if(auto* object=legacy.getDynamicObject()) + object->setProperty("liveChannelControls",controls); + } + return actual; } // Exact native wire: opaque, unique-per-editor requestId and uint64 diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 464daa857..bc7bdd8b8 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1019,7 +1019,27 @@ class LiveDryRoutingLab final { out->setProperty("auxPeaks",juce::var(auxPeaks)); out->setProperty("fxReused",fxReused_.load(std::memory_order_relaxed)); // Only the message thread calls status(), never the audio callback. - if(active() && ready())out->setProperty("acceptedRoute",acceptedRoute_); + // Atomic fader/PAN/MUTE/SOLO changes do NOT recompile the immutable + // route; do not expose its original fader values as the CURRENT + // accepted sound. Report the RT control target for every real strip. + // This is M4 diagnostic data, NOT a fabricated ChannelId roster. + if(active() && ready()) { + out->setProperty("acceptedRoute",acceptedRoute_); + juce::Array liveControls; + for(int i=0;i(); + const auto& c=channelEdits_[i]; // single JUCE control thread + lane->setProperty("slot",i); + lane->setProperty("gainLinear",static_cast(c.linear)); + lane->setProperty("faderDb",c.linear>0.f + ?20.*std::log10(static_cast(c.linear)):-60.); + lane->setProperty("pan",static_cast(c.pan)*100.); + lane->setProperty("mute",c.mute); + lane->setProperty("solo",c.solo); + liveControls.add(juce::var(lane.release())); + } + out->setProperty("liveChannelControls",juce::var(liveControls)); + } juce::Array liveFxInstances; const auto* prepared=hasExplicitRoute() ?publisher_.controlPrepared(epoch(),revision()):nullptr; diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index b231237bb..821e4ed37 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -888,7 +888,14 @@ static void verifyNativePuzzleV8FixtureAndWire() { assert(source.is_open()); const std::string checked((std::istreambuf_iterator(source)), std::istreambuf_iterator()); - assert(expected==checked); + // Git on Windows can checkout a one-line JSON fixture with CRLF. + // The native stdout generator deliberately emits canonical LF; accept + // only the OS newline conversion, never changed JSON data. + std::string canonical=checked; + if(canonical.size()==expected.size()+1 && + canonical.size()>=2 && canonical.substr(canonical.size()-2)=="\r\n") + canonical.erase(canonical.size()-2,1); + assert(expected==canonical); const auto parsed=juce::JSON::parse(juce::String::fromUTF8(expected.c_str())); assert(parsed.isObject()); const auto events=parsed.getProperty("events",{}); From 4cec990baf8ffe554ad5163153cdd77b100f2d3d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 15:15:13 +0700 Subject: [PATCH 038/155] feat(engine S1): real native ConsoleIntent VST3 bypass and vendor editor through accepted FX instance lease; no plugin cloning or callback restart --- src/ConsoleLiveBridgeV6.h | 38 ++++++++++++++++++++++++++++++++++++-- src/Main.cpp | 26 +++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 6ca392b28..934d1d102 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -184,10 +184,10 @@ class LiveConsoleBridgeV6 final { // only for this explicit internal migration transport. This does NOT // claim that callbackOwnsChannelIds, CH11, GROUP or FX_RETURN exist. // The same native audio owner, plugin editor and Show remain installed. - template + template juce::var processProductionIntent(const juce::var& intent, const juce::var& acceptedSnapshot, - Engine& engine) { + Engine& engine,OpenEditor&& openEditor) { const auto request=intent.getProperty("requestId",{}); const auto requestId=request.isString()?request.toString():juce::String{}; const auto bytes=requestId.toStdString(); @@ -276,6 +276,40 @@ class LiveConsoleBridgeV6 final { lane,ep,rev,key,control); if(!accepted)error="NATIVE_CONTROL_REJECTED"; } + } else if(operation=="SET_INSERT_BYPASS"|| + operation=="OPEN_INSERT_EDITOR") { + // The token must match an actually prepared vendor + // AudioPluginInstance in the current accepted M4 graph. + // Never invent a GUI insert, instantiate, clone or scan + // VST3 while changing BYPASS / opening an editor. + const auto token=payload.getProperty("insertId","").toString(); + const auto statuses=engine.status().getProperty("dryRoutingLab",{}); + const auto fx=statuses.getProperty("fxInstances",{}); + const auto* lanes=fx.getArray(); + int foundSlot=-1; + if(token.isNotEmpty() && lanes && lanesize()) { + const auto bank=lanes->getReference(lane); + if(const auto* slots=bank.getArray()) + for(int k=0;ksize();++k) + if(slots->getReference(k).getProperty("instanceId","") + .toString()==token) { + if(foundSlot>=0){foundSlot=-1;break;} + foundSlot=k; + } + } + if(foundSlot<0)error="UNKNOWN_NATIVE_INSERT_INSTANCE"; + else if(operation=="SET_INSERT_BYPASS") { + const auto value=payload.getProperty("bypassed",{}); + if(!value.isBool())error="INVALID_BYPASS_VALUE"; + else { + accepted=engine.setDryRoutingLabFxBypass( + lane,foundSlot,ep,rev,token,static_cast(value)); + if(!accepted)error="NATIVE_INSERT_BYPASS_REJECTED"; + } + } else { + error=openEditor(lane,foundSlot,ep,rev,token); + accepted=error.isEmpty(); + } } else error="UNSUPPORTED_UNIVERSAL_OPERATION"; } } diff --git a/src/Main.cpp b/src/Main.cpp index 0f0b906f4..6aca710eb 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -235,7 +235,31 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr // callback really owns them. const auto snapshot=armix::console::LiveConsoleBridgeV6::snapshot(engine_.status()); const auto ack=consoleBridge_.processProductionIntent( - args,snapshot,engine_); + args,snapshot,engine_, + [this](int lane,int slot,std::uint64_t epoch, + std::uint64_t revision,const juce::String& token) + ->juce::String { + if(nativeShowBusy_||studioBackupBusy_|| + engine_.isGraphSwitchPending()) + return "NATIVE_EDITOR_BUSY"; + const auto owner=engine_.leaseRoutedFxForEditor( + lane,slot,epoch,revision,token); + if(!owner || !owner->processor) + return "NATIVE_EDITOR_STALE_INSTANCE"; + try { + auto* editor=owner->processor->createEditorIfNeeded(); + if(!editor)return "NATIVE_PLUGIN_HAS_NO_EDITOR"; + closePluginEditor(); + routedEditorOwner_=owner; // original JUCE instance + routedEditorEpoch_=static_cast(epoch); + editorWindow_=std::make_unique( + owner->processor->getName(),editor); + return {}; + } catch(...) { + closePluginEditor(); + return "NATIVE_VENDOR_EDITOR_FAILED"; + } + }); if (browser_.loaded) { browser_.emitEventIfBrowserIsVisible("arMixConsoleAck",ack); emitNativeConsoleSnapshot(engine_.status()); From f8af3663ef9b45bc07f091b5ba71cbc7820e12a3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 15:40:55 +0700 Subject: [PATCH 039/155] feat(engine): one-click native per-channel MAIN/NONE and mono/stereo topology changes with VST lease reuse; separate M4/universal revisions and expose real M4 PCM meters --- src/ConsoleLiveBridgeV6.h | 58 +++++++++++----- src/LiveAudioEngine.h | 25 +++++++ src/LiveDryRoutingLab.h | 99 ++++++++++++++++++---------- tests/live_channel_fx_graph_test.cpp | 3 + 4 files changed, 136 insertions(+), 49 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 934d1d102..4639254ec 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -37,11 +37,8 @@ class LiveConsoleBridgeV6 final { w.epoch=actualEpoch.toStdString(); w.legacyRoutingRevision=decimalFromNative( route.getProperty("revision",juce::var())).toStdString(); - // This is the actual accepted fixed-M4 production revision, NOT - // fabricated universal ChannelIds or an offline graph revision. - // It fences the existing installed callback's SOURCE/RT controls. - if(static_cast(route.getProperty("ready",false))) - w.graphRevision=w.legacyRoutingRevision; + // The accepted fixed-M4 revision stays under legacyM4 only. + // A ChannelId revision is never copied from an ordinal M4 graph. w.legacyActive=static_cast(route.getProperty("active",false)); w.legacyRouteAccepted=static_cast(route.getProperty("ready",false)) && static_cast(route.getProperty("hasAcceptedRoute",false)); @@ -109,11 +106,22 @@ class LiveConsoleBridgeV6 final { // Optional diagnosed M4 accepted controls are sourced from the // installed JUCE control thread, not stale immutable routing faders. // UNREADY fixture stays byte-identical; these are NOT ChannelIds. - const auto controls=route.getProperty("liveChannelControls",juce::var()); - if(controls.isArray()) { - const auto legacy=actual.getProperty("legacyM4",{}); - if(auto* object=legacy.getDynamicObject()) - object->setProperty("liveChannelControls",controls); + const auto legacy=actual.getProperty("legacyM4",{}); + if(auto* object=legacy.getDynamicObject()) { + // Current native M4 (not a fake ChannelId roster): exactly the + // signal that is audible in this physical device callback. + const auto controls=route.getProperty("channelControls",juce::var()); + const auto peaksL=route.getProperty("channelPeaksL",juce::var()); + const auto peaksR=route.getProperty("channelPeaksR",juce::var()); + const auto inserts=route.getProperty("fxInstances",juce::var()); + if(controls.isArray())object->setProperty("channelControls",controls); + if(peaksL.isArray())object->setProperty("channelPeaksL",peaksL); + if(peaksR.isArray())object->setProperty("channelPeaksR",peaksR); + if(inserts.isArray())object->setProperty("fxInstances",inserts); + const auto main=route.getProperty("mainOutputs",juce::var()); + if(main.isArray())object->setProperty("mainOutputs",main); + const auto monitor=route.getProperty("monitorOutputs",juce::var()); + if(monitor.isArray())object->setProperty("monitorOutputs",monitor); } return actual; } @@ -196,6 +204,8 @@ class LiveConsoleBridgeV6 final { const auto epoch=device.getProperty("epoch","0").toString(); const auto oldRev=graph.getProperty("revision","0").toString(); const auto oldRoster=graph.getProperty("rosterRevision","0").toString(); + const auto legacyRev=acceptedSnapshot.getProperty("legacyM4",{}) + .getProperty("routingRevision","0").toString(); juce::String error; bool accepted=false; if(!armix::integration::validConsoleRequestId(bytes))error="INVALID_REQUEST_ID"; @@ -207,7 +217,7 @@ class LiveConsoleBridgeV6 final { } recentIds_.push_back(bytes); completed_.insert(bytes); - std::uint64_t ep=0,rev=0,roster=0,channelId=0; + std::uint64_t ep=0,rev=0,roster=0,channelId=0,m4Revision=0; const auto target=intent.getProperty("targetChannelId",{}); const auto payload=intent.getProperty("payload",{}); const auto operation=intent.getProperty("operation",{}).toString(); @@ -220,12 +230,20 @@ class LiveConsoleBridgeV6 final { else if(intent.getProperty("baseGraphRevision",{}).toString()!=oldRev || intent.getProperty("baseRosterRevision",{}).toString()!=oldRoster) error="STALE_GRAPH_REVISION"; + // M4's presentation ordinals are NOT universal ChannelIds. + // A legacy-console intent requires an explicit independent + // revision fence. Without it, reject rather than silently + // alias the ChannelId graph's revision 0 to an M4 revision. + else if(!decodeDecimal(intent.getProperty("legacyRoutingRevision",{}), + m4Revision) || + intent.getProperty("legacyRoutingRevision","").toString()!=legacyRev) + error="STALE_LEGACY_ROUTING_REVISION"; else if(!target.isString() || !decodeDecimal(target,channelId) || channelId<1 || channelId>10) error="INVALID_LEGACY_CHANNEL_ID"; else if(!engine.dryRoutingLabActive() || engine.dryRoutingLabEpoch()!=ep || - engine.dryRoutingLabRevision()!=rev) + engine.dryRoutingLabRevision()!=m4Revision) error="PRODUCTION_GRAPH_NOT_ADMITTED"; else if(!payload.isObject())error="INVALID_PAYLOAD"; else { @@ -242,7 +260,7 @@ class LiveConsoleBridgeV6 final { else if(format!="MONO"&&format!="STEREO") error="INVALID_SOURCE_FORMAT"; else error=engine.switchDryRoutingLabSource( - lane,ep,rev,format,left,right); + lane,ep,m4Revision,format,left,right); } else error="INVALID_PHYSICAL_INPUT_PORT"; accepted=error.isEmpty(); } else if(operation=="SET_FADER"||operation=="SET_PAN"|| @@ -273,9 +291,17 @@ class LiveConsoleBridgeV6 final { else if(operation=="SET_MUTE")key="mute"; else key="solo"; accepted=engine.setDryRoutingLabParameter( - lane,ep,rev,key,control); + lane,ep,m4Revision,key,control); if(!accepted)error="NATIVE_CONTROL_REJECTED"; } + } else if(operation=="SET_PROCESSING_FORMAT"|| + operation=="SET_PRIMARY_OUT") { + const auto nativeValue=payload.getProperty( + operation=="SET_PRIMARY_OUT"?"destinationId":"format",{}) + .toString(); + error=engine.repatchDryRoutingLabChannel( + lane,ep,m4Revision,operation,nativeValue); + accepted=error.isEmpty(); } else if(operation=="SET_INSERT_BYPASS"|| operation=="OPEN_INSERT_EDITOR") { // The token must match an actually prepared vendor @@ -303,11 +329,11 @@ class LiveConsoleBridgeV6 final { if(!value.isBool())error="INVALID_BYPASS_VALUE"; else { accepted=engine.setDryRoutingLabFxBypass( - lane,foundSlot,ep,rev,token,static_cast(value)); + lane,foundSlot,ep,m4Revision,token,static_cast(value)); if(!accepted)error="NATIVE_INSERT_BYPASS_REJECTED"; } } else { - error=openEditor(lane,foundSlot,ep,rev,token); + error=openEditor(lane,foundSlot,ep,m4Revision,token); accepted=error.isEmpty(); } } else error="UNSUPPORTED_UNIVERSAL_OPERATION"; diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 178c8eb7e..85a42c5f9 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1082,6 +1082,31 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback return "SOURCE: native prepare failed; prior audio kept"; } } + // Direct compact OUT / MONO-STEREO operator edits. One existing M4 + // prepared graph is republished; original VST3 instances/Orbit remain + // owned by the same native callback. Never touched on RT. + juce::String repatchDryRoutingLabChannel(int strip,std::uint64_t epoch, + std::uint64_t revision,const juce::String& operation, + const juce::String& value) { + if(independent_.active()|| + routeReconfiguring_.load(std::memory_order_acquire)|| + handoff_.busy()||!directFence_.permitted()|| + diagnosticRoute_.load(std::memory_order_acquire) + !=armix::diagnostics::Route::normal|| + savedDirectSetup_||savedLiveSetup_) + return "CHANNEL PATCH: DIRECT device or VST3 handoff unavailable"; + auto* device=deviceManager_.getCurrentAudioDevice(); + if(!device)return "CHANNEL PATCH: no active native audio interface"; + try { + return dryRoutingLab_.repatchChannelStructure( + strip,epoch,revision,operation,value, + directFence_.permitted(),independent_.active(), + graphOwned_->count,formats_,device->getCurrentSampleRate(), + juce::jmax(32,device->getCurrentBufferSizeSamples())); + } catch(...) { + return "CHANNEL PATCH: native preparation failed; previous mix preserved"; + } + } bool setDryRoutingLabParameter(int strip,std::uint64_t epoch, std::uint64_t revision,const juce::String& parameter, float value) noexcept { diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index bc7bdd8b8..f5bee2c9f 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -532,28 +532,79 @@ class LiveDryRoutingLab final { {pins.data(),static_cast(available)}, expectedEpoch,expectedRevision,staged); if(error.isNotEmpty())return error; - // Preserve every currently ACKed fader, pan, MUTE and SOLO. The - // template may predate atomic live controls; reusing it verbatim - // would silently reset a musician's mix after a SOURCE selection. + return publishRevisedTopology(staged,expectedEpoch,expectedRevision, + directPermitted,independentClock,occupiedCh1Fx,formats, + sampleRate,deviceFrames); + } + + // One-click channel OUT and format: the existing native M4 routing/FX + // graph is the sole PCM owner. Prepare OUT/format on the JUCE control + // thread, then publish with exactly the same epoch/VST3 lease/Show + // rollback transaction as SOURCE. No device restart or UI-side routing. + juce::String repatchChannelStructure(int strip, + std::uint64_t expectedEpoch,std::uint64_t expectedRevision, + const juce::String& operation,const juce::String& requested, + bool directPermitted,bool independentClock,int occupiedCh1Fx, + juce::AudioPluginFormatManager& formats,double sampleRate, + int deviceFrames) { + if(!ready()||!registryValid_.load(std::memory_order_acquire)|| + topologyFault_.load(std::memory_order_acquire)|| + epoch()!=expectedEpoch||revision()!=expectedRevision|| + !sourceTemplate_.isObject()) + return "CHANNEL PATCH: native device or graph is stale"; + if(strip<0||strip>=count) + return "CHANNEL PATCH: invalid native channel"; + // This preserves all source pins, AUX taps, master and monitor + // destinations, original VST3 vendor state and all other channels. + auto staged=juce::JSON::parse(juce::JSON::toString(sourceTemplate_,false)); + if(!staged.isObject())return "CHANNEL PATCH: cannot clone accepted graph"; + auto rows=staged.getProperty("channels",juce::var()); + auto* list=rows.getArray(); + if(!list||list->size()!=count|| + !list->getReference(strip).isObject()) + return "CHANNEL PATCH: no accepted channel row"; + auto* row=list->getReference(strip).getDynamicObject(); + if(operation=="SET_PRIMARY_OUT") { + if(requested!="MAIN"&&requested!="NONE") + return "CHANNEL PATCH: only MAIN and NONE are installed M4 outputs"; + row->setProperty("main",requested=="MAIN"); + } else if(operation=="SET_PROCESSING_FORMAT") { + if(requested!="MONO"&&requested!="STEREO") + return "CHANNEL PATCH: processing format must be MONO or STEREO"; + const auto schema=staged.getProperty("schemaVersion",juce::var()); + if(!schema.isInt() || static_cast(schema)!=2) + return "CHANNEL PATCH: typed processing format requires native schema v2"; + row->setProperty("channelFormat",requested); + } else return "CHANNEL PATCH: unsupported graph operation"; + return publishRevisedTopology(staged,expectedEpoch,expectedRevision, + directPermitted,independentClock,occupiedCh1Fx,formats, + sampleRate,deviceFrames); + } + + // Both SOURCE and channel structure edits share one graph compiler, + // VST3 lease policy and rollback path. Keep fast faders/pan/mute/solo + // on their separate atomic parameter path without any compilation. + juce::String publishRevisedTopology(juce::var& staged, + std::uint64_t expectedEpoch,std::uint64_t expectedRevision, + bool directPermitted,bool independentClock,int occupiedCh1Fx, + juce::AudioPluginFormatManager& formats,double sampleRate, + int deviceFrames) { auto stagedRows=staged.getProperty("channels",juce::var()); auto* editable=stagedRows.getArray(); - if(!editable || editable->size()!=count) - return "SOURCE: prepared input document malformed"; + if(!editable||editable->size()!=count) + return "CHANNEL PATCH: malformed native topology"; for(int i=0;igetReference(i).getDynamicObject(); - if(!row)return "SOURCE: missing acknowledged channel control"; + if(!row)return "CHANNEL PATCH: missing native channel"; const auto& c=channelEdits_[i]; row->setProperty("gain",static_cast(c.linear)); row->setProperty("pan",static_cast(c.pan)); row->setProperty("mute",c.mute); row->setProperty("solo",c.solo); } - if(expectedEpoch!=epoch() || expectedRevision!=revision() || + if(expectedEpoch!=epoch()||expectedRevision!=revision()|| !registryValid_.load(std::memory_order_acquire)) - return "SOURCE: device changed during preparation; accepted mix preserved"; - // Same M4 publisher, same plugin lease/FX state and physical MAIN - // outputs. Existing 256-frame topology crossfade is performed by - // its ONE installed callback. Compilation/publish failures roll back. + return "CHANNEL PATCH: device changed; previous mix preserved"; return apply(staged,directPermitted,independentClock,occupiedCh1Fx, acceptedFxSelections_,formats,sampleRate,deviceFrames,true); } @@ -1018,28 +1069,10 @@ class LiveDryRoutingLab final { out->setProperty("auxFxNames",juce::var(auxNames)); out->setProperty("auxPeaks",juce::var(auxPeaks)); out->setProperty("fxReused",fxReused_.load(std::memory_order_relaxed)); - // Only the message thread calls status(), never the audio callback. - // Atomic fader/PAN/MUTE/SOLO changes do NOT recompile the immutable - // route; do not expose its original fader values as the CURRENT - // accepted sound. Report the RT control target for every real strip. - // This is M4 diagnostic data, NOT a fabricated ChannelId roster. - if(active() && ready()) { - out->setProperty("acceptedRoute",acceptedRoute_); - juce::Array liveControls; - for(int i=0;i(); - const auto& c=channelEdits_[i]; // single JUCE control thread - lane->setProperty("slot",i); - lane->setProperty("gainLinear",static_cast(c.linear)); - lane->setProperty("faderDb",c.linear>0.f - ?20.*std::log10(static_cast(c.linear)):-60.); - lane->setProperty("pan",static_cast(c.pan)*100.); - lane->setProperty("mute",c.mute); - lane->setProperty("solo",c.solo); - liveControls.add(juce::var(lane.release())); - } - out->setProperty("liveChannelControls",juce::var(liveControls)); - } + // Control-thread snapshot; the existing channelControls property + // below is the single authoritative atomic-target readback, while + // acceptedRoute remains the immutable topology of the same revision. + if(active() && ready())out->setProperty("acceptedRoute",acceptedRoute_); juce::Array liveFxInstances; const auto* prepared=hasExplicitRoute() ?publisher_.controlPrepared(epoch(),revision()):nullptr; diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 821e4ed37..00aff96d5 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -595,6 +595,9 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(static_cast(outs.getArray()->getReference(1).getProperty("port",0))==4); const auto diagnostic=snap.getProperty("legacyM4",{}); assert(diagnostic.getProperty("routingRevision","").toString()=="77"); + // Universal revisions cannot be borrowed from M4; this unready source + // must not permit GUI ChannelId operations even while M4 PCM is active. + assert(graph.getProperty("revision","").toString()=="0"); Bridge bridge; const auto intent=[&](const juce::String& req,const juce::String& ep, const juce::String& rev="0") { From ab402b8c950c28077f226195625bb4cd723f6ea5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 15:42:47 +0700 Subject: [PATCH 040/155] feat(engine): first-open silent native session is typed schema v2, enabling MONO/STEREO processing before physical SOURCE without a second APPLY --- src/LiveDryRoutingLab.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index f5bee2c9f..842def076 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -134,12 +134,19 @@ class LiveDryRoutingLab final { return "Clear the active input patch before creating an unpatched session"; if(active() && ready() && !hasExplicitRoute())return {}; auto request=std::make_unique(); + // New silent sessions use typed v2 from the first callback so the + // operator can choose MONO/STEREO processing BEFORE a physical IN. + // Old saved v1 Shows remain readable by NativeDryRouteCommand. + request->setProperty("schemaVersion",2); request->setProperty("deviceEpoch",static_cast(epoch())); request->setProperty("revision",static_cast(revision())); juce::Array channels; for(int i=0;i(); row->setProperty("mode","NONE"); + row->setProperty("sourceKind","NONE"); + row->setProperty("sourceFormat","NONE"); + row->setProperty("channelFormat","STEREO"); row->setProperty("left",-1); row->setProperty("right",-1); row->setProperty("gain",0.25); From 636489ac928093800953b1834fae57d35ed9262c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 15:43:18 +0700 Subject: [PATCH 041/155] feat(engine): expose real one-gesture native CHAN OUT/processing-format operator action with accepted PCM ACK, preserving current VST/Show --- src/Main.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Main.cpp b/src/Main.cpp index 6aca710eb..98061a813 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1408,6 +1408,38 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if(error.isNotEmpty())emitNotice(error,true); return; } + // Operator-first native CHAN OUT / DSP FORMAT. This is the same + // installed M4 callback/FX publisher as routingSourceSwitch, not a + // synthetic universal ChannelId operation. GUI owner may wire a + // compact selector without navigating the large APPLY wizard. + if(action=="routingChannelStructure") { + const int requestId=static_cast(args.getProperty("requestId",0)); + const int channel=static_cast(args.getProperty("channel",-1)); + const auto operation=args.getProperty("operation","").toString(); + const auto selected=args.getProperty("selected","").toString(); + const auto ep=args.getProperty("deviceEpoch",juce::var()); + const auto rv=args.getProperty("revision",juce::var()); + const bool safe=requestId>0&&channel>=0&&channel(static_cast(ep)), + static_cast(static_cast(rv)), + operation,selected): + juce::String("CHANNEL PATCH: stale device or Show/FX edit busy"); + auto ack=std::make_unique(); + ack->setProperty("requestId",requestId); + ack->setProperty("channel",channel); + ack->setProperty("operation",operation); + ack->setProperty("ok",error.isEmpty()); + ack->setProperty("error",error); + ack->setProperty("state",engine_.status().getProperty("dryRoutingLab",{})); + if(browser_.loaded)browser_.emitEventIfBrowserIsVisible( + "arMixChannelStructureAck",juce::var(ack.release())); + if(error.isNotEmpty())emitNotice(error,true); + return; + } if (action == "routingDryApply") { LiveDryRoutingLab::FxSelections selected{}; From 06957b4f9672d398341ce439b65347dd926f472b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 15:43:41 +0700 Subject: [PATCH 042/155] fix(engine): accept validated JUCE int32 or int64 epoch/revision for native one-click channel OUT control --- src/Main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Main.cpp b/src/Main.cpp index 98061a813..aa373738e 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1420,7 +1420,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr const auto ep=args.getProperty("deviceEpoch",juce::var()); const auto rv=args.getProperty("revision",juce::var()); const bool safe=requestId>0&&channel>=0&&channel Date: Sun, 1 Nov 2026 16:25:47 +0700 Subject: [PATCH 043/155] feat(engine): realtime PRE/POST AUX FX-return send levels with sample-accurate 64-sample ramp across variable callbacks, native ConsoleIntent/ACK; preserve vendor leases --- engine/core/LiveChannelFxGraph.h | 6 +++-- engine/core/PreparedMixerBlock.h | 41 +++++++++++++++++++++----------- src/ConsoleLiveBridgeV6.h | 27 +++++++++++++++++++++ src/LiveAudioEngine.h | 5 ++-- src/LiveDryRoutingLab.h | 14 +++++++---- src/Main.cpp | 17 +++++++++---- 6 files changed, 82 insertions(+), 28 deletions(-) diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index fff61df01..0243a8a4c 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -173,9 +173,11 @@ class LiveChannelFxGraph final { bool setAuxBusGain(int bus,float gain) noexcept { return block_&&block_->setAuxBusGain(bus,gain); } + bool setAuxSendGain(int source,int bus,SendTap tap,float gain) noexcept { + return block_ && block_->setAuxSendGain(source,bus,tap,gain); + } bool setAuxSendGain(int source,int bus,float gain) noexcept { - return block_ && block_->setAuxSendGain( - source,bus,SendTap::postFader,gain); + return setAuxSendGain(source,bus,SendTap::postFader,gain); } int activeInserts() const noexcept{return activeInserts_;} bool setStripControl(int channel,float gain,float pan, diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 038803ecb..0d7bbb93a 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -190,6 +190,8 @@ class PreparedMixerBlock final { const float v=plan_.aux.edges[e].initialGain; auxTarget_[e].store(v,std::memory_order_relaxed); auxApplied_[e]=v; + auxGoal_[e]=v; + auxRampRemaining_[e]=0; } for(int b=0;b=stripCount||bus<0||bus>=auxBusCount|| - tap!=SendTap::postFader||!std::isfinite(gain)||gain<0.f||gain>1.f) + (tap!=SendTap::preFader&&tap!=SendTap::postFader)|| + !std::isfinite(gain)||gain<0.f||gain>1.f) return false; for(int e=plan_.aux.offset[source];e(ramp); - float current=start; - for(int f=0;f0) { + current+=(target-current)/static_cast(remaining); + --remaining; + }else current=target; dl[f]+=l[f]*current*edge.leftPan; dr[f]+=r[f]*current*edge.rightPan; } } - auxApplied_[e]=target; + auxApplied_[e]=remaining==0?target:current; + auxRampRemaining_[e]=remaining; } } static bool validCapacity(int f) noexcept {return f>0 && f<=hardFrameLimit;} @@ -597,7 +609,8 @@ class PreparedMixerBlock final { std::array,stripCount> physicalTarget_{}; std::array physicalBlend_{}; std::array,maxAuxSends> auxTarget_{}; - std::array auxApplied_{}; // callback thread exclusive + std::array auxApplied_{},auxGoal_{}; // callback exclusive + std::array auxRampRemaining_{}; std::array,auxBusCount> auxBusTarget_{}; std::array auxBusApplied_{}; // callback thread exclusive std::array rampPrimed_{}; diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 4639254ec..e2400f5dd 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -294,6 +294,33 @@ class LiveConsoleBridgeV6 final { lane,ep,m4Revision,key,control); if(!accepted)error="NATIVE_CONTROL_REJECTED"; } + } else if(operation=="SET_SEND_LEVEL") { + // A SEND level is native realtime PCM, NOT a new graph + // edge. Existing AUX1..4 are independent FX return buses. + const auto aux=payload.getProperty("auxIndex",{}); + const auto tapName=payload.getProperty("tap","POST").toString(); + const auto raw=payload.getProperty("value",{}); + if(!aux.isInt()||static_cast(aux)<0|| + static_cast(aux)>=armix::mixer::auxBusCount) + error="INVALID_AUX_RETURN"; + else if(tapName!="PRE"&&tapName!="POST") + error="INVALID_SEND_TAP"; + else if(!raw.isInt()&&!raw.isDouble()) + error="INVALID_SEND_LEVEL"; + else { + const double value=static_cast(raw); + if(!std::isfinite(value)||value<0.||value>1.) + error="INVALID_SEND_LEVEL"; + else { + const auto tap=tapName=="PRE"? + armix::mixer::SendTap::preFader: + armix::mixer::SendTap::postFader; + accepted=engine.setDryRoutingLabAuxSendGain( + lane,static_cast(aux),ep,m4Revision, + static_cast(value),tap); + if(!accepted)error="NATIVE_SEND_NOT_ADMITTED"; + } + } } else if(operation=="SET_PROCESSING_FORMAT"|| operation=="SET_PRIMARY_OUT") { const auto nativeValue=payload.getProperty( diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 85a42c5f9..756410f08 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1122,13 +1122,14 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback return dryRoutingLab_.setAuxBusGain(bus,epoch,revision,gain); } bool setDryRoutingLabAuxSendGain(int source,int bus,std::uint64_t epoch, - std::uint64_t revision,float gain) noexcept { + std::uint64_t revision,float gain, + armix::mixer::SendTap tap=armix::mixer::SendTap::postFader) noexcept { if(independent_.active()||routeReconfiguring_.load(std::memory_order_acquire)|| diagnosticRoute_.load(std::memory_order_acquire) !=armix::diagnostics::Route::normal|| !directFence_.permitted()||savedDirectSetup_||savedLiveSetup_) return false; - return dryRoutingLab_.setAuxSendGain(source,bus,epoch,revision,gain); + return dryRoutingLab_.setAuxSendGain(source,bus,epoch,revision,gain,tap); } bool setDryRoutingLabFxBypass(int lane,int slot,std::uint64_t epoch, std::uint64_t revision,const juce::String& instanceId, diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 842def076..165b73649 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -646,12 +646,15 @@ class LiveDryRoutingLab final { return true; } - // Operator M1: one POST gain is a realtime PARAMETER, never topology. - // The accepted send identity must exist and match THIS device epoch. + // Real AUX FX RETURN: one existing PRE or POST send has an independent + // realtime level. The tap/destination/edge identity are immutable here. + // A single render of source PCM, vendor VST, and AUX return remains + // authoritative on the installed JUCE callback. // The UI may adjust it while physical output is ARMED; no new plugin, // graph, callback or device restart occurs. bool setAuxSendGain(int source,int bus,std::uint64_t expectedEpoch, - std::uint64_t expectedRevision,float gain) noexcept { + std::uint64_t expectedRevision,float gain, + armix::mixer::SendTap tap=armix::mixer::SendTap::postFader) noexcept { if(source<0||source>=count||bus<0||bus>=auxCount|| !std::isfinite(gain)||gain<0.f||gain>1.f|| !ready()||!hasExplicitRoute()|| @@ -663,14 +666,15 @@ class LiveDryRoutingLab final { for(auto& item:*list) { if(static_cast(item.getProperty("from",-1))==source && static_cast(item.getProperty("to",-1))==count+bus && - item.getProperty("tap",{}).toString()=="POST") { + item.getProperty("tap",{}).toString()== + (tap==armix::mixer::SendTap::preFader?"PRE":"POST")) { accepted=&item;break; } } if(!accepted)return false; // No implicit creation of an AUX edge. if(!publisher_.updateActiveControl(expectedEpoch,expectedRevision, [&](FxGraph& fx) noexcept { - return fx.setAuxSendGain(source,bus,gain); + return fx.setAuxSendGain(source,bus,tap,gain); }))return false; accepted->getDynamicObject()->setProperty("gain",static_cast(gain)); return true; diff --git a/src/Main.cpp b/src/Main.cpp index aa373738e..0ffd18e22 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1546,9 +1546,15 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr "arMixAuxBusGainAck",juce::var(ack.release())); return; } - // M1 operator realtime PARAM: existing AUX POST gain changes while - // audio is running. Structural sends remain guarded MUTE/APPLY. + // Existing PRE and POST sends are realtime parameters, including a + // live vocal SEND → AUX FX Return. Tap selection and NEW send edges + // remain separate structural transactions; this changes LEVEL only. if(action=="routingAuxSendGain") { + const auto tapName=args.getProperty("tap","POST").toString(); + const bool validTap=tapName=="PRE"||tapName=="POST"; + const auto tap=tapName=="PRE" + ?armix::mixer::SendTap::preFader + :armix::mixer::SendTap::postFader; const int source=static_cast(args.getProperty("from",-1)); const int bus=static_cast(args.getProperty("bus",-1)); const int requestId=static_cast(args.getProperty("requestId",0)); @@ -1557,18 +1563,19 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr const bool number=value.isDouble()||value.isInt(); const float gain=number?static_cast(static_cast(value)):-1.f; const bool ok=!nativeShowBusy_&&!studioBackupBusy_&&!ep.isVoid()&&!rv.isVoid() && - number && requestId>0 && + number && validTap && requestId>0 && engine_.setDryRoutingLabAuxSendGain(source,bus, static_cast(static_cast(ep)), - static_cast(static_cast(rv)),gain); + static_cast(static_cast(rv)),gain,tap); auto ack=std::make_unique(); ack->setProperty("ok",ok); ack->setProperty("requestId",requestId); ack->setProperty("from",source); ack->setProperty("bus",bus); + ack->setProperty("tap",tapName); ack->setProperty("gain",static_cast(gain)); ack->setProperty("error",ok?juce::String(): - "Live AUX gain rejected: route revision/device changed or POST send missing"); + "Live AUX gain rejected: stale route, invalid tap or missing PRE/POST send"); ack->setProperty("state",engine_.status().getProperty("dryRoutingLab",{})); if(browser_.loaded)browser_.emitEventIfBrowserIsVisible( "arMixAuxSendGainAck",juce::var(ack.release())); From d270514dde542689c752c8b21f82f64c0739ee1c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 16:29:49 +0700 Subject: [PATCH 044/155] feat(engine): independent realtime MONITOR send controls for 10 inputs + 4 AUX returns, smoothed 64 samples in existing JUCE callback, native ACK/readback --- engine/core/LiveChannelFxGraph.h | 18 +++++++- engine/core/PreparedMixerBlock.h | 73 ++++++++++++++++++++++++++------ src/ConsoleLiveBridgeV6.h | 18 +++++++- src/LiveAudioEngine.h | 9 ++++ src/LiveDryRoutingLab.h | 22 ++++++++++ src/Main.cpp | 27 ++++++++++++ 6 files changed, 152 insertions(+), 15 deletions(-) diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index 0243a8a4c..281b172f9 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -159,12 +159,24 @@ class LiveChannelFxGraph final { for(float v:gains)if(!std::isfinite(v)||v<0.f||v>1.f)return false; monitorLeft_=left;monitorRight_=right; monitorGains_=gains;monitorEnabled_=true; + for(int i=0;iprepareMonitorGains(gains); // unpublished graph/control only return true; } bool monitorEnabled() const noexcept{return monitorEnabled_;} int monitorOutputLeft() const noexcept{return monitorLeft_;} int monitorOutputRight() const noexcept{return monitorRight_;} const std::array& monitorGains() const noexcept{return monitorGains_;} + // Existing verified independent MONITOR source lane. Only the scalar + // changes; MAIN stays untouched, no graph rebuild or vendor lifecycle. + bool setMonitorSendGain(int lane,float gain) noexcept { + if(!monitorEnabled_||lane<0||lane>=fxSlots|| + !std::isfinite(gain)||gain<0.f||gain>1.f)return false; + monitorGainTargets_[lane].store(gain,std::memory_order_release); + monitorGains_[lane]=gain; // CONTROL-only Show/status readback + return true; + } bool switchPhysicalSource(int strip,SourceMode mode,int left,int right) noexcept { return block_&&block_->setPhysicalSource(strip,mode,left,right); } @@ -294,7 +306,8 @@ class LiveChannelFxGraph final { if(monitorEnabled_ && (!monitorL||!monitorR))return false; return block_->process(physical,inputs,left,right,frames,channelFx,levels, &controls_,monitorEnabled_?&monitorGains_:nullptr, - monitorL,monitorR); + monitorL,monitorR, + monitorEnabled_?&monitorGainTargets_:nullptr); } private: @@ -307,6 +320,7 @@ class LiveChannelFxGraph final { int mainOutputLeft_=0,mainOutputRight_=1; int monitorLeft_=-1,monitorRight_=-1; bool monitorEnabled_=false; - std::array monitorGains_{}; + std::array monitorGains_{}; // control-only accepted readback + std::array,fxSlots> monitorGainTargets_{}; // RT read }; } // namespace armix::mixer diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 0d7bbb93a..1afc4858d 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -274,6 +274,17 @@ class PreparedMixerBlock final { return -1.f; } + // CONTROL only, before publishing a MONITOR-enabled prepared graph. + // Initial send levels start at their approved values, not an audible + // ramp from zero when a device first arms its independent MONITOR bus. + void prepareMonitorGains( + const std::array& gains) noexcept { + for(int i=0;i* monitorGains=nullptr, - float* monitorL=nullptr,float* monitorR=nullptr) noexcept { + float* monitorL=nullptr,float* monitorR=nullptr, + const std::array,stripCount+auxBusCount>* + liveMonitorGains=nullptr) noexcept { static_assert(std::is_nothrow_invocable_v, "DSP hook must be noexcept and realtime bounded"); if (observed) *observed={}; @@ -447,7 +460,15 @@ class PreparedMixerBlock final { else graph.aux.dispatch(strip,SendTap::preFader,l,r, auxLeft_.data(),auxRight_.data(),frames); float peak=0.f, peakL=0.f, peakR=0.f; - const float monitorGain=monitorL?(*monitorGains)[strip]:0.f; + if(monitorBusL) { + const float next=liveMonitorGains + ?(*liveMonitorGains)[strip].load(std::memory_order_acquire) + :(*monitorGains)[strip]; + if(next!=monitorGoal_[strip]) { + monitorGoal_[strip]=next; + monitorRemaining_[strip]=64; + } + } if(live) { // A block-linear fader/PAN ramp avoids zipper clicks at the // native callback rate. UI sends at most one target per rAF. @@ -458,9 +479,10 @@ class PreparedMixerBlock final { for(int f=0;f0.f) { - monitorBusL[f]+=l[f]*monitorGain; - monitorBusR[f]+=r[f]*monitorGain; + if(monitorBusL) { + const float gain=nextMonitorGain(strip); + monitorBusL[f]+=l[f]*gain; + monitorBusR[f]+=r[f]*gain; } const float sampleL=std::abs(l[f]), sampleR=std::abs(r[f]); peakL=std::max(peakL,sampleL); @@ -474,9 +496,10 @@ class PreparedMixerBlock final { }else for(int f=0;f0.f) { - monitorBusL[f]+=l[f]*monitorGain; - monitorBusR[f]+=r[f]*monitorGain; + if(monitorBusL) { + const float gain=nextMonitorGain(strip); + monitorBusL[f]+=l[f]*gain; + monitorBusR[f]+=r[f]*gain; } const float sampleL=std::abs(l[f]), sampleR=std::abs(r[f]); peakL=std::max(peakL,sampleL); @@ -507,7 +530,16 @@ class PreparedMixerBlock final { float* const l=auxLeft_[b],* const r=auxRight_[b]; processFx(stripCount+b,l,r,frames); float peak=0.f; - const float monitorGain=monitorL?(*monitorGains)[stripCount+b]:0.f; + const int monitorLane=stripCount+b; + if(monitorBusL) { + const float next=liveMonitorGains + ?(*liveMonitorGains)[monitorLane].load(std::memory_order_acquire) + :(*monitorGains)[monitorLane]; + if(next!=monitorGoal_[monitorLane]) { + monitorGoal_[monitorLane]=next; + monitorRemaining_[monitorLane]=64; + } + } const float target=live ?auxBusTarget_[b].load(std::memory_order_acquire):bus.gain; const float start=live?auxBusApplied_[b]:bus.gain; @@ -517,9 +549,12 @@ class PreparedMixerBlock final { for(int f=0;f0.f) { - monitorBusL[f]+=vl*monitorGain; - monitorBusR[f]+=vr*monitorGain; + if(monitorBusL) { + const float gain=nextMonitorGain(monitorLane); + if(!bus.mute) { + monitorBusL[f]+=vl*gain; + monitorBusR[f]+=vr*gain; + } } peak=std::max(peak,std::max(std::abs(vl),std::abs(vr))); if(bus.toMaster && !bus.mute){ @@ -549,6 +584,18 @@ class PreparedMixerBlock final { return true; } private: + // Callback exclusive: monitor gain follows 64 sample steps regardless of + // 4/16/32/512-frame hardware buffers; no second effect render. + float nextMonitorGain(int lane) noexcept { + auto& applied=monitorApplied_[lane]; + auto& remaining=monitorRemaining_[lane]; + const float target=monitorGoal_[lane]; + if(remaining>0) { + applied+=(target-applied)/static_cast(remaining); + --remaining; + } else applied=target; + return applied; + } static constexpr std::uint32_t invalidSourcePair=0xffffffffu; static constexpr std::uint32_t packSourcePair(int left,int right) noexcept { return static_cast(left)| @@ -611,6 +658,8 @@ class PreparedMixerBlock final { std::array,maxAuxSends> auxTarget_{}; std::array auxApplied_{},auxGoal_{}; // callback exclusive std::array auxRampRemaining_{}; + std::array monitorApplied_{},monitorGoal_{}; + std::array monitorRemaining_{}; std::array,auxBusCount> auxBusTarget_{}; std::array auxBusApplied_{}; // callback thread exclusive std::array rampPrimed_{}; diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index e2400f5dd..b42b97256 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -239,7 +239,9 @@ class LiveConsoleBridgeV6 final { intent.getProperty("legacyRoutingRevision","").toString()!=legacyRev) error="STALE_LEGACY_ROUTING_REVISION"; else if(!target.isString() || !decodeDecimal(target,channelId) || - channelId<1 || channelId>10) + channelId<1 || + (channelId>10 && + !(operation=="SET_MONITOR_LEVEL"&&channelId<=14))) error="INVALID_LEGACY_CHANNEL_ID"; else if(!engine.dryRoutingLabActive() || engine.dryRoutingLabEpoch()!=ep || @@ -294,6 +296,20 @@ class LiveConsoleBridgeV6 final { lane,ep,m4Revision,key,control); if(!accepted)error="NATIVE_CONTROL_REJECTED"; } + } else if(operation=="SET_MONITOR_LEVEL") { + const auto raw=payload.getProperty("value",{}); + if(!raw.isInt()&&!raw.isDouble()) + error="INVALID_MONITOR_LEVEL"; + else { + const double gain=static_cast(raw); + if(!std::isfinite(gain)||gain<0.||gain>1.) + error="INVALID_MONITOR_LEVEL"; + else { + accepted=engine.setDryRoutingLabMonitorSendGain( + lane,ep,m4Revision,static_cast(gain)); + if(!accepted)error="MONITOR_BUS_NOT_ADMITTED"; + } + } } else if(operation=="SET_SEND_LEVEL") { // A SEND level is native realtime PCM, NOT a new graph // edge. Existing AUX1..4 are independent FX return buses. diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 756410f08..e7f377453 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1131,6 +1131,15 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback return false; return dryRoutingLab_.setAuxSendGain(source,bus,epoch,revision,gain,tap); } + bool setDryRoutingLabMonitorSendGain(int source,std::uint64_t epoch, + std::uint64_t revision,float gain) noexcept { + if(independent_.active()||routeReconfiguring_.load(std::memory_order_acquire)|| + diagnosticRoute_.load(std::memory_order_acquire) + !=armix::diagnostics::Route::normal|| + !directFence_.permitted()||savedDirectSetup_||savedLiveSetup_) + return false; + return dryRoutingLab_.setMonitorSendGain(source,epoch,revision,gain); + } bool setDryRoutingLabFxBypass(int lane,int slot,std::uint64_t epoch, std::uint64_t revision,const juce::String& instanceId, bool bypass) noexcept { diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 165b73649..868be4403 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -700,6 +700,28 @@ class LiveDryRoutingLab final { return true; } + // Independent physical MONITOR/CUE bus: control only changes one + // existing send's target. PRE/POST AUX and MAIN VST PCM remain unchanged. + // If no verified distinct MONITOR output pair exists, reject. + bool setMonitorSendGain(int source,std::uint64_t expectedEpoch, + std::uint64_t expectedRevision,float gain) noexcept { + if(source<0||source>=fxSlots||!std::isfinite(gain)|| + gain<0.f||gain>1.f||!hasExplicitRoute()|| + expectedEpoch!=epoch()||expectedRevision!=revision()) + return false; + auto gains=acceptedRoute_.getProperty("monitorSends",juce::var()); + auto* array=gains.getArray(); + const auto* current=publisher_.controlPrepared(expectedEpoch,expectedRevision); + if(!array||array->size()!=fxSlots||!current|| + !current->monitorEnabled())return false; + if(!publisher_.updateActiveControl(expectedEpoch,expectedRevision, + [&](FxGraph& fx) noexcept { + return fx.setMonitorSendGain(source,gain); + }))return false; + array->set(source,static_cast(gain)); // same accepted topology + return true; + } + // M5 native ChannelId VST3 migration: capture actual current M4 vendor // processor LEASES, not catalog names or copied binary state. The writer // must hold these control-owned leases within its new published dynamic diff --git a/src/Main.cpp b/src/Main.cpp index 0ffd18e22..2d324e987 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1582,6 +1582,33 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if(!ok)emitNotice("Live AUX send rejected; refresh accepted routing.",true); return; } + // Same installed M4 callback owns independent MONITOR output pins. + // Move input or AUX return's own MONITOR SEND at audio rate without + // touching MAIN/FX or changing the physical port map. + if(action=="routingMonitorSendGain") { + const int source=static_cast(args.getProperty("from",-1)); + const int requestId=static_cast(args.getProperty("requestId",0)); + const auto ep=args.getProperty("deviceEpoch",juce::var()); + const auto rv=args.getProperty("revision",juce::var()); + const bool numeric=value.isInt()||value.isDouble(); + const float gain=numeric?static_cast(static_cast(value)):-1.f; + const bool ok=requestId>0&&!nativeShowBusy_&&!studioBackupBusy_&& + (ep.isInt()||ep.isInt64())&&(rv.isInt()||rv.isInt64())&&numeric&& + engine_.setDryRoutingLabMonitorSendGain( + source,static_cast(static_cast(ep)), + static_cast(static_cast(rv)),gain); + auto ack=std::make_unique(); + ack->setProperty("ok",ok); + ack->setProperty("requestId",requestId); + ack->setProperty("from",source); + ack->setProperty("gain",static_cast(gain)); + ack->setProperty("error",ok?juce::String(): + "MONITOR send rejected: no independent MONITOR bus, stale route or invalid gain"); + ack->setProperty("state",engine_.status().getProperty("dryRoutingLab",{})); + if(browser_.loaded)browser_.emitEventIfBrowserIsVisible( + "arMixMonitorSendGainAck",juce::var(ack.release())); + return; + } // G5C native per-instance BYPASS never recompiles the graph and // does not require muting the output. All identity gates must agree. if (action == "routingFxBypass") { From db01c89e43471b48552054da729dd32c39a9976d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 16:32:34 +0700 Subject: [PATCH 045/155] engine: prime MONITOR at accepted PCM level, validate real PRE/POST AUX and independent MONITOR output through 8-frame realtime blocks --- engine/core/PreparedMixerBlock.h | 15 ++++++++++++ tests/dedicated_aux_bus_test.cpp | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 1afc4858d..2554d074d 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -283,6 +283,7 @@ class PreparedMixerBlock final { monitorApplied_[i]=monitorGoal_[i]=gains[i]; monitorRemaining_[i]=0; } + monitorPrimed_=true; } // FX callback signature: void(int stripId, float* L, float* R, int frames) @@ -318,6 +319,19 @@ class PreparedMixerBlock final { if(monitorR && monitorR!=monitorL)std::fill_n(monitorR,frames,0.f); return false; } + // Also support direct PreparedMixerBlock users (no JUCE FxGraph + // wrapper): the first real MONITOR render starts at its approved + // levels, never with a fake 64-frame fade from an unpatched zero. + if(monitorL && !monitorPrimed_) { + for(int i=0;i auxRampRemaining_{}; std::array monitorApplied_{},monitorGoal_{}; std::array monitorRemaining_{}; + bool monitorPrimed_=false; // sole audio producer except prepublish seeding std::array,auxBusCount> auxBusTarget_{}; std::array auxBusApplied_{}; // callback thread exclusive std::array rampPrimed_{}; diff --git a/tests/dedicated_aux_bus_test.cpp b/tests/dedicated_aux_bus_test.cpp index c1f7899e3..309d080c5 100644 --- a/tests/dedicated_aux_bus_test.cpp +++ b/tests/dedicated_aux_bus_test.cpp @@ -75,6 +75,25 @@ int main(){ assert(near(meters.auxPeak[0],auxA)); // after bus gain 0.5 assert(near(meters.auxPeak[1],auxB)); assert(near(meters.channelPeak[9],.1f*std::sqrt(.5f))); + // This is real PRE/POST native PCM, never a JS send simulation. + // A 64-frame gain ramp must not collapse to an 8-frame hard step. + assert(block.setAuxSendGain(0,0,SendTap::preFader,0.f)); + assert(block.setAuxSendGain(9,1,SendTap::postFader,0.f)); + assert(!block.setAuxSendGain(9,0,SendTap::postFader,0.f)); // edge absent + const auto beforeSendAutomation=allocations.load(std::memory_order_relaxed); + for(int cycle=0;cycle<8;++cycle) + assert(block.process(input.data(),stripCount,outL.data(),outR.data(), + frames,effects,&meters)); + assert(allocations.load(std::memory_order_relaxed)==beforeSendAutomation); + assert(near(outL[7],direct)&&near(outR[7],direct)); + assert(near(block.auxSendGain(0,0,SendTap::preFader),0.f)); + assert(near(block.auxSendGain(9,1,SendTap::postFader),0.f)); + assert(block.setAuxSendGain(0,0,SendTap::preFader,.5f)); + assert(block.setAuxSendGain(9,1,SendTap::postFader,.25f)); + for(int cycle=0;cycle<8;++cycle) + assert(block.process(input.data(),stripCount,outL.data(),outR.data(), + frames,effects,&meters)); + assert(near(outL[7],direct+auxA+auxB)); // Shared stereo AUX receives an explicitly left-panned mono PRE send. // The right output must not inherit phantom mono power. @@ -208,6 +227,27 @@ int main(){ assert(near(monL[f],.4f*monoCenter*.75f)); assert(near(monR[f],.4f*monoCenter*.75f)); } + // Native MONITOR targets move independent of MAIN, and their ramp + // follows AUDIO samples across eight 8-frame callbacks. + std::array,stripCount+auxBusCount> liveMonitor{}; + for(int i=0;i Date: Sun, 1 Nov 2026 16:39:44 +0700 Subject: [PATCH 046/155] feat(engine): one-gesture native SEND to existing VST3 AUX return with transactional PRE/POST edge, wet safety and accepted socket readback --- src/ConsoleLiveBridgeV6.h | 38 +++++++++++++++++ src/LiveAudioEngine.h | 21 ++++++++++ src/LiveDryRoutingLab.h | 85 +++++++++++++++++++++++++++++++++++++++ src/Main.cpp | 37 +++++++++++++++++ 4 files changed, 181 insertions(+) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index b42b97256..1c40d42db 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -118,6 +118,16 @@ class LiveConsoleBridgeV6 final { if(peaksL.isArray())object->setProperty("channelPeaksL",peaksL); if(peaksR.isArray())object->setProperty("channelPeaksR",peaksR); if(inserts.isArray())object->setProperty("fxInstances",inserts); + const auto topo=route.getProperty("acceptedRoute",juce::var()); + if(topo.isObject()) { + const auto sends=topo.getProperty("sends",juce::var()); + const auto returns=topo.getProperty("auxes",juce::var()); + if(sends.isArray())object->setProperty("acceptedSends",sends); + if(returns.isArray())object->setProperty("auxReturns",returns); + } + const auto monitorSends=route.getProperty("monitorSends",juce::var()); + if(monitorSends.isArray()) + object->setProperty("monitorSends",monitorSends); const auto main=route.getProperty("mainOutputs",juce::var()); if(main.isArray())object->setProperty("mainOutputs",main); const auto monitor=route.getProperty("monitorOutputs",juce::var()); @@ -296,6 +306,34 @@ class LiveConsoleBridgeV6 final { lane,ep,m4Revision,key,control); if(!accepted)error="NATIVE_CONTROL_REJECTED"; } + } else if(operation=="CONNECT_AUX_SEND") { + const auto bus=payload.getProperty("auxIndex",{}); + const auto tapName=payload.getProperty("tap","POST").toString(); + const auto gain=payload.getProperty("value",{}); + const auto pan=payload.getProperty("pan",juce::var(0.0)); + if(!bus.isInt()||static_cast(bus)<0|| + static_cast(bus)>=armix::mixer::auxBusCount) + error="INVALID_AUX_RETURN"; + else if(tapName!="PRE"&&tapName!="POST") + error="INVALID_SEND_TAP"; + else if((!gain.isInt()&&!gain.isDouble())|| + (!pan.isInt()&&!pan.isDouble())) + error="INVALID_SEND_GAIN_OR_PAN"; + else { + const double level=static_cast(gain); + const double balance=static_cast(pan); + if(!std::isfinite(level)||level<0.||level>1.|| + !std::isfinite(balance)||balance< -1.||balance>1.) + error="INVALID_SEND_GAIN_OR_PAN"; + else { + error=engine.connectDryRoutingLabAuxSend( + lane,static_cast(bus),ep,m4Revision, + tapName=="PRE"?armix::mixer::SendTap::preFader: + armix::mixer::SendTap::postFader, + static_cast(level),static_cast(balance)); + accepted=error.isEmpty(); + } + } } else if(operation=="SET_MONITOR_LEVEL") { const auto raw=payload.getProperty("value",{}); if(!raw.isInt()&&!raw.isDouble()) diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index e7f377453..bfade45ca 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1131,6 +1131,27 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback return false; return dryRoutingLab_.setAuxSendGain(source,bus,epoch,revision,gain,tap); } + juce::String connectDryRoutingLabAuxSend(int source,int bus, + std::uint64_t epoch,std::uint64_t revision, + armix::mixer::SendTap tap,float gain,float pan) { + if(independent_.active()||routeReconfiguring_.load(std::memory_order_acquire)|| + handoff_.busy()||!directFence_.permitted()|| + diagnosticRoute_.load(std::memory_order_acquire) + !=armix::diagnostics::Route::normal|| + savedDirectSetup_||savedLiveSetup_) + return "AUX CONNECT: DIRECT device or VST graph handoff unavailable"; + auto* device=deviceManager_.getCurrentAudioDevice(); + if(!device)return "AUX CONNECT: no verified audio interface"; + try { + return dryRoutingLab_.connectPreparedAuxSend( + source,bus,epoch,revision,tap,gain,pan, + directFence_.permitted(),independent_.active(),graphOwned_->count, + formats_,device->getCurrentSampleRate(), + juce::jmax(32,device->getCurrentBufferSizeSamples())); + } catch(...) { + return "AUX CONNECT: failed native preparation; previous route retained"; + } + } bool setDryRoutingLabMonitorSendGain(int source,std::uint64_t epoch, std::uint64_t revision,float gain) noexcept { if(independent_.active()||routeReconfiguring_.load(std::memory_order_acquire)|| diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 868be4403..ac654b517 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -588,6 +588,91 @@ class LiveDryRoutingLab final { sampleRate,deviceFrames); } + // Operator one-action AUX send connection: prepare a real parallel + // edge in the SAME M4 graph that owns the channel VST3/AUX rack. + // The recipient must already own a genuine prepared effect. An empty + // AUX summed into MAIN doubles the dry path and is rejected. + juce::String connectPreparedAuxSend(int source,int bus, + std::uint64_t expectedEpoch,std::uint64_t expectedRevision, + armix::mixer::SendTap tap,float gain,float pan, + bool directPermitted,bool independentClock,int occupiedCh1Fx, + juce::AudioPluginFormatManager& formats,double sampleRate, + int deviceFrames) { + if(!hasExplicitRoute()||!ready()||!registryValid_.load(std::memory_order_acquire)|| + epoch()!=expectedEpoch||revision()!=expectedRevision|| + topologyFault_.load(std::memory_order_acquire)|| + source<0||source>=count||bus<0||bus>=auxCount|| + (tap!=armix::mixer::SendTap::preFader&& + tap!=armix::mixer::SendTap::postFader)|| + !std::isfinite(gain)||gain<0.f||gain>1.f|| + !std::isfinite(pan)||pan< -1.f||pan>1.f) + return "AUX CONNECT: invalid source, send or stale native graph"; + const auto* old=publisher_.controlPrepared(expectedEpoch,expectedRevision); + if(!old||old->insertsOn(count+bus)<=0) + return "AUX CONNECT: insert a real effect on AUX first; an empty return doubles dry MAIN"; + auto staged=juce::JSON::parse(juce::JSON::toString(sourceTemplate_,false)); + if(!staged.isObject())return "AUX CONNECT: accepted topology unavailable"; + const auto lanes=staged.getProperty("channels",juce::var()); + const auto* sources=lanes.getArray(); + if(!sources||sources->size()!=count|| + sources->getReference(source).getProperty("mode","NONE").toString()=="NONE") + return "AUX CONNECT: select a verified physical source first"; + auto aux=staged.getProperty("auxes",juce::var()); + if(aux.isVoid()) { + juce::Array defaults; + for(int b=0;b(); + row->setProperty("enabled",false); + row->setProperty("main",true); + row->setProperty("mute",false); + row->setProperty("gain",1.0); + defaults.add(juce::var(row.release())); + } + staged.getDynamicObject()->setProperty("auxes",juce::var(defaults)); + aux=staged.getProperty("auxes",juce::var()); + } + auto* auxes=aux.getArray(); + if(!auxes||auxes->size()!=auxCount)return "AUX CONNECT: corrupt return roster"; + auto* returnRow=auxes->getReference(bus).getDynamicObject(); + if(!returnRow)return "AUX CONNECT: invalid return"; + if(!static_cast(returnRow->getProperty("enabled"))) { + returnRow->setProperty("enabled",true); + returnRow->setProperty("main",true); // one-click parallel effect to MAIN + } + auto rawSends=staged.getProperty("sends",juce::var()); + if(rawSends.isVoid()) { + staged.getDynamicObject()->setProperty("sends", + juce::var(juce::Array{})); + rawSends=staged.getProperty("sends",juce::var()); + } + auto* sendRows=rawSends.getArray(); + if(!sendRows)return "AUX CONNECT: invalid accepted sends"; + juce::DynamicObject* existing=nullptr; + for(auto& item:*sendRows) { + if(item.getProperty("from",-1)==source && + item.getProperty("to",-1)==count+bus) { + existing=item.getDynamicObject(); + if(!existing)return "AUX CONNECT: invalid existing edge"; + break; + } + } + if(!existing) { + if(sendRows->size()>=armix::mixer::maxChannelSends) + return "AUX CONNECT: send capacity exhausted"; + auto row=std::make_unique(); + existing=row.get(); + sendRows->add(juce::var(row.release())); + } + existing->setProperty("from",source); + existing->setProperty("to",count+bus); + existing->setProperty("tap",tap==armix::mixer::SendTap::preFader?"PRE":"POST"); + existing->setProperty("gain",static_cast(gain)); + existing->setProperty("pan",static_cast(pan)); + return publishRevisedTopology(staged,expectedEpoch,expectedRevision, + directPermitted,independentClock,occupiedCh1Fx,formats, + sampleRate,deviceFrames); + } + // Both SOURCE and channel structure edits share one graph compiler, // VST3 lease policy and rollback path. Keep fast faders/pan/mute/solo // on their separate atomic parameter path without any compilation. diff --git a/src/Main.cpp b/src/Main.cpp index 2d324e987..faccc68d2 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1582,6 +1582,43 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if(!ok)emitNotice("Live AUX send rejected; refresh accepted routing.",true); return; } + // One-click SEND -> existing real AUX VST3 RETURN. The structural + // graph transaction prepares/validates and retains the same processor + // owner; no unfiltered empty AUX can duplicate dry MAIN. + if(action=="routingAuxConnect") { + const int from=static_cast(args.getProperty("from",-1)); + const int bus=static_cast(args.getProperty("bus",-1)); + const int requestId=static_cast(args.getProperty("requestId",0)); + const auto ep=args.getProperty("deviceEpoch",juce::var()); + const auto rv=args.getProperty("revision",juce::var()); + const auto kind=args.getProperty("tap","POST").toString(); + const auto rawGain=args.getProperty("gain",juce::var()); + const auto rawPan=args.getProperty("pan",juce::var(0.0)); + const bool valid=requestId>0&&!nativeShowBusy_&&!studioBackupBusy_&& + (ep.isInt()||ep.isInt64())&&(rv.isInt()||rv.isInt64())&& + (rawGain.isInt()||rawGain.isDouble())&& + (rawPan.isInt()||rawPan.isDouble())&& + (kind=="PRE"||kind=="POST"); + const juce::String error=valid?engine_.connectDryRoutingLabAuxSend( + from,bus,static_cast(static_cast(ep)), + static_cast(static_cast(rv)), + kind=="PRE"?armix::mixer::SendTap::preFader: + armix::mixer::SendTap::postFader, + static_cast(static_cast(rawGain)), + static_cast(static_cast(rawPan))): + juce::String("AUX CONNECT: invalid or stale request"); + auto ack=std::make_unique(); + ack->setProperty("ok",error.isEmpty()); + ack->setProperty("requestId",requestId); + ack->setProperty("from",from); + ack->setProperty("bus",bus); + ack->setProperty("tap",kind); + ack->setProperty("error",error); + ack->setProperty("state",engine_.status().getProperty("dryRoutingLab",{})); + if(browser_.loaded)browser_.emitEventIfBrowserIsVisible( + "arMixAuxConnectAck",juce::var(ack.release())); + return; + } // Same installed M4 callback owns independent MONITOR output pins. // Move input or AUX return's own MONITOR SEND at audio rate without // touching MAIN/FX or changing the physical port map. From 704cbff422f20acd295385bb1ea858b32873fc4f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 16:47:21 +0700 Subject: [PATCH 047/155] fix(engine/MSVC): use explicit JUCE var integer conversion for native AUX edge identity --- src/LiveDryRoutingLab.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index ac654b517..04c69c295 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -649,8 +649,8 @@ class LiveDryRoutingLab final { if(!sendRows)return "AUX CONNECT: invalid accepted sends"; juce::DynamicObject* existing=nullptr; for(auto& item:*sendRows) { - if(item.getProperty("from",-1)==source && - item.getProperty("to",-1)==count+bus) { + if(static_cast(item.getProperty("from",-1))==source && + static_cast(item.getProperty("to",-1))==count+bus) { existing=item.getDynamicObject(); if(!existing)return "AUX CONNECT: invalid existing edge"; break; From 1d089aec5802936bd7111b4e9b3418be2387d506 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 18:23:14 +0700 Subject: [PATCH 048/155] fix(engine/RT): one atomic PRE/POST AUX send renderer for all native PCM call sites; ACKed send gains now affect actual output --- engine/core/PreparedMixerBlock.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 2554d074d..e8eb46aa5 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -470,9 +470,12 @@ class PreparedMixerBlock final { } graph.sends.dispatch(strip,SendTap::preFader,l,r, left_.data(),right_.data(),frames); - if(live)dispatchLiveAux(strip,SendTap::preFader,l,r,frames); - else graph.aux.dispatch(strip,SendTap::preFader,l,r, - auxLeft_.data(),auxRight_.data(),frames); + // One accepted AUX send parameter plane for both hosted + // LiveChannelFxGraph and direct PreparedMixerBlock callers. + // The old no-live branch bypassed atomic send targets, so an + // ACKed SET_SEND_LEVEL left PCM unchanged. This is an actual + // runtime audio correctness defect, not a test-only behavior. + dispatchLiveAux(strip,SendTap::preFader,l,r,frames); float peak=0.f, peakL=0.f, peakR=0.f; if(monitorBusL) { const float next=liveMonitorGains @@ -531,9 +534,12 @@ class PreparedMixerBlock final { } graph.sends.dispatch(strip,SendTap::postFader,l,r, left_.data(),right_.data(),frames); - if(live)dispatchLiveAux(strip,SendTap::postFader,l,r,frames); - else graph.aux.dispatch(strip,SendTap::postFader,l,r, - auxLeft_.data(),auxRight_.data(),frames); + // One accepted AUX send parameter plane for both hosted + // LiveChannelFxGraph and direct PreparedMixerBlock callers. + // The old no-live branch bypassed atomic send targets, so an + // ACKed SET_SEND_LEVEL left PCM unchanged. This is an actual + // runtime audio correctness defect, not a test-only behavior. + dispatchLiveAux(strip,SendTap::postFader,l,r,frames); } // Dedicated AUX returns execute AFTER all ten source strips. // Input channel count NEVER decreases when an AUX is enabled. From 1d1fcddeea2a3ca14688cbba2ef609136fb3672e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 18:24:12 +0700 Subject: [PATCH 049/155] feat(engine): connect real-time PRE/POST AUX send-level ConsoleIntent to installed atomic native PCM bus with native ACK --- src/ConsoleLiveBridgeV6.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 1c40d42db..dcaa15216 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -306,6 +306,32 @@ class LiveConsoleBridgeV6 final { lane,ep,m4Revision,key,control); if(!accepted)error="NATIVE_CONTROL_REJECTED"; } + } else if(operation=="SET_SEND_LEVEL") { + // Existing PRE/POST AUX edge: realtime gain target only. + // No new bus, VST3 instance, graph rebuild or driver stop. + const auto bus=payload.getProperty("auxIndex",{}); + const auto level=payload.getProperty("value",{}); + const auto tap=payload.getProperty("tap","POST").toString(); + if(!bus.isInt() || static_cast(bus)<0 || + static_cast(bus)>=armix::mixer::auxBusCount) + error="INVALID_AUX_RETURN"; + else if(tap!="PRE"&&tap!="POST") + error="INVALID_SEND_TAP"; + else if(!level.isInt()&&!level.isDouble()) + error="INVALID_SEND_GAIN"; + else { + const double value=static_cast(level); + if(!std::isfinite(value)||value<0.||value>1.) + error="INVALID_SEND_GAIN"; + else { + accepted=engine.setDryRoutingLabAuxSendGain( + lane,static_cast(bus),ep,m4Revision, + static_cast(value), + tap=="PRE"?armix::mixer::SendTap::preFader: + armix::mixer::SendTap::postFader); + if(!accepted)error="NATIVE_SEND_NOT_ADMITTED"; + } + } } else if(operation=="CONNECT_AUX_SEND") { const auto bus=payload.getProperty("auxIndex",{}); const auto tapName=payload.getProperty("tap","POST").toString(); From fe28110f5e4535518e9e3fec4c2f601ada6cf03b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 18:27:37 +0700 Subject: [PATCH 050/155] fix(engine): maintain zero-automation static AUX PCM fast path; switch to 64-sample atomic PRE/POST mixer only on actual native send edit --- engine/core/PreparedMixerBlock.h | 36 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index e8eb46aa5..8b0c9e1f5 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -249,6 +249,9 @@ class PreparedMixerBlock final { for(int e=plan_.aux.offset[source];e preRampRemaining_{}; std::array,stripCount> physicalTarget_{}; std::array physicalBlend_{}; + // OFF until any native SET_SEND_LEVEL. Audio callback reads only; + // control-thread publication is monotonic for this prepared graph. + std::atomic auxAutomationActive_{false}; std::array,maxAuxSends> auxTarget_{}; std::array auxApplied_{},auxGoal_{}; // callback exclusive std::array auxRampRemaining_{}; From fd0087fbb75661dc7e28b89a051730caa6b7a0d5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 18:33:38 +0700 Subject: [PATCH 051/155] fix(engine): deduplicate existing native SET_SEND_LEVEL handler; retain canonical accepted AUX operation without unreachable branch --- src/ConsoleLiveBridgeV6.h | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index dcaa15216..1c40d42db 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -306,32 +306,6 @@ class LiveConsoleBridgeV6 final { lane,ep,m4Revision,key,control); if(!accepted)error="NATIVE_CONTROL_REJECTED"; } - } else if(operation=="SET_SEND_LEVEL") { - // Existing PRE/POST AUX edge: realtime gain target only. - // No new bus, VST3 instance, graph rebuild or driver stop. - const auto bus=payload.getProperty("auxIndex",{}); - const auto level=payload.getProperty("value",{}); - const auto tap=payload.getProperty("tap","POST").toString(); - if(!bus.isInt() || static_cast(bus)<0 || - static_cast(bus)>=armix::mixer::auxBusCount) - error="INVALID_AUX_RETURN"; - else if(tap!="PRE"&&tap!="POST") - error="INVALID_SEND_TAP"; - else if(!level.isInt()&&!level.isDouble()) - error="INVALID_SEND_GAIN"; - else { - const double value=static_cast(level); - if(!std::isfinite(value)||value<0.||value>1.) - error="INVALID_SEND_GAIN"; - else { - accepted=engine.setDryRoutingLabAuxSendGain( - lane,static_cast(bus),ep,m4Revision, - static_cast(value), - tap=="PRE"?armix::mixer::SendTap::preFader: - armix::mixer::SendTap::postFader); - if(!accepted)error="NATIVE_SEND_NOT_ADMITTED"; - } - } } else if(operation=="CONNECT_AUX_SEND") { const auto bus=payload.getProperty("auxIndex",{}); const auto tapName=payload.getProperty("tap","POST").toString(); From d42224c3a6e9259086664348ba88c5fd9586cd45 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 18:34:23 +0700 Subject: [PATCH 052/155] =?UTF-8?q?feat(engine):=20real=20AUX1=E2=80=934?= =?UTF-8?q?=20return=20faders=20after=20hosted=20FX=20with=20native=20SET?= =?UTF-8?q?=5FAUX=5FFADER=20intent,=20no=20graph/device=20restart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ConsoleLiveBridgeV6.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 1c40d42db..5e89ecc0a 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -251,7 +251,8 @@ class LiveConsoleBridgeV6 final { else if(!target.isString() || !decodeDecimal(target,channelId) || channelId<1 || (channelId>10 && - !(operation=="SET_MONITOR_LEVEL"&&channelId<=14))) + !((operation=="SET_MONITOR_LEVEL"|| + operation=="SET_AUX_FADER")&&channelId<=14))) error="INVALID_LEGACY_CHANNEL_ID"; else if(!engine.dryRoutingLabActive() || engine.dryRoutingLabEpoch()!=ep || @@ -334,6 +335,28 @@ class LiveConsoleBridgeV6 final { accepted=error.isEmpty(); } } + } else if(operation=="SET_AUX_FADER") { + // Native AUX return fader AFTER its real VST3 rack. + // 11..14 are explicit legacy M4 auxiliary ordinals; + // never pretend these are stable universal ChannelIds. + if(channelId<11||channelId>14) + error="INVALID_LEGACY_AUX_CHANNEL"; + else { + const auto raw=payload.getProperty("value",{}); + if(!raw.isInt()&&!raw.isDouble()) + error="INVALID_AUX_FADER"; + else { + const double gain=static_cast(raw); + if(!std::isfinite(gain)||gain<0.||gain>4.) + error="INVALID_AUX_FADER"; + else { + accepted=engine.setDryRoutingLabAuxBusGain( + static_cast(channelId-11),ep, + m4Revision,static_cast(gain)); + if(!accepted)error="AUX_RETURN_NOT_ADMITTED"; + } + } + } } else if(operation=="SET_MONITOR_LEVEL") { const auto raw=payload.getProperty("value",{}); if(!raw.isInt()&&!raw.isDouble()) From 40a059785993cc6a4bb593020bf9749de92746f9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 1 Nov 2026 18:43:33 +0700 Subject: [PATCH 053/155] fix(engine DSP): AUX1-4 post-VST fader 64-sample dezipper across tiny ASIO buffers, immutable idle fast path, MAIN/MONITOR parity --- engine/core/PreparedMixerBlock.h | 38 ++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 8b0c9e1f5..5bf6c2ec1 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -196,7 +196,8 @@ class PreparedMixerBlock final { for(int b=0;b4.f)return false; auxBusTarget_[bus].store(gain,std::memory_order_release); + auxBusAutomationActive_.store(true,std::memory_order_release); return true; } float auxBusGain(int bus) const noexcept { @@ -569,14 +571,26 @@ class PreparedMixerBlock final { monitorRemaining_[monitorLane]=64; } } - const float target=live + // Original zero-automation fast path remains one scalar + // multiplication; only a real operator AUX fader edit enables + // the sample-continuous 64-frame de-zipper across 4/8/16-frame + // callbacks. The fader scales the return AFTER hosted AUX VST3 + // for both MAIN and independent MONITOR, not source dry PCM. + const bool automated=auxBusAutomationActive_.load( + std::memory_order_acquire); + const float target=automated ?auxBusTarget_[b].load(std::memory_order_acquire):bus.gain; - const float start=live?auxBusApplied_[b]:bus.gain; - const int ramp=std::min(frames,64); - const float step=(target-start)/static_cast(ramp); - float current=start; + if(automated && target!=auxBusGoal_[b]) { + auxBusGoal_[b]=target; + auxBusRemaining_[b]=64; + } + float current=automated?auxBusApplied_[b]:bus.gain; + int remaining=automated?auxBusRemaining_[b]:0; for(int f=0;f0) { + current+=(target-current)/static_cast(remaining); + --remaining; + } else current=target; const float vl=l[f]*current,vr=r[f]*current; if(monitorBusL) { const float gain=nextMonitorGain(monitorLane); @@ -591,7 +605,10 @@ class PreparedMixerBlock final { masterR_[f]+=vr; } } - if(live)auxBusApplied_[b]=target; + if(automated) { + auxBusApplied_[b]=remaining==0?target:current; + auxBusRemaining_[b]=remaining; + } if(observed)observed->auxPeak[b]=peak; } processFx(-1,masterL_,masterR_,frames); @@ -694,7 +711,10 @@ class PreparedMixerBlock final { std::array monitorRemaining_{}; bool monitorPrimed_=false; // sole audio producer except prepublish seeding std::array,auxBusCount> auxBusTarget_{}; - std::array auxBusApplied_{}; // callback thread exclusive + std::array auxBusApplied_{},auxBusGoal_{}; + std::array auxBusRemaining_{}; + std::atomic auxBusAutomationActive_{false}; + // State exclusively advanced in the single JUCE audio callback. std::array rampPrimed_{}; float* masterL_=nullptr; float* masterR_=nullptr; From 055313598bc3b23201694de815f40bd5c582f4bd Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 2 Nov 2026 23:12:14 +0700 Subject: [PATCH 054/155] fix(engine): M1 sample-continuous fader, offline AUX parity, bounded graph retirement tests --- ...M1_REALTIME_CORE_STABILIZATION_20261102.md | 11 +++++ engine/core/PreparedMixerBlock.h | 36 ++++++++++----- tests/mixer_routing_plan_test.cpp | 45 +++++++++++++++++++ tests/realtime_control_test.cpp | 37 +++++++++++++++ 4 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 docs/M1_REALTIME_CORE_STABILIZATION_20261102.md diff --git a/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md new file mode 100644 index 000000000..a1bd83fae --- /dev/null +++ b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md @@ -0,0 +1,11 @@ +# M1 — Realtime core stabilization (2026-11-02) + +**Stacked source**: ENGINE #266 at `40a059785993cc6a4bb593020bf9749de92746f9`. No competing DSP, native callback, GUI or worker per channel. + +This checkpoint repairs the Windows CTest AUX static/offline regression and corrects native fader/PAN de-zippering to remain **64 audio samples across variable callback frames** (4/16/32/12), including reverse direction. Existing live PRE/POST sends and AUX return faders retain their prepared 64-sample ramp; offline/no-live paths must not inherit old live AUX targets. All work uses fixed-size arrays and no new callback heap allocations. + +The existing `RealtimeRoutePublisher` owns bounded retirement. New tests hold a real leased reader across two graph publications, verify refusal when the queue is full, and verify all four prepared owners are reclaimed after the reader leaves. All tests run in the existing CTest executables with no additional CI matrix. + +**Runtime invariant:** `LiveAudioEngine::audioDeviceIOCallbackWithContext` is still M4 until the full CH1 external/Orbit owner, native vendor FX/editor/Show, physical input/output pins and monitor can migrate together. Never enable universal supportedOps or silently render the new graph alongside M4. Worker-only work belongs to existing control/Show-save processing, NOT the real-time callback. + +**Remaining M1 release gates:** pass exact-SHA Windows MSVC/CTest, integrate a single full-fidelity ChannelId callback with atomic admission and no FX loss, then qualify ASIO/WASAPI and zero-FX crackle on actual hardware. This change alone is **not M1 complete**, not UAT, not acoustic FAT. diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 5bf6c2ec1..4b75cff29 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -450,6 +450,9 @@ class PreparedMixerBlock final { preRampRemaining_[strip]=0; lastGainL_[strip]=gl; lastGainR_[strip]=gr; + gainGoalL_[strip]=gl; + gainGoalR_[strip]=gr; + gainRampRemaining_[strip]=0; rampPrimed_[strip]=true; } // The MUTE/PRE-SEND de-click is 64 AUDIO SAMPLES, not one @@ -480,7 +483,7 @@ class PreparedMixerBlock final { // Once the message thread publishes a changed send target, // the SAME callback switches to one live PRE/POST processor // which follows 64-sample gains across varying block sizes. - if(auxAutomationActive_.load(std::memory_order_acquire)) + if(live && auxAutomationActive_.load(std::memory_order_acquire)) dispatchLiveAux(strip,SendTap::preFader,l,r,frames); else graph.aux.dispatch(strip,SendTap::preFader,l,r, auxLeft_.data(),auxRight_.data(),frames); @@ -495,14 +498,20 @@ class PreparedMixerBlock final { } } if(live) { - // A block-linear fader/PAN ramp avoids zipper clicks at the - // native callback rate. UI sends at most one target per rAF. - const int ramp=std::min(frames,64); - const float dL=(gl-lastGainL_[strip])/ramp; - const float dR=(gr-lastGainR_[strip])/ramp; + // Fader/PAN dezipper is 64 AUDIO SAMPLES, not one callback. + // Reversing the target restarts from the actual applied gain. + if(gl!=gainGoalL_[strip] || gr!=gainGoalR_[strip]) { + gainGoalL_[strip]=gl;gainGoalR_[strip]=gr; + gainRampRemaining_[strip]=64; + } float lv=lastGainL_[strip],rv=lastGainR_[strip]; + int gainRemaining=gainRampRemaining_[strip]; for(int f=0;f0) { + lv+=(gl-lv)/static_cast(gainRemaining); + rv+=(gr-rv)/static_cast(gainRemaining); + --gainRemaining; + } else {lv=gl;rv=gr;} l[f]*=lv;r[f]*=rv; if(monitorBusL) { const float gain=nextMonitorGain(strip); @@ -517,7 +526,8 @@ class PreparedMixerBlock final { masterL_[f]+=l[f];masterR_[f]+=r[f]; } } - lastGainL_[strip]=gl;lastGainR_[strip]=gr; + lastGainL_[strip]=lv;lastGainR_[strip]=rv; + gainRampRemaining_[strip]=gainRemaining; }else for(int f=0;f right_{}; std::array auxLeft_{},auxRight_{}; std::array preGate_{},preGateTarget_{}, - lastGainL_{},lastGainR_{}; - std::array preRampRemaining_{}; + lastGainL_{},lastGainR_{},gainGoalL_{},gainGoalR_{}; + std::array preRampRemaining_{},gainRampRemaining_{}; std::array,stripCount> physicalTarget_{}; std::array physicalBlend_{}; // OFF until any native SET_SEND_LEVEL. Audio callback reads only; diff --git a/tests/mixer_routing_plan_test.cpp b/tests/mixer_routing_plan_test.cpp index 19517fb1c..1a2832a8e 100644 --- a/tests/mixer_routing_plan_test.cpp +++ b/tests/mixer_routing_plan_test.cpp @@ -690,6 +690,50 @@ static void verifyLegacyToDynamicProductionPcmParity() { } + +static void verifyRealtimeFaderRampAcrossShortCallbacks() { + using namespace armix::mixer; + const std::array pins{0,1}; + ChannelRoutingConfig routing; + routing.stripsAndMaster.strips[0]= + {SourceMode::mono,0,-1,1.f,0.f,false,false}; + SendRequest sends; + sends.toMaster[0]=true; + PreparedRenderGraph graph; + RenderError error; + assert(PreparedRenderGraph::compile(routing,pins,sends,graph,error)); + PreparedMixerBlock block(graph,64); + RealtimeStripControls controls; + assert(controls.set(0,1.f,0.f,true,false,false)); + std::array mic{},unused{},left{},right{}; + mic.fill(.8f); + const float* sources[]={mic.data(),unused.data()}; + const auto noFx=[](int,float*,float*,int) noexcept {}; + const auto render=[&](int frames) { + left.fill(0.f);right.fill(0.f); + return block.process(sources,2,left.data(),right.data(),frames, + noFx,nullptr,&controls); + }; + assert(render(4)); + const float baseline=left[0]; + assert(baseline>.01f && close(right[3],baseline)); + assert(controls.set(0,0.f,0.f,true,false,false)); + assert(render(4)); + assert(close(left[3],baseline*60.f/64.f,3.e-5f)); + assert(render(16)); + assert(close(left[15],baseline*44.f/64.f,3.e-5f)); + assert(render(32)); + assert(close(left[31],baseline*12.f/64.f,3.e-5f)); + assert(render(12)); + assert(close(left[11],0.f,3.e-5f)); + // Mid-show fader reversal must not jump to the last requested target. + assert(controls.set(0,1.f,0.f,true,false,false)); + assert(render(4)); + assert(close(left[3],baseline*4.f/64.f,3.e-5f)); + assert(render(60)); + assert(close(left[59],baseline,3.e-5f)); +} + static void verifyRealtimeAuxPostGainWithoutGraphRebuild() { using namespace armix::mixer; const std::array pins{0,1}; @@ -969,6 +1013,7 @@ int main() { verifyDynamicChannelIdLiveControls(); verifyDynamicNativeSessionPublication(); verifyStudioConsoleBusBatchPcm(); + verifyRealtimeFaderRampAcrossShortCallbacks(); verifyRealtimeAuxMasterPcmBothOutputs(); verifyRealtimeAuxPostGainWithoutGraphRebuild(); verifyLegacyToDynamicProductionPcmParity(); diff --git a/tests/realtime_control_test.cpp b/tests/realtime_control_test.cpp index 0cb920ab9..91b288fdb 100644 --- a/tests/realtime_control_test.cpp +++ b/tests/realtime_control_test.cpp @@ -1,5 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only #include "../engine/core/RealtimeControl.h" +#include "../engine/core/RealtimeRoutePublisher.h" +#include #include #ifdef NDEBUG #undef NDEBUG @@ -51,6 +53,41 @@ int main(){ checkPan(0.f,0.f,1.f,0.f,1.f); checkPan(0.f,1.f,0.f,1.f,0.f); std::cout<<"PASS: native stereo pan centre, extremes, half-pan and unit-gain dual-mono\n"; + + // M1: retired FX/PCM snapshots remain owned until callbacks release + // their leases; a full bounded queue rejects instead of growing memory. + struct RetireProbe { + std::atomic* counter; + explicit RetireProbe(std::atomic& c):counter(&c){} + ~RetireProbe(){counter->fetch_add(1,std::memory_order_relaxed);} + }; + std::atomic destroyed{0}; + RealtimeRoutePublisher publisher; + const auto publish=[&](std::uint64_t revision) { + auto next=std::make_unique::Snapshot>(); + next->deviceEpoch=7;next->graphRevision=revision; + next->prepared=std::make_unique(destroyed); + return publisher.publish(std::move(next),revision-1,7); + }; + using Result=RealtimeRoutePublisher::Result; + assert(publish(1)==Result::applied); + { + auto lease=publisher.acquire(); + assert(lease.get(7)&&lease.get(7)->graphRevision==1); + assert(publish(2)==Result::applied); + assert(publish(3)==Result::applied); + assert(publisher.pendingRetirements()==2); + assert(publish(4)==Result::retirementFull); + assert(destroyed.load(std::memory_order_relaxed)==1); + assert(lease.get(7)->graphRevision==1); + } + assert(publisher.pollRetirement()); + assert(publisher.pendingRetirements()==0); + assert(destroyed.load(std::memory_order_relaxed)==3); + assert(publish(4)==Result::applied); + publisher.unpublish(); + assert(publisher.pollRetirement()); + assert(destroyed.load(std::memory_order_relaxed)==4); // Runtime contract for the exact RT graph publication helper. struct FakeGraph { int id; }; FakeGraph old{1}, next{2}, third{3}; From 9f15f2b948c4490cde8740c47d0ce8b58d7b989b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 2 Nov 2026 23:14:01 +0700 Subject: [PATCH 055/155] fix(worker): release Show snapshots, vendor blobs and completion closures on every job boundary --- ...M1_REALTIME_CORE_STABILIZATION_20261102.md | 3 ++ src/NativeShowSaveWorker.h | 39 ++++++++++++++----- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md index a1bd83fae..8ba3ac0f2 100644 --- a/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md +++ b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md @@ -9,3 +9,6 @@ The existing `RealtimeRoutePublisher` owns bounded retirement. New tests hold a **Runtime invariant:** `LiveAudioEngine::audioDeviceIOCallbackWithContext` is still M4 until the full CH1 external/Orbit owner, native vendor FX/editor/Show, physical input/output pins and monitor can migrate together. Never enable universal supportedOps or silently render the new graph alongside M4. Worker-only work belongs to existing control/Show-save processing, NOT the real-time callback. **Remaining M1 release gates:** pass exact-SHA Windows MSVC/CTest, integrate a single full-fidelity ChannelId callback with atomic admission and no FX loss, then qualify ASIO/WASAPI and zero-FX crackle on actual hardware. This change alone is **not M1 complete**, not UAT, not acoustic FAT. + +## Worker payload lifetime hardening +`NativeShowSaveWorker` validates Show IDs before reserving, releases snapshot/blob/closure memory immediately on start failure, and moves the completion closure rather than retaining a second copy after IO completion. The long-lived worker is reused; no new OS thread or realtime allocation has been introduced. Windows JUCE compilation and runtime verification are release gates. diff --git a/src/NativeShowSaveWorker.h b/src/NativeShowSaveWorker.h index f44e1f23f..f568003d2 100644 --- a/src/NativeShowSaveWorker.h +++ b/src/NativeShowSaveWorker.h @@ -43,17 +43,19 @@ class NativeShowSaveWorker final : private juce::Thread { } bool launch(juce::File studio,SnapshotV2 snapshot, std::vector binaryStates,Completion completion) { - if(!reserve(Operation::save,std::move(studio),std::move(completion)) || - !detail::uuid(snapshot.id))return false; + // Reject invalid requests BEFORE reserving or retaining a potentially + // large vendor-state payload on this long-lived worker. + if(!detail::uuid(snapshot.id) || + !reserve(Operation::save,std::move(studio),std::move(completion))) + return false; snapshot_=std::move(snapshot); blobs_=std::move(binaryStates); - if(startThread())return true; - return false; + return startOrRelease(); } bool list(juce::File studio,Completion completion) { if(!reserve(Operation::list,std::move(studio),std::move(completion))) return false; - return startThread(); + return startOrRelease(); } bool read(juce::File studio,juce::String showId, juce::int64 epoch,juce::int64 revision,Completion completion) { @@ -62,9 +64,27 @@ class NativeShowSaveWorker final : private juce::Thread { return false; requestedId_=std::move(showId); requestEpoch_=epoch;requestRevision_=revision; - return startThread(); + return startOrRelease(); } private: + // Start failure must release captured Show snapshots, binary-state blobs + // and completion closures. The worker never transfers these to RT. + bool startOrRelease() { + if(startThread())return true; + releaseJob(); + return false; + } + // Exclusively invoked after the worker's IO is finished or before it + // started. No concurrent use with the caller/message thread. + void releaseJob() { + snapshot_=SnapshotV2{}; + blobs_.clear(); + blobs_.shrink_to_fit(); + requestedId_={}; + requestEpoch_=0;requestRevision_=0; + studio_={}; + finished_={}; + } bool reserve(Operation mode,juce::File studio,Completion completion) { if(isThreadRunning()||!completion)return false; operation_=mode;studio_=std::move(studio); @@ -86,10 +106,11 @@ class NativeShowSaveWorker final : private juce::Thread { } catch(...) { result.error="Unknown native Show IO exception; session unchanged"; } - blobs_.clear(); // release captured bytes on IO thread after commit - blobs_.shrink_to_fit(); + // Move the completion closure out: the worker must not retain a + // second copy of UI captures or a large Show snapshot between jobs. + auto done=std::move(finished_); + releaseJob(); // IO worker thread, never audio callback auto alive=alive_; - auto done=finished_; // A 128 MB vendor-blob result must not be copied by std::function // when JUCE queues an async callback on the message thread. auto delivered=std::make_shared(std::move(result)); From 773fbddafdbc070831f496a1a6269230f96ce120 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 2 Nov 2026 23:35:43 +0700 Subject: [PATCH 056/155] feat(engine): reconcile AUX realtime control, prove ownership; gate M1 hardware FAT artifact --- .github/workflows/p1-windows.yml | 9 ++++---- docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md | 22 ++++++++++++++++++- ...M1_REALTIME_CORE_STABILIZATION_20261102.md | 7 ++++++ engine/core/PreparedMixerBlock.h | 11 +++++----- tests/mixer_routing_plan_test.cpp | 9 +++++++- tests/realtime_control_test.cpp | 4 +++- 6 files changed, 50 insertions(+), 12 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 965bd2fbf..266baddc7 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -137,12 +137,13 @@ jobs: & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # PRs compile/CTest/package but never silently publish a stable build. - # This single M4 FAT branch is explicitly allowed to upload an - # UNQUALIFIED experimental ZIP for real physical hardware testing. + # Only explicitly named hardware-FAT candidate PRs may upload an + # UNQUALIFIED test artifact. It is never a public/stable release. + # No extra build matrix and no upload when CTest/package audit fails. - uses: actions/upload-artifact@v4 - if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' }} + if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'work/m1-realtime-stability-20261102' }} with: - name: ${{ github.event_name == 'pull_request' && 'ArSonMix-M4-EXPERIMENTAL-Hardware-FAT-Windows-x64' || 'ArSonMix-GUI10CH-P012-Verified-Hardware-FAT-Windows-x64' }} + name: ${{ github.event_name == 'pull_request' && (github.head_ref == 'work/m1-realtime-stability-20261102' && 'ArSonMix-M1-EXPERIMENTAL-Hardware-FAT-Windows-x64' || 'ArSonMix-M4-EXPERIMENTAL-Hardware-FAT-Windows-x64') || 'ArSonMix-GUI10CH-P012-Verified-Hardware-FAT-Windows-x64' }} path: dist/ if-no-files-found: error retention-days: 14 diff --git a/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md b/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md index baa97a730..c518d4eaf 100644 --- a/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md +++ b/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md @@ -1,5 +1,5 @@ # ArSonMix — Windows First Sound / Hardware FAT -Date: 1 November 2026. Current production: **10 input channels + 4 AUX**, one JUCE callback, MAIN/MONITOR and native VST3. The experimental dynamic CH11/Group engine has **not** replaced the production callback. The outstanding 0FX hardware crackle issue is #15. This is a FAT **candidate**, not hardware certified or guaranteed zero physical latency. +Date: 1 November 2026. M1 hardware candidate addendum: 2 November 2026. Current production: **10 input channels + 4 AUX**, one JUCE callback, MAIN/MONITOR and native VST3. The experimental dynamic CH11/Group engine has **not** replaced the production callback. The outstanding 0FX hardware crackle issue is #15. This is a FAT **candidate**, not hardware certified or guaranteed zero physical latency. ## 1. Verify package Extract the complete Windows Actions ZIP to a writable folder. `BUILD_PROVENANCE.json` must show the same `sourceCommit` as the GitHub run; EXE SHA-256 must equal `exeSha256`. Keep `portable_mode.txt`, never delete an existing `Studio` workspace. The file is a Windows x64 JUCE GUI executable; Microsoft Edge WebView2 Runtime and the correct audio hardware driver are required. @@ -28,3 +28,23 @@ Send: (a) screenshot of active driver/rate/buffer/pins, (b) accepted CH01 patch **PASS is hardware-grounded:** correct MAIN source path, verified mute/fader control, no wrong-endpoint output, clean 0FX wired audio for >=30 minutes on the recorded device/rate/buffer, followed by real plugin testing. A green Windows CTest/Chromium CI is not a substitute. Historical full test matrix remains `docs/HARDWARE_FAT_GUI10_ENGINE_P012_20261027.md`. This packaged guide supersedes obsolete manual START AUDIO instructions. + +## 5. M1 candidate — structured physical acceptance (not an M5 universal graph) + +The **ArSonMix-M1-EXPERIMENTAL-Hardware-FAT-Windows-x64** workflow artifact is uploaded only if the exact PR SHA completes Windows compile, all CTests, packaging and ZIP/embedded-GUI SHA256 verification. A PR artifact is not a public stable release. The EXE preserves the existing **native M4 10CH + 4AUX** callback, not a live CH11/group universal engine. DO NOT apply an unqualified artifact on a live public-performance show. + +One real device, one verified I/O clock, wired monitoring, LOW output gain and initially **0 VST3**. Start at a supported buffer of 256 samples, then 128 and 64 only after the earlier stage has passed; document actual negotiated values, don't assume the driver honored the request. For each supported buffer: + +| Native check | Operator action and expected physical result | Hard fail / retain evidence | +|---|---|---| +| Unpatched startup | Launch without input patch; MAIN stays silent and unarmed | Any unexpected output/audio or wrong endpoint | +| Device isolation | Select real active ASIO or WASAPI endpoint; verify L/R physical pins, rate and epoch | Invalid pins, auto re-arm on hotplug, unexpected fallback | +| Real 0FX | Patch CH01 mic/line input, explicitly ARM; record 30-minute continuous wired output | Pops/crackle: Mark Crackle and Copy Full Report | +| Short-buffer gain | Move CH01 fader repeatedly and reverse while moving; listen for clicks, watch true meters | Zipper clicks, freezes, inconsistent physical gain | +| AUX gain/edge | Connect a validated SEND to AUX; change send and AUX return levels with effects bypassed | Silence despite accepted change, stale/reverted controls, double direct signal | +| Monitor isolation | If a separate hardware pair exists, enable MONITOR intentionally | MONITOR leaking to MAIN or shared hardware pair | +| Vendor/plugin | Only after 0FX clean, insert real VST3 and toggle bypass/editor | Stuck UI, plugin recreation, audio gap, FX state loss | +| Show lifecycle | Save and recall same route/plugin states, check output is never armed implicitly | Stale device epoch, missing FX, corrupt restoration | +| Safe shutdown | Stop/restart and unplug/replug device, reselect/ARM deliberately | Audio on unexpected pins, leaked resource or crash | + +**Required evidence**: download artifact name and exact 40-character SHA from `BUILD_PROVENANCE.json`; SHA256 of installed EXE; physical device name/driver/rate/buffer and enabled port mapping; 0FX duration; crackle report if any; one short video or screenshots demonstrating CH01, AUX, MONITOR and Show. The test passes only for the exact device and configuration tested, and never proves every VST3 or absolute crash-proof operation. diff --git a/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md index 8ba3ac0f2..17f836666 100644 --- a/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md +++ b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md @@ -12,3 +12,10 @@ The existing `RealtimeRoutePublisher` owns bounded retirement. New tests hold a ## Worker payload lifetime hardening `NativeShowSaveWorker` validates Show IDs before reserving, releases snapshot/blob/closure memory immediately on start failure, and moves the completion closure rather than retaining a second copy after IO completion. The long-lived worker is reused; no new OS thread or realtime allocation has been introduced. Windows JUCE compilation and runtime verification are release gates. + +## Exact CI evidence and hardware artifact scope (revision 2) +Windows run `41479462759` compiled successfully but 52/54 CTests passed. The remaining two failures were analyzed and corrected together: +1. Native `setAuxSendGain` / `setAuxBusGain` is **one atomic automation plane** even without separate strip controls, as exercised by `dedicated_aux_bus_test.cpp`. The old conditional gate silenced actual physical AUX level edits. In the routing CTest, a newly built `PreparedMixerBlock` establishes fresh compiled defaults, while an already automated block retains its explicit target. +2. The graph-retirement test needed to count the rejected candidate's destructor too: 3 original accepted + 1 rejected + 1 newly accepted = **5 distinct prepared instances**. The lifetime test checks that saturation safely rejects and reader-owned graphs are not reclaimed early. + +This patch also authorizes **one** exact-branch `M1-EXPERIMENTAL` GitHub Actions artifact **only after** all CTests and package/provenance validation pass. This does not enable universal routing/CH11, promote stable release, or change hardware patch/ARM policy. The packaged FAT guide now includes explicit pass/fail cases for wired 0FX ASIO, AUX/monitor, state recall and hotplug. No parallel CI matrix or redundant always-on worker. diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 4b75cff29..0a13020e6 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -483,7 +483,7 @@ class PreparedMixerBlock final { // Once the message thread publishes a changed send target, // the SAME callback switches to one live PRE/POST processor // which follows 64-sample gains across varying block sizes. - if(live && auxAutomationActive_.load(std::memory_order_acquire)) + if(auxAutomationActive_.load(std::memory_order_acquire)) dispatchLiveAux(strip,SendTap::preFader,l,r,frames); else graph.aux.dispatch(strip,SendTap::preFader,l,r, auxLeft_.data(),auxRight_.data(),frames); @@ -557,7 +557,7 @@ class PreparedMixerBlock final { // Once the message thread publishes a changed send target, // the SAME callback switches to one live PRE/POST processor // which follows 64-sample gains across varying block sizes. - if(live && auxAutomationActive_.load(std::memory_order_acquire)) + if(auxAutomationActive_.load(std::memory_order_acquire)) dispatchLiveAux(strip,SendTap::postFader,l,r,frames); else graph.aux.dispatch(strip,SendTap::postFader,l,r, auxLeft_.data(),auxRight_.data(),frames); @@ -586,9 +586,10 @@ class PreparedMixerBlock final { // the sample-continuous 64-frame de-zipper across 4/8/16-frame // callbacks. The fader scales the return AFTER hosted AUX VST3 // for both MAIN and independent MONITOR, not source dry PCM. - // Offline/static rendering never inherits a previous live - // automation target. Native live control provides 'live'. - const bool automated=live && auxBusAutomationActive_.load( + // AUX automation is independent of channel fader/MUTE control. + // A caller may automate AUX sends/returns without supplying a + // RealtimeStripControls bank; keep one canonical DSP target plane. + const bool automated=auxBusAutomationActive_.load( std::memory_order_acquire); const float target=automated ?auxBusTarget_[b].load(std::memory_order_acquire):bus.gain; diff --git a/tests/mixer_routing_plan_test.cpp b/tests/mixer_routing_plan_test.cpp index 1a2832a8e..b8c3b120e 100644 --- a/tests/mixer_routing_plan_test.cpp +++ b/tests/mixer_routing_plan_test.cpp @@ -842,8 +842,15 @@ static void verifyRealtimeAuxMasterPcmBothOutputs() { assert(!block.setAuxBusGain(0,std::numeric_limits::quiet_NaN())); assert(close(block.auxBusGain(0),0.f)); assert(close(block.plan().aux.buses[0].gain,1.f)); // topology immutable - // Legacy offline/no-live-control path still uses immutable compiled gain. + // Explicit AUX automation remains live even without a separate strip + // controls object. It MUST NOT silently fall back to stale compiled gain + // because older physical/native paths do not always pass that object. assert(block.process(inputs,2,left.data(),right.data(),64,noFx)); + assert(close(left[0],0.f)); + // A newly prepared graph starts at its own immutable initial gain: + // structural transaction/Show recall does not leak old AUX state. + PreparedMixerBlock freshlyPrepared(graph,64); + assert(freshlyPrepared.process(inputs,2,left.data(),right.data(),64,noFx)); assert(close(left[0],initial)); } diff --git a/tests/realtime_control_test.cpp b/tests/realtime_control_test.cpp index 91b288fdb..10678cd4a 100644 --- a/tests/realtime_control_test.cpp +++ b/tests/realtime_control_test.cpp @@ -87,7 +87,9 @@ int main(){ assert(publish(4)==Result::applied); publisher.unpublish(); assert(publisher.pollRetirement()); - assert(destroyed.load(std::memory_order_relaxed)==4); + // Three accepted snapshots + one rejected admission + final fourth + // accepted snapshot: all five owners are reclaimed (no leak/double free). + assert(destroyed.load(std::memory_order_relaxed)==5); // Runtime contract for the exact RT graph publication helper. struct FakeGraph { int id; }; FakeGraph old{1}, next{2}, third{3}; From 6c0f0a54f4bcd3b737e6282db434979cd25d6852 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 04:53:10 +0700 Subject: [PATCH 057/155] refactor(engine): enforce one native render owner; retire dead stereo VST fallback --- CMakeLists.txt | 2 +- docs/ENGINE_RUNTIME_AUTHORITY_20261103.md | 57 +++++++++++++ ...M1_REALTIME_CORE_STABILIZATION_20261102.md | 3 + engine/core/NativeRenderAuthority.h | 40 ++++++++++ src/LiveAudioEngine.h | 80 +++++-------------- tests/realtime_control_test.cpp | 12 +++ 6 files changed, 135 insertions(+), 59 deletions(-) create mode 100644 docs/ENGINE_RUNTIME_AUTHORITY_20261103.md create mode 100644 engine/core/NativeRenderAuthority.h diff --git a/CMakeLists.txt b/CMakeLists.txt index c169f8269..34aa9b7bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ juce_add_gui_app(ARMixConsole juce_add_binary_data(ARMixAssets SOURCES web/index.html web/styles.css web/plugin-ui.css web/app.js web/plugin-ui.js web/bridge.js web/monitor.js web/mixer-io.js web/mixer-io.css web/mixer-layout.js web/mixer-layout.css web/assets/audio-interface.svg) -target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h src/VstOrbitController.h engine/core/MixerRoutingPlan.h engine/core/ChannelRoutingContract.h engine/core/ChannelSendPlan.h engine/core/AuxBusPlan.h engine/core/PreparedMixerBlock.h engine/core/MasterOutputMonoPolicy.h engine/core/LiveChannelFxGraph.h engine/core/PreparedNativeMixerSession.h engine/core/NativeDryRouteCommand.h engine/core/RealtimeRoutePublisher.h engine/device/LiveInputPortRegistry.h src/LiveDryRoutingLab.h engine/core/OrbitPhase.h engine/core/OrbitControlPolicy.h engine/core/OrbitMotion.h engine/core/OrbitDistanceMapping.h engine/core/DearVrPolarPolicy.h src/PluginCatalog.h src/FactoryFxRegistry.h src/PluginVault.h src/PortableWorkspace.h src/StudioBackup.h src/DiagnosticsRecorder.h src/StereoPan.h src/NativePresetArchive.h src/NativeShowSchema.h src/NativeDryShowRecall.h src/VstBusLayout.h src/LiveGraphHandoff.h src/DiagnosticTone.h engine/core/RealtimeHealthHistogram.h engine/core/CallbackCadenceEvidence.h engine/diagnostics/CrackleEvidenceWindow.h engine/device/AdaptiveClockBridge.h engine/device/AudioProfilePolicy.h engine/device/PeriodCapabilityEvidence.h engine/device/SessionLifecycle.h engine/device/WasapiCapabilityProbe.h engine/device/JuceIndependentClockDevice.h engine/device/LiveSecondaryOutputDevice.h engine/core/LiveOutputRouteGate.h engine/device/ClockBridgeSizing.h engine/device/IndependentStreamFormatFence.h engine/device/DirectRestoreBackoff.h engine/device/IndependentStreamWatchdog.h engine/device/BridgeContinuityGate.h engine/device/EndpointIdentityPolicy.h engine/device/WasapiEndpointIdentityGuard.h engine/device/AsioStartupPolicy.h engine/device/AsioPriorityDeviceManager.h engine/device/JuceActivePortSnapshot.h engine/device/AsioRegistrationPolicy.h engine/device/AsioRegistryIdentityProbe.h engine/device/DirectRouteFence.h) +target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h src/VstOrbitController.h engine/core/MixerRoutingPlan.h engine/core/ChannelRoutingContract.h engine/core/ChannelSendPlan.h engine/core/AuxBusPlan.h engine/core/PreparedMixerBlock.h engine/core/MasterOutputMonoPolicy.h engine/core/LiveChannelFxGraph.h engine/core/NativeDryRouteCommand.h engine/core/RealtimeRoutePublisher.h engine/device/LiveInputPortRegistry.h src/LiveDryRoutingLab.h engine/core/OrbitPhase.h engine/core/OrbitControlPolicy.h engine/core/OrbitMotion.h engine/core/OrbitDistanceMapping.h engine/core/DearVrPolarPolicy.h src/PluginCatalog.h src/FactoryFxRegistry.h src/PluginVault.h src/PortableWorkspace.h src/StudioBackup.h src/DiagnosticsRecorder.h src/StereoPan.h src/NativePresetArchive.h src/NativeShowSchema.h src/NativeDryShowRecall.h src/VstBusLayout.h src/LiveGraphHandoff.h src/DiagnosticTone.h engine/core/RealtimeHealthHistogram.h engine/core/CallbackCadenceEvidence.h engine/diagnostics/CrackleEvidenceWindow.h engine/device/AdaptiveClockBridge.h engine/device/AudioProfilePolicy.h engine/device/PeriodCapabilityEvidence.h engine/device/SessionLifecycle.h engine/device/WasapiCapabilityProbe.h engine/device/JuceIndependentClockDevice.h engine/device/LiveSecondaryOutputDevice.h engine/core/LiveOutputRouteGate.h engine/core/NativeRenderAuthority.h engine/device/ClockBridgeSizing.h engine/device/IndependentStreamFormatFence.h engine/device/DirectRestoreBackoff.h engine/device/IndependentStreamWatchdog.h engine/device/BridgeContinuityGate.h engine/device/EndpointIdentityPolicy.h engine/device/WasapiEndpointIdentityGuard.h engine/device/AsioStartupPolicy.h engine/device/AsioPriorityDeviceManager.h engine/device/JuceActivePortSnapshot.h engine/device/AsioRegistrationPolicy.h engine/device/AsioRegistryIdentityProbe.h engine/device/DirectRouteFence.h) target_compile_definitions(ARMixConsole PRIVATE JUCE_WEB_BROWSER=1 JUCE_USE_WIN_WEBVIEW2=1 diff --git a/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md b/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md new file mode 100644 index 000000000..316ed961e --- /dev/null +++ b/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md @@ -0,0 +1,57 @@ +# ArSonMix — ONE production engine, GUI-directed ownership +Date: 2026-11-03. Status: **binding engine ownership map** (code-enforced for existing M4 callback, NOT universal live certification). + +## Only one runtime authority + +```text +PR #278 + #285 approved GUI workflow (reference only, not audio) + | +PR #271 web native renderer → ConsoleLiveBridgeV6 snapshot/intent/ACK + | + Native JUCE LiveAudioEngine + | + NativeRenderAuthority (one selector) + | | | + UNPATCHED ACCEPTED M4 DIAGNOSTIC + silence one real mixer test-only 0FX + | + LiveDryRoutingLab + LiveChannelFxGraph + PreparedMixerBlock + | + existing CH1 original VST/Orbit lease + AUX / MAIN / MONITOR + | + actual verified device pins +``` + +The `NativeRenderAuthority` is an explicit, fixed-cost callback selector. **There is no second simultaneously running mixer.** The former standalone stereo plugin dispatch inside the diagnostic-only remainder was unreachable and is deleted, not hidden behind another flag. An unpatched NORMAL route stays silent and cannot silently fall back to stereo CH1. + +## What is active, what is migration-only, what is test-only + +| Ownership | Modules | Decision | +| --- | --- | --- | +| **PRODUCTION, temporary compatibility** | `src/LiveAudioEngine.h`, `src/LiveDryRoutingLab.h`, `engine/core/LiveChannelFxGraph.h`, `engine/core/PreparedMixerBlock.h`, native CH1 VST/Orbit lease | KEEP until truly equivalent unified render; bugfixes only, no new competing features | +| **Future canonical ChannelId engine (prepared, not yet production)** | `DynamicChannelRoster`, `DynamicPreparedMixerBlock`, `DynamicNativeSessionPublisher`, `DynamicChannelFxLeaseBank`, `UnifiedLegacyProductionAdmission`, `DynamicAcceptedSession` | KEEP as one migration target; **do not attach as a second callback** or advertise LIVE | +| **Compatibility translation** | `LegacyLiveGraphMigration`, accepted device epoch / actual port pin mapping | KEEP until cutover with exact PCM, VST/editor and Show parity; then retire in one controlled transaction | +| **Testing-only** | `PreparedNativeMixerSession.h`, dedicated offline dynamic test targets | No longer list testing-only session as shipped `ARMixConsole` source; keep its separate CTest target | +| **Diagnostics, no effect graph** | old stereo scratch path in `LiveAudioEngine`, diagnostic tone/capture, health and 0FX evidence | KEEP isolated with NO vendor plugin processing and NO production fallback | +| **Single non-RT worker** | `NativeShowSaveWorker` | KEEP Show I/O on worker, not on callback; no extra per-channel/per-plugin worker | + +## Stop rules — prevents return of mixed engines + +1. The approved reference GUI is the *workflow authority*. Native accepted snapshots, stable ChannelIds, real device pins and ACK remain the *data/PCM authority*. Never let JS or a browser mock own audio routing or create fake FX. +2. There is **one** `audioDeviceIOCallbackWithContext` production entry point and **one** selected render owner at any time. Do not run M4 and dynamic PCM, or duplicate native vendor VST3 instances. +3. New channels, Group, FX Return and WIRE must go into the **universal ChannelId graph**. No new business feature is allowed to extend fixed 10CH/M4 design, except fixes for actual physical audio reliability. +4. Freeze old plugin-feature experiments; preserve external #15 0FX crackle evidence and driver safety research (including draft #251). No destructive deletion or premature PR closure while hardware equivalence is unknown. +5. When universal graph passes real M4 migration/production gates, **remove** M4 callback selection, ordinal-as-identity adapters and legacy CH1 special cases in the **same integration PR**. The real diagnostic tone/capture remains a separate legitimate service, not a mixer. +6. Integration #270 alone certifies exact combined GUI/native SHA, Windows CTest/Chromium, VST/editor/Show parity and measured physical audio. Do not mark GUI as LIVE from screenshots or offline data. + +## Decommission gates (NOT met yet) + +- Real 10CH + 4AUX, MAIN/MONITOR, CH1 original vendor/Orbit/editor and Show state are rendered by the same accepted ChannelId graph. +- Normal continuous fader/MUTE/SOLO/SEND controls remain audible without mandatory device restart; no lost plugin tail or duplicated dry output. +- Native ACK/epoch/revision, output disarm/rearm and physical sparse port map are verified. +- Windows exact-SHA build/CTest and physical ASIO/WASAPI 0FX + 1FX FAT pass. + +**Result:** no obsolete active stereo plugin engine remains available from the diagnostic fallback; current M4 compatibility is intentionally quarantined and will be retired only when the unified engine demonstrably replaces it. diff --git a/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md index 17f836666..510d1ed01 100644 --- a/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md +++ b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md @@ -19,3 +19,6 @@ Windows run `41479462759` compiled successfully but 52/54 CTests passed. The rem 2. The graph-retirement test needed to count the rejected candidate's destructor too: 3 original accepted + 1 rejected + 1 newly accepted = **5 distinct prepared instances**. The lifetime test checks that saturation safely rejects and reader-owned graphs are not reclaimed early. This patch also authorizes **one** exact-branch `M1-EXPERIMENTAL` GitHub Actions artifact **only after** all CTests and package/provenance validation pass. This does not enable universal routing/CH11, promote stable release, or change hardware patch/ARM policy. The packaged FAT guide now includes explicit pass/fail cases for wired 0FX ASIO, AUX/monitor, state recall and hotplug. No parallel CI matrix or redundant always-on worker. + +## 2026-11-03 single production authority cleanup +Real-time callback now routes through the explicit `NativeRenderAuthority` decision. The no-longer-reachable legacy stereo FX processing code has been removed from the diagnostic-only path; this does not change accepted 10CH/4AUX production routing. `PreparedNativeMixerSession.h` remains tested but is no longer listed in the shipping GUI application target. See `docs/ENGINE_RUNTIME_AUTHORITY_20261103.md` for the decommission map and strict migration gates. diff --git a/engine/core/NativeRenderAuthority.h b/engine/core/NativeRenderAuthority.h new file mode 100644 index 000000000..03d81b64b --- /dev/null +++ b/engine/core/NativeRenderAuthority.h @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include + +// Production render ownership, never an audio engine or a second callback. +// The approved GUI can project ONE native engine. Until the full ChannelId +// VST/editor/Show cutover is admitted, only the existing M4 route owns PCM. +// The legacy stereo path is diagnostic-only, never a hidden fallback. +namespace armix::mixer { +enum class NativeRenderOwner : std::uint8_t { + failSilentUnpatched, + acceptedM4Session, + isolatedDiagnostic +}; + +struct NativeRenderAuthority final { + static constexpr NativeRenderOwner select( + bool normalAudio, bool m4SessionActive) noexcept { + // A verified accepted M4 route always owns the callback: a diagnostic + // mode must never start processing a second stereo FX chain over it. + if(m4SessionActive)return NativeRenderOwner::acceptedM4Session; + if(normalAudio)return NativeRenderOwner::failSilentUnpatched; + return NativeRenderOwner::isolatedDiagnostic; + } + static constexpr bool isProduction(NativeRenderOwner owner) noexcept { + return owner==NativeRenderOwner::acceptedM4Session; + } + static constexpr bool mayRunDiagnostic(NativeRenderOwner owner) noexcept { + return owner==NativeRenderOwner::isolatedDiagnostic; + } +}; +static_assert(NativeRenderAuthority::select(true,false)== + NativeRenderOwner::failSilentUnpatched); +static_assert(NativeRenderAuthority::select(true,true)== + NativeRenderOwner::acceptedM4Session); +static_assert(NativeRenderAuthority::select(false,true)== + NativeRenderOwner::acceptedM4Session); +static_assert(NativeRenderAuthority::select(false,false)== + NativeRenderOwner::isolatedDiagnostic); +} // namespace armix::mixer diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index bfade45ca..9c9aae5c0 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -12,6 +12,7 @@ #include "../engine/device/JuceIndependentClockDevice.h" #include "../engine/device/LiveSecondaryOutputDevice.h" #include "../engine/core/LiveOutputRouteGate.h" +#include "../engine/core/NativeRenderAuthority.h" #include "../engine/device/AsioPriorityDeviceManager.h" #include "../engine/device/AsioRegistryIdentityProbe.h" #include "../engine/device/DirectRouteFence.h" @@ -1751,6 +1752,13 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback std::memory_order_relaxed); return; } + // ONE explicit owner for the whole device callback. The GUI cannot + // select an experimental ChannelId renderer or revive stereo CH1. + // Cutover to universal will replace this authority transaction only + // after the full VST3/Show/epoch proof, never add a parallel callback. + const auto renderOwner=armix::mixer::NativeRenderAuthority::select( + activeDiagnosticRoute==armix::diagnostics::Route::normal, + dryRoutingLab_.active()); const auto cycle = handoff_.beginCycle(); // R0B B3: production NORMAL audio has a single native routing owner. // Until a device-epoch-validated 10CH/4AUX route is published, output @@ -1761,8 +1769,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback // Keep the existing FX graph handoff progressing even when unpatched: // a staged ADD/REMOVE must ACK and retire on the callback thread. // Only atomic reads and deterministic output writes; no RT heap or I/O. - if (activeDiagnosticRoute == armix::diagnostics::Route::normal - && !dryRoutingLab_.active()) + if (renderOwner == + armix::mixer::NativeRenderOwner::failSilentUnpatched) { // P0: SILENT output must not mean blind capture diagnostics. // A verified ASIO/WASAPI callback can carry PCM before any @@ -1817,7 +1825,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback // action, with an immutable preallocated P1D graph. Its own zero-VST // callback path NEVER falls through to CH1 on stale/hotplug routes. // DirectFence was already checked above; no output to unknown device. - if (dryRoutingLab_.active()) + if (renderOwner == + armix::mixer::NativeRenderOwner::acceptedM4Session) { const auto outputGate=armix::mixer::LiveOutputRouteGate::evaluate( dryRoutingLab_.active(), @@ -1938,13 +1947,16 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback juce::FloatVectorOperations::clear(outputs[channel],samples); return; } + // The only remaining stereo renderer is DIAGNOSTIC. It may emit + // a bounded test tone or test capture but never host channel VST3 + // or become a fallback production mixer. + jassert(armix::mixer::NativeRenderAuthority::mayRunDiagnostic( + renderOwner)); const bool enabled = monitor_.load (std::memory_order_relaxed) && !routeReconfiguring_.load (std::memory_order_acquire); const auto route = diagnosticRoute_.load (std::memory_order_relaxed); const bool toneTest = route == armix::diagnostics::Route::outputOnlyTone; const bool captureTest = route == armix::diagnostics::Route::captureOnly; - const bool dry = dryTest_.load (std::memory_order_relaxed) - || route != armix::diagnostics::Route::normal; if (toneTest && outputChannels > 0) testOutputFrames_.fetch_add (static_cast (samples), std::memory_order_relaxed); if (captureTest && inputChannels > 0) @@ -1974,10 +1986,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback { const int frames = juce::jmin (maxFrames, samples - offset); // Preallocated backing store: no resizing/capacity bookkeeping in RT. - // Two-channel AudioBuffer view refers to scratch_ without ownership. - // JUCE uses its inline channel pointer storage for two channels. - juce::AudioBuffer scratchView ( - scratch_.getArrayOfWritePointers(), 2, frames); + // Test-only stereo buffers are preallocated. There is no VST + // buffer view or plugin dispatch in the diagnostic-only path. if (toneTest) { auto* left = scratch_.getWritePointer (0); @@ -2001,55 +2011,9 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback for (int i = 0; i < frames; ++i) if (!toneTest) inPeak = juce::jmax (inPeak, std::abs (dst[i])); } - // MIDI capacity is empty unless the plugin itself changes it. - juce::MidiBuffer midi; - if (!dry) - { - // One atomic order snapshot per block: stable physical FX and bypass identity. - const auto order = cycle.graph->orderPacked.load (std::memory_order_acquire); - for (int fx = 0; fx < cycle.graph->count; ++fx) - { - const int physical = Graph::physicalAt (order, fx); - auto& slot = cycle.graph->slots[physical]; - if (!slot.processor) {midi.clear();continue;} - auto& bypass=cycle.graph->bypassEnvelope[physical]; - bypass.request(cycle.graph->bypassFlags[physical].load(std::memory_order_acquire)); - // Steady wet/dry requires no copy or extra arithmetic. - // A transition temporarily snapshots the exact input to - // this insert; a second full FX graph is never created. - const bool blend=bypass.transitioning(); - if (blend) - for(int ch=0;ch<2;++ch) - juce::FloatVectorOperations::copy( - dryScratch_.getWritePointer(ch), - scratch_.getReadPointer(ch),frames); - if (bypass.shouldProcessWet()) - { - const auto pluginBeginUs = clockMicros(); - slot.processor->processBlock (scratchView, midi); - const auto pluginUs = clockMicros() - pluginBeginUs; - lastPluginUsBySlot_[physical].store (pluginUs, std::memory_order_relaxed); - publishMax (worstPluginUsBySlot_[physical], pluginUs); - publishMax (worstPluginUs_, pluginUs); - if (static_cast (pluginUs) > periodUs * 0.75) - slowPlugins_.fetch_add (1, std::memory_order_relaxed); - } - if (blend) - { - float* wetL=scratch_.getWritePointer(0); - float* wetR=scratch_.getWritePointer(1); - const float* dryL=dryScratch_.getReadPointer(0); - const float* dryR=dryScratch_.getReadPointer(1); - for(int i=0;i #include #ifdef NDEBUG @@ -14,6 +15,17 @@ #include using namespace armix::rt; int main(){ + // Production cannot fall through to a second stereo/VST mixer. The + // only old stereo path is explicitly test/diagnostic and disconnected + // from an accepted native M4 route. + using Owner=armix::mixer::NativeRenderOwner; + using Authority=armix::mixer::NativeRenderAuthority; + assert(Authority::select(true,false)==Owner::failSilentUnpatched); + assert(Authority::select(true,true)==Owner::acceptedM4Session); + assert(Authority::select(false,true)==Owner::acceptedM4Session); + assert(Authority::select(false,false)==Owner::isolatedDiagnostic); + assert(!Authority::mayRunDiagnostic( + Authority::select(false,true))); SpscQueue q; int value=-1; assert(!q.tryPop(value)); From 388785c595f2ad7d898b8956a24e2f9e6dbbd5e4 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 04:54:42 +0700 Subject: [PATCH 058/155] test(contracts): follow single render authority; reject diagnostic VST fallback --- tests/live_graph_contract_test.mjs | 25 +++++++++++++++++++++---- tests/live_routing_ui_contract_test.mjs | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/tests/live_graph_contract_test.mjs b/tests/live_graph_contract_test.mjs index 594c641cf..87bf43246 100644 --- a/tests/live_graph_contract_test.mjs +++ b/tests/live_graph_contract_test.mjs @@ -28,6 +28,22 @@ test('preset UI reflects callback-acknowledged state not queued state',()=>{ assert.match(m,/arMixNativePresetLoaded/); assert.match(b,/RECALL LIVE/); }); +test('single engine production selection forbids old VST processing in diagnostic fallback',()=>{ + const authority=readFileSync(new URL('../engine/core/NativeRenderAuthority.h',import.meta.url),'utf8'); + assert.match(authority,/enum class NativeRenderOwner/); + assert.match(authority,/failSilentUnpatched/); + assert.match(authority,/acceptedM4Session/); + assert.match(authority,/isolatedDiagnostic/); + assert.match(e,/NativeRenderAuthority::select\(/); + assert.match(e,/NativeRenderOwner::acceptedM4Session/); + const start=e.indexOf('// The only remaining stereo renderer is DIAGNOSTIC'); + const end=e.indexOf('const auto elapsedUs = clockMicros() - beginUs',start); + assert.ok(start>0 && end>start,'explicit diagnostic-only tail must exist'); + const fallback=e.slice(start,end); + assert.doesNotMatch(fallback,/processor->processBlock|MidiBuffer midi|make_unique|make_shared/, + 'no second legacy stereo FX chain may be executed from diagnostics'); +}); + test('ADD/REMOVE remain guarded while MOVE publishes physical-slot order',()=>{ assert.match(e,/fxMovePhase_\.load/); assert.match(e,/FxOrderPlan::moved/); @@ -52,7 +68,7 @@ test('R0B CH1 MOVE inside routed 10CH graph uses the same callback-boundary de-c assert.match(move,/FxOrderPlan::moved/); assert.match(move,/fxMovePendingOrder_\.store/); assert.doesNotMatch(move,/detach\(|attach\(|prepareToPlay|releaseResources/); - const begin=e.indexOf('if (dryRoutingLab_.active())',e.indexOf('callbackCount_.fetch_add')); + const begin=e.indexOf('if (renderOwner ==',e.indexOf('callbackCount_.fetch_add')); const end=e.indexOf('const bool enabled = monitor_',begin); const routed=e.slice(begin,end); assert.match(routed,/FxMoveRamp::gain\(\s*routedFxMove,i,samples\)/); @@ -79,7 +95,7 @@ test('R0B major milestone: ADD and REMOVE are prepared control-thread transactio assert.match(e,/ownPlugin\s*\(/); assert.match(e,/old\.reset\(\); \/\/ Vendor cleanup only on final CONTROL-owned reference/); assert.match(e,/handoff_\.stage\(stagedOwner_\.get\(\)\)/); - const callback=e.slice(e.indexOf('if (dryRoutingLab_.active())',e.indexOf('callbackCount_.fetch_add')), + const callback=e.slice(e.indexOf('if (renderOwner ==',e.indexOf('callbackCount_.fetch_add')), e.indexOf('const bool enabled = monitor_',e.indexOf('callbackCount_.fetch_add'))); assert.match(callback,/handoff_\.endCycle\(cycle\)/); assert.match(callback,/cycle\.fadeOut/); @@ -103,13 +119,14 @@ test('R0B B3 NORMAL output is fail-silent while FX graph retirement still progre const beginning=e.indexOf('void audioDeviceIOCallbackWithContext'); const fence=e.indexOf('if (!independent_.active()',beginning); const lease=e.indexOf('const auto cycle = handoff_.beginCycle()',beginning); - const failSilent=e.indexOf('if (activeDiagnosticRoute == armix::diagnostics::Route::normal',beginning); + const failSilent=e.indexOf('if (renderOwner ==',lease); const callbackMetrics=e.indexOf('const std::uint64_t beginUs = clockMicros()',beginning); assert.ok(beginning>=0 && fence>beginning && lease>fence && failSilent>lease && callbackMetrics>failSilent, 'DIRECT fence first, then FX cycle lease, then fail-silent native gate'); const gate=e.slice(failSilent,callbackMetrics); - assert.match(gate,/!dryRoutingLab_\.active\(\)/); + assert.match(e,/NativeRenderAuthority::select\(/); + assert.match(gate,/NativeRenderOwner::failSilentUnpatched/); assert.match(gate,/FloatVectorOperations::clear\(outputs\[c\], samples\)/); assert.match(gate,/outputPeakL_\.store\(0\.f/); assert.match(gate,/handoff_\.endCycle\(cycle\)/, diff --git a/tests/live_routing_ui_contract_test.mjs b/tests/live_routing_ui_contract_test.mjs index 7e3f9ac05..454b8e8e9 100644 --- a/tests/live_routing_ui_contract_test.mjs +++ b/tests/live_routing_ui_contract_test.mjs @@ -46,7 +46,7 @@ test("GUI exposes only truthful dry device routes and acknowledged commit",()=>{ }); test("STOP-race is fail closed: all outputs are written to silence without CH1 fallback",()=>{ - const enter=engine.indexOf("if (dryRoutingLab_.active())",engine.indexOf("callbackCount_.fetch_add")); + const enter=engine.indexOf("if (renderOwner ==",engine.indexOf("callbackCount_.fetch_add")); // Bound the entire routed branch by the first statement of the legacy // fallback, not by an informational comment that can change at each R0B slice. const end=engine.indexOf("const bool enabled = monitor_",enter); From 1e21bf0a0d8aff33b02b56cec5c2e5c328fd41d1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 04:55:54 +0700 Subject: [PATCH 059/155] test(engine): enforce CH1 leased FX and FX-free diagnostics after legacy retirement --- tests/live_graph_contract_test.mjs | 13 +++++++++---- tests/p0_diagnostic_contract_test.mjs | 7 ++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/live_graph_contract_test.mjs b/tests/live_graph_contract_test.mjs index 87bf43246..281dc9784 100644 --- a/tests/live_graph_contract_test.mjs +++ b/tests/live_graph_contract_test.mjs @@ -54,11 +54,16 @@ test('ADD/REMOVE remain guarded while MOVE publishes physical-slot order',()=>{ test('bypass is sample-smoothed on audio callback without control-thread CPU work',()=>{ assert.match(e,/bypassEnvelope/); - assert.match(e,/bypass\.request\(cycle\.graph->bypassFlags/); - assert.match(e,/bypass\.transitioning\(\)/); + const start=e.indexOf('static void processLegacyChannelOne('); + const end=e.indexOf('void audioDeviceIOCallbackWithContext',start); + assert.ok(start>=0&&end>start,'the accepted M4 CH1 owner must still exist'); + const leaseFx=e.slice(start,end); + assert.match(leaseFx,/bypass\.request\(graph->bypassFlags/); + assert.match(leaseFx,/slot\.processor->processBlock\(buffer,midi\)/); + assert.match(leaseFx,/bypass\.transitioning\(\)/); assert.match(e,/dryScratch_\.setSize \(2, maxFrames/); - assert.match(e,/bypass\.next\(\)/); - assert.match(e,/bypass\.shouldProcessWet\(\)/); + assert.match(leaseFx,/bypass\.next\(\)/); + assert.match(leaseFx,/bypass\.shouldProcessWet\(\)/); assert.doesNotMatch(e.slice(e.indexOf('bool setBypass'),e.indexOf('bool removeAt')),/detach\(|prepareToPlay|releaseResources/); }); diff --git a/tests/p0_diagnostic_contract_test.mjs b/tests/p0_diagnostic_contract_test.mjs index 417ebd0a8..f44fd5a20 100644 --- a/tests/p0_diagnostic_contract_test.mjs +++ b/tests/p0_diagnostic_contract_test.mjs @@ -27,7 +27,12 @@ test('audio callback isolates low-amplitude oscillator from input and VST3',()=> assert.match(engine,/const bool captureTest = route == armix::diagnostics::Route::captureOnly/); assert.match(engine,/diagnosticTone_\.next \(audible\)/); assert.match(engine,/if \(!toneTest\)/); - assert.match(engine,/if \(!dry\)/); + const start=engine.indexOf('// The only remaining stereo renderer is DIAGNOSTIC'); + const end=engine.indexOf('const auto elapsedUs = clockMicros() - beginUs',start); + assert.ok(start>0&&end>start,'isolated diagnostics must have an explicit owner'); + assert.doesNotMatch(engine.slice(start,end), + /processor->processBlock|MidiBuffer midi/, + 'test tone and capture-only must never enter a legacy VST processor'); assert.match(osc,/0\.0316227766/); assert.doesNotMatch(osc,/new |malloc\(|std::vector|mutex|lock_guard|fwrite\(/); assert.match(build,/P0DiagnosticTone/); From c8d2e3fd1a86501e604b4fad354eb7c399c90393 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 05:07:59 +0700 Subject: [PATCH 060/155] refactor(engine): fold M1 into sole #266 owner and gate one-callback architecture before JUCE --- .github/workflows/p1-windows.yml | 11 +-- docs/ENGINE_RUNTIME_AUTHORITY_20261103.md | 3 + ...M1_REALTIME_CORE_STABILIZATION_20261102.md | 3 + .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 56 +++++++++++ tests/engine_runtime_reconciliation_test.mjs | 99 +++++++++++++++++++ 5 files changed, 166 insertions(+), 6 deletions(-) create mode 100644 docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md create mode 100644 tests/engine_runtime_reconciliation_test.mjs diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 266baddc7..b6a3aeb4b 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -58,7 +58,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Cheap canonical Console v6 puzzle socket gate (no JUCE) - run: node scripts/check_console_puzzle.mjs + run: |\n node --test tests/engine_runtime_reconciliation_test.mjs\n node scripts/check_console_puzzle.mjs - name: Stop incomplete integrated product promotion before JUCE checkout if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-') }} run: node scripts/check_console_puzzle.mjs --release @@ -137,13 +137,12 @@ jobs: & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # PRs compile/CTest/package but never silently publish a stable build. - # Only explicitly named hardware-FAT candidate PRs may upload an - # UNQUALIFIED test artifact. It is never a public/stable release. - # No extra build matrix and no upload when CTest/package audit fails. + # This single M4 FAT branch is explicitly allowed to upload an + # UNQUALIFIED experimental ZIP for real physical hardware testing. - uses: actions/upload-artifact@v4 - if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'work/m1-realtime-stability-20261102' }} + if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' }} with: - name: ${{ github.event_name == 'pull_request' && (github.head_ref == 'work/m1-realtime-stability-20261102' && 'ArSonMix-M1-EXPERIMENTAL-Hardware-FAT-Windows-x64' || 'ArSonMix-M4-EXPERIMENTAL-Hardware-FAT-Windows-x64') || 'ArSonMix-GUI10CH-P012-Verified-Hardware-FAT-Windows-x64' }} + name: ${{ github.event_name == 'pull_request' && 'ArSonMix-M4-EXPERIMENTAL-Hardware-FAT-Windows-x64' || 'ArSonMix-GUI10CH-P012-Verified-Hardware-FAT-Windows-x64' }} path: dist/ if-no-files-found: error retention-days: 14 diff --git a/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md b/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md index 316ed961e..ba2bb75e4 100644 --- a/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md +++ b/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md @@ -55,3 +55,6 @@ The `NativeRenderAuthority` is an explicit, fixed-cost callback selector. **Ther - Windows exact-SHA build/CTest and physical ASIO/WASAPI 0FX + 1FX FAT pass. **Result:** no obsolete active stereo plugin engine remains available from the diagnostic fallback; current M4 compatibility is intentionally quarantined and will be retired only when the unified engine demonstrably replaces it. + +## Reconciliation notice (2026-11-03) +ENGINE #266 is now the sole source branch after folding former #287. Cross-branch ownership, upstream drift, CI authority gate and the next real callback cutover are documented in [ENGINE_SINGLE_OWNER_HANDOFF_20261103.md](workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md). The M1 experimental ZIP policy is historical; do not make another branch-specific Windows FAT producer without #270 integration ownership. diff --git a/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md index 510d1ed01..d21b30f21 100644 --- a/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md +++ b/docs/M1_REALTIME_CORE_STABILIZATION_20261102.md @@ -22,3 +22,6 @@ This patch also authorizes **one** exact-branch `M1-EXPERIMENTAL` GitHub Actions ## 2026-11-03 single production authority cleanup Real-time callback now routes through the explicit `NativeRenderAuthority` decision. The no-longer-reachable legacy stereo FX processing code has been removed from the diagnostic-only path; this does not change accepted 10CH/4AUX production routing. `PreparedNativeMixerSession.h` remains tested but is no longer listed in the shipping GUI application target. See `docs/ENGINE_RUNTIME_AUTHORITY_20261103.md` for the decommission map and strict migration gates. + +## Ownership reconciliation — 2026-11-03 +M1 stabilization is folded into **ENGINE #266**; PR #287 is retired to avoid parallel production engine branches. Its existing Windows M1 experimental FAT artifact remains historical, NOT a universal UAT release. Future exact joined Windows artifact and UAT promotion are owned by integration #270. See `docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md`. diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md new file mode 100644 index 000000000..1b49aae44 --- /dev/null +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -0,0 +1,56 @@ +# ArSonMix ENGINE — One Owner Reconciliation / Next Work Handoff +Date: 2026-11-03. **ENGINE workstream only**, binding on the #266 implementation branch. + +## Reconciled branch ownership (avoid two parallel engines) + +| Scope | Single owner | Allowed work | +|---|---|---| +| Native ENGINE | **PR #266** `milestone/m5-universal-channelid-vst3-lease-migration-20261101` | ONE `LiveAudioEngine` callback, full-fidelity M4→ChannelId retirement, VST3 instance/editor/Show ownership, native FX/CPU/memory, device/epoch | +| M1 stabilization | Former **PR #287**, absorbed as FAST-FORWARD ancestors of #266; close #287 after verification | No independent engine feature branch. The 64-sample fader, AUX parity, bounded graph retirement, Show worker lifetime, removal of dead diagnostic FX must stay in #266 | +| GUI production adapter | PR #271 | WebView renderer consumes **accepted** snapshot/ACK, never owns PCM | +| GUI reference | PR #278 + #285 | Visual and WIRE workflow only; no browser FX or duplicate JS graph may be merged into DSP | +| Final integration and physical FAT | PR #270 / issue #192; physical crackle issue #15 | One joined Windows exact-SHA artifact, real hardware tests. Not an ENGINE branch | + +**Important:** At reconciliation, comparison of `main@1859fa147b360e607b29a8eba636af33288a3a36` with ENGINE #287 `1e21bf0a0d8aff33b02b56cec5c2e5c328fd41d1` was **diverged** (78 commits missing from ENGINE's source history, 62 ENGINE-side commits). This is a warning, not a merge resolution. Refresh main and reconcile line-by-line against existing native behavior before production merge. Do not overwrite 78 upstream changes with a branch checkout or careless `git reset`. + +## Single native render truth NOW + +```text +Approved GUI workflow (#278/#285) → native GUI (#271) + → ConsoleLiveBridgeV6: schemaVersion=6, canonical decimal ChannelIds, + unique requestId, accepted snapshot/ACK and truthful capability flags + → Native JUCE LiveAudioEngine (ONE production callback) + ├─ NORMAL, unpatched → SILENT (no hidden CH1) + ├─ accepted M4 → LiveDryRoutingLab + original CH1 vendor/Orbit lease + │ + 10 input + 4 AUX + MAIN/MONITOR (real PCM) + └─ diagnostic mode (no M4 owner) → isolated 0FX test tone/capture + × DynamicChannelRoster/FX/Publisher: prepared/offline only, NOT currently live +``` + +Do not confuse multiple **types** in the tree with multiple **active** engines: their runtime entry point and ownership decide whether they are a problem. `PreparedNativeMixerSession` is testing-only; `NativeShowSaveWorker` is I/O, not a render worker. Legacy M4 render path is a deliberately **quarantined compatibility implementation**, not an approved target for new GUI features. + +## CLEAN / FROZEN / RETIRE inventory + +- **CLEAN NOW**: old diagnostic stereo VST graph removed; one explicit `NativeRenderAuthority` selector; separate test-only source registration; M1 live AUX/fader, bounded retirement, worker resource release tests. +- **FROZEN**: M4 fixed ordinal 10CH+4AUX may only receive production bug/safety fixes (driver, crackle, VST/Show regressions). Do not implement CH11, Group, new FX Return or WIRE semantics as another M4 feature. +- **PRESERVE**: CH1 original prepared VST3/Orbit/editor/Show, other strip/aux FX, independent MONITOR, AUX PRE/POST, sparse device port maps, direct route fence, mute and diagnostic capture evidence. Do not delete before parity. +- **UNADMITTED**: dynamic ChannelId graph, `UnifiedLegacyProductionAdmission`, `DynamicNativeSessionPublisher` are one planned replacement; not an alternate live callback, and `productionCallbackLive=false`, `supportedOps=[]` are intentional. +- **HISTORICAL**: separate draft experiments (including #251 WASAPI and #225 FactoryFX) do not acquire production engine ownership by existence. Do not close unrelated issues without evidence; do not blindly merge. + +## Non-negotiable invariants (automatically guarded) + +The cheap `tests/engine_runtime_reconciliation_test.mjs` runs **before** JUCE checkout in the existing Windows job. It fails on extra production callback, double M4 PCM render, test-only mixer listed as native app source, diagnostic VST resurrection, lost CH1 vendor lease, false ChannelId LIVE capabilities, or the loss of Show worker isolation. These are **migration stage gates**: a deliberate universal cutover must update them in the same exact-SHA commit that establishes real callback/VST/GUI/FAT proof; never bypass by changing a string only. + +## Next ENGINE milestone (one substantial outcome) + +1. Rebase/reconcile #266 on current `main` **without** overwriting GUI/native/diagnostic changes. Detect conflicts particularly in `src/LiveAudioEngine.h`, `src/Main.cpp`, `src/LiveDryRoutingLab.h`, `engine/core/PreparedMixerBlock.h`, `CMakeLists.txt` and mixed native/JS source contracts. +2. Migrate the **actual** M4 owners to one accepted ChannelId graph: CH1 original vendor/Orbit editor, CH2–10, AUX1–4, MAIN/MONITOR, Show states and sparse real hardware pins; no reinstantiate on routine fader/mute/send edits. Prepare on control/worker, not callback. +3. Switch the existing JUCE callback **once** with a full-fidelity native epoch/graph ACK; maintain one output pathway, no phantom channel and no double FX. Device/clock/FX owner changes fail closed until proven safe. +4. Update `ConsoleLiveBridgeV6` supportedOps/capabilities only from **real admitted callback**; integrate #271 operator intent and #278/#285 approved WIRE through the **same graph**; #270 owns combined exact SHA release. +5. Remove M4 compatibility adapter and ordinal CH1 paths **in the same** production integration only after golden 10CH/AUX/monitor PCM and real vendor/editor/Show parity, approved Windows native CI and ASIO 0FX/1FX hardware FAT. + +### Definition of ready for hardware/UAT + +A green PR-specific CTest is valuable but **insufficient**. Require exact joined Windows EXE provenance, hardware driver/rate/buffer/pins, 0FX clean wired audio, real VST3 editor/state, MUTE/SOLO/AUX/MONITOR, Show recall, and measured output latency/crackle evidence. Do not claim zero physical latency, zero crash risk from arbitrary in-process third-party VST3, or universal CH11 before hardware validation. + +**Do not start another ENGINE PR while #266 is open.** Future ENGINE edits and test evidence go into #266; #271 (GUI) and #270 (FAT) receive only explicit contract handoffs. diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs new file mode 100644 index 000000000..b1ab2b541 --- /dev/null +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Fast G0 architecture gate. Tests the INSTALLED owner (M4 compatibility) +// without pretending that the prepared ChannelId graph is live. +// When ChannelId cutover is actually approved, this gate MUST change in +// the same exact-SHA integration commit as the JUCE callback and native ACK. +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {readFileSync} from 'node:fs'; + +const read=p=>readFileSync(p,'utf8'); +const engine=read('src/LiveAudioEngine.h'); +const host=read('src/Main.cpp'); +const cmake=read('CMakeLists.txt'); +const authority=read('engine/core/NativeRenderAuthority.h'); +const bridge=read('src/ConsoleLiveBridgeV6.h'); +const wire=read('engine/core/ConsolePuzzleV8Wire.h'); +const schema=JSON.parse(read('contracts/console-puzzle-v8.json')); +const worker=read('src/NativeShowSaveWorker.h'); +const start=engine.indexOf('void audioDeviceIOCallbackWithContext ('); +assert.ok(start>0,'missing ONE JUCE production callback'); +const callback=engine.slice(start); +const count=(s,pattern)=>[...s.matchAll(pattern)].length; + +test('exactly one production audio callback and one native PCM owner',()=>{ + assert.equal(count(engine,/void audioDeviceIOCallbackWithContext\s*\(/g),1); + assert.equal(count(host,/LiveAudioEngine engine_;/g),1); + assert.match(engine,/#include "\.\.\/engine\/core\/NativeRenderAuthority\.h"/); + assert.match(callback,/NativeRenderAuthority::select\(/); + assert.match(callback,/NativeRenderOwner::failSilentUnpatched/); + assert.match(callback,/NativeRenderOwner::acceptedM4Session/); + assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1, + 'two native M4 PCM renders would double-sum or double-process vendor FX'); + assert.doesNotMatch(callback,/DynamicNativeSessionPublisher|DynamicAcceptedSession|\.publisher_\.render\(/, + 'unadmitted universal graph must never run alongside real M4 callback'); + assert.match(authority,/acceptedM4Session/); + assert.match(authority,/isolatedDiagnostic/); +}); + +test('unpatched is silent and diagnostic path cannot host a legacy second VST engine',()=>{ + const unpatched=callback.indexOf('NativeRenderOwner::failSilentUnpatched'); + const routed=callback.indexOf('NativeRenderOwner::acceptedM4Session'); + const isolated=callback.indexOf('// The only remaining stereo renderer is DIAGNOSTIC'); + const finish=callback.indexOf('const auto elapsedUs = clockMicros() - beginUs',isolated); + assert.ok(unpatched>=0&&routed>unpatched&&isolated>routed&&finish>isolated); + const first=callback.slice(unpatched,routed); + assert.match(first,/FloatVectorOperations::clear\(outputs\[c\], samples\)/); + assert.match(first,/handoff_\.endCycle\(cycle\)/, + 'plugin owner must still retire on the CONTROL thread when unpatched'); + const tail=callback.slice(isolated,finish); + assert.doesNotMatch(tail,/processor->processBlock|MidiBuffer midi|createPluginInstance|prepareToPlay/, + 'do not revive a hidden stereo plugin engine in diagnostic fallback'); + assert.match(tail,/diagnosticTone_\.next/); +}); + +test('original CH1 vendor FX/Orbit is leased exactly once in accepted M4 renderer',()=>{ + const old=engine.indexOf('static void processLegacyChannelOne('); + const end=engine.indexOf('void audioDeviceIOCallbackWithContext',old); + assert.ok(old>=0&&end>old); + const fx=engine.slice(old,end); + assert.match(fx,/slot\.processor->processBlock\(buffer,midi\)/); + assert.match(fx,/bypass\.request\(graph->bypassFlags/); + assert.match(fx,/catch\(\.\.\.\)/); + assert.match(callback,/LegacyChannelOneLease ch1Lease\{this,cycle\.graph\}/); + assert.match(callback,/&processLegacyChannelOne/); + assert.doesNotMatch(callback,/std::make_unique<|std::make_shared<|createPluginInstance\(/, + 'no FX instantiation or graph allocation in device callback'); +}); + +test('shipping application does not compile a second test-only native mixer',()=>{ + const app=cmake.split(/\r?\n/).find(l=>l.startsWith('target_sources(ARMixConsole PRIVATE')); + assert.ok(app,'native JUCE application source list missing'); + assert.match(app,/src\/LiveAudioEngine\.h/); + assert.match(app,/engine\/core\/NativeRenderAuthority\.h/); + assert.doesNotMatch(app,/PreparedNativeMixerSession|DynamicNativeSessionPublisher|DynamicPreparedMixerBlock|UnifiedLegacyProductionAdmission|LegacyLiveGraphMigration/, + 'prepared graph may be compiled as tests/includes, not advertised as a second application entry point'); + assert.match(cmake,/target_sources\(ARMixNativeMixerSessionTests PRIVATE tests\/prepared_native_mixer_session_test\.cpp engine\/core\/PreparedNativeMixerSession\.h\)/); +}); + +test('GUI projection cannot falsely claim the prepared ChannelId engine is live',()=>{ + assert.equal(schema.schemaVersion,6); + assert.deepEqual(schema.wire.events, + ['arMixConsoleSubscribe','arMixConsoleSnapshot','arMixConsoleIntent','arMixConsoleAck']); + for(const item of ['deviceEpoch','baseGraphRevision','baseRosterRevision','requestId','targetChannelId']) + assert.ok(schema.intentRequired.includes(item)); + assert.match(bridge,/w\.productionCallbackLive=false/); + assert.match(bridge,/legacyM4/); + assert.match(wire,/callbackOwnsChannelIds\\":false/); + assert.match(wire,/fullVendorFxMigration\\":false/); + assert.match(wire,/supportedOps\\":\[\]/); + assert.match(bridge,/parseNativeChannelId/); + assert.match(bridge,/validConsoleRequestId/); +}); + +test('workers handle Show IO outside the audio callback, not as a second DSP engine',()=>{ + assert.match(worker,/class NativeShowSaveWorker final : private juce::Thread/); + assert.match(worker,/store\.commit\(show,\{snapshot_\},blobs_\)/); + assert.match(worker,/void releaseJob\(\)/); + assert.doesNotMatch(callback,/NativeShowStore|\.loadWithStates\(|\.commit\(show/); +}); From 12fc5a5ad49289bd642ca6198ae6e6916facdf12 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 05:10:05 +0700 Subject: [PATCH 061/155] fix(ci): run ENGINE ownership preflight as valid multiline YAML before JUCE --- .github/workflows/p1-windows.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index b6a3aeb4b..2c62a39d3 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -58,7 +58,9 @@ jobs: steps: - uses: actions/checkout@v4 - name: Cheap canonical Console v6 puzzle socket gate (no JUCE) - run: |\n node --test tests/engine_runtime_reconciliation_test.mjs\n node scripts/check_console_puzzle.mjs + run: | + node --test tests/engine_runtime_reconciliation_test.mjs + node scripts/check_console_puzzle.mjs - name: Stop incomplete integrated product promotion before JUCE checkout if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-') }} run: node scripts/check_console_puzzle.mjs --release From 785145282aaa5fb6c0980269e801a2406c02941e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 05:12:30 +0700 Subject: [PATCH 062/155] test(contract): reconcile live engine CI with normative v8 socket, archive v6 sequence --- tests/smart_audio_ard_contract_test.mjs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/smart_audio_ard_contract_test.mjs b/tests/smart_audio_ard_contract_test.mjs index d91a64486..188eb6a46 100644 --- a/tests/smart_audio_ard_contract_test.mjs +++ b/tests/smart_audio_ard_contract_test.mjs @@ -15,20 +15,26 @@ const visualLock = 'docs/GUI_BASELINE_LOCK_2026-10-25.md'; const currentPrd = read('docs/PRD_ARSONMIX_OPERATOR_FIRST_LIVE_MIXER_V5_20261101.md'); const currentArd = read('docs/ARD_ARSONMIX_UNIVERSAL_REALTIME_CONSOLE_V5_20261101.md'); const executionLock = read('docs/EXECUTION_LOCK_UNIVERSAL_LIVE_CONSOLE_V6_20261101.md'); +const puzzleV8 = read('docs/PUZZLE_INTEGRATION_CONTRACT_V8_20261101.md'); -test('active entrypoints follow PRD/ARD v5 and execution lock v6, not retired v1', () => { +test('active entrypoints follow PRD/ARD v5.2 and Puzzle v8, while v6 is archived', () => { for (const content of [agents, readme]) { assert.match(content, /PRD_ARSONMIX_OPERATOR_FIRST_LIVE_MIXER_V5_20261101\.md/); assert.match(content, /ARD_ARSONMIX_UNIVERSAL_REALTIME_CONSOLE_V5_20261101\.md/); - assert.match(content, /EXECUTION_LOCK_UNIVERSAL_LIVE_CONSOLE_V6_20261101\.md/); + assert.match(content, /PUZZLE_INTEGRATION_CONTRACT_V8_20261101\.md/); assert.ok(content.includes(issue), 'hardware crackle blocker must remain visible'); } for (const [label, content] of [ - ['PRD v5', currentPrd], ['ARD v5', currentArd], ['Execution lock v6', executionLock] + ['PRD v5', currentPrd], ['ARD v5', currentArd], + ['Puzzle socket v8', puzzleV8], ['Historical lock v6', executionLock] ]) { assert.ok(content.includes('ChannelId') || content.includes('channel'), label + ' must describe real mixer channels'); } + // The v8 socket supersedes the old v6/v7 sequencing; do not re-enable + // a second native renderer by making tests depend on historical plans. + assert.match(puzzleV8, /IConsoleRuntimeV8/); + assert.match(puzzleV8, /ChannelId/); assert.match(executionLock, /one accepted PCM graph/i); assert.match(executionLock, /CH11/); assert.match(executionLock, /rollback/i); From 84b805c414b57091dd2758550a27e2b335a017fb Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 05:25:26 +0700 Subject: [PATCH 063/155] feat(engine): canonical 64-sample RT coalescing for ChannelId fader, PAN and PRE/POST sends --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 3 + engine/core/DynamicPreparedMixerBlock.h | 42 ++++--- engine/core/RealtimeSlew64.h | 36 ++++++ tests/dynamic_accepted_session_test.cpp | 106 ++++++++++++++++++ 4 files changed, 165 insertions(+), 22 deletions(-) create mode 100644 engine/core/RealtimeSlew64.h diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index 1b49aae44..4b2593928 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -54,3 +54,6 @@ The cheap `tests/engine_runtime_reconciliation_test.mjs` runs **before** JUCE ch A green PR-specific CTest is valuable but **insufficient**. Require exact joined Windows EXE provenance, hardware driver/rate/buffer/pins, 0FX clean wired audio, real VST3 editor/state, MUTE/SOLO/AUX/MONITOR, Show recall, and measured output latency/crackle evidence. Do not claim zero physical latency, zero crash risk from arbitrary in-process third-party VST3, or universal CH11 before hardware validation. **Do not start another ENGINE PR while #266 is open.** Future ENGINE edits and test evidence go into #266; #271 (GUI) and #270 (FAT) receive only explicit contract handoffs. + +## M-U2 canonical realtime control kernel — 2026-11-03 +The prepared universal `DynamicPreparedMixerBlock` now uses **one reusable** `RealtimeSlew64` for ChannelId fader/PAN stereo targets and all PRE/POST SEND targets. CONTROL writes one atomic/latest target per logical control; AUDIO reads once per channel/send per block and advances exactly 64 samples across variable 4/16/32/12-frame ASIO/WASAPI quanta. A reversal starts from the last *applied* coefficient, not the most recent requested goal. No extra worker, event FIFO, heap, lock, division, or plugin re-instantiation in RT. The single native `M3DAtomicStudioBusFxChannelSessionRollback` CTest now checks actual ChannelId→wet PRE→MAIN and POST→MONITOR PCM with short callbacks, coalescing, revision rejection and null output at the terminal zero gain. The installed JUCE callback remains safely on accepted M4 while full vendor/Show migration remains pending; no fake GUI LIVE promotion. This removes a genuine small-buffer dezippering blocker for the final engine, not an extra audio engine. diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index 8ffcc3d44..7bed44f4a 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -1,6 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only #pragma once #include "DynamicChannelRoster.h" +#include "RealtimeSlew64.h" #include #include #include @@ -94,11 +95,11 @@ class DynamicPreparedMixerBlock final { static_assert(std::atomic::is_always_lock_free, "Realtime stereo mixer requires lock-free 64-bit atomic targets"); std::atomic both{packGainPair(1.f,1.f)}; - float appliedL=1.f,appliedR=1.f; // audio thread only + armix::dsp::RealtimeSlew64 appliedL{},appliedR{}; // audio thread only }; struct SendTarget final { std::atomic gain{1.f}; - float applied=1.f; + armix::dsp::RealtimeSlew64 applied{}; }; static constexpr std::size_t notScheduled=std::numeric_limits::max(); public: @@ -368,14 +369,14 @@ class DynamicPreparedMixerBlock final { auto& target=next.channelTargets_[i]; target.both.store(packGainPair(next.lanes_[i].gainL, next.lanes_[i].gainR),std::memory_order_relaxed); - target.appliedL=next.lanes_[i].gainL; - target.appliedR=next.lanes_[i].gainR; + target.appliedL.reset(next.lanes_[i].gainL); + target.appliedR.reset(next.lanes_[i].gainR); } next.sendTargets_=std::make_unique(next.edges_.size()); for(std::size_t e=0;e(ramp); - float applied=target.applied; + // Coalesced, callback-continuous 64 SAMPLE slew. A 4-frame + // ASIO callback advances only 4/64 of the requested change. + target.applied.retarget(goal); for(int f=0;f(ramp); - const float stepR=(goalR-controls.appliedR)/static_cast(ramp); - float currentL=controls.appliedL,currentR=controls.appliedR; + // Left and right use ONE atomically read stereo goal. Ramp state + // survives variable hardware callback sizes and gesture reversals. + controls.appliedL.retarget(goalL); + controls.appliedR.retarget(goalR); for(int f=0;f(ramp); - float applied=target.applied; + // Coalesced, callback-continuous 64 SAMPLE slew. A 4-frame + // ASIO callback advances only 4/64 of the requested change. + target.applied.retarget(goal); for(int f=0;f(samples)); + } + float next() noexcept { + if(remaining>0) { + --remaining; + if(remaining==0)current=goal; // exact steady-state endpoint + else current+=delta; + } + return current; + } +}; +} // namespace armix::dsp diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index ab36ae123..4c62c6458 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only #include "../engine/core/DynamicAcceptedSession.h" +#include "../engine/core/RealtimeSlew64.h" #include #if defined(NDEBUG) #undef NDEBUG // Native Release CTest must actually run assertions. @@ -26,7 +27,112 @@ static ChannelEdit send(ChannelId from,ChannelId to,float gain,bool pre=false) { ChannelEdit e;e.kind=ChannelEdit::Kind::addSendReference; e.id=from;e.target=to;e.value=gain;e.preFader=pre;return e; } + +static void verifyRealtimeSlewAndNativeChannelIdContinuousControls() { + using armix::dsp::RealtimeSlew64; + // Sub-64 variable callbacks must not finish a 64-sample gesture in 4 + // frames. Coalescing multiple UI writes before a read keeps latest goal. + RealtimeSlew64 s; + s.reset(1.f); + s.retarget(.2f); + s.retarget(.5f); // replaces the old unrendered target; no queue buildup + for(int i=0;i<4;++i)s.next(); + assert(near(s.current,1.f-(.5f*4.f/64.f))); + for(int i=0;i<16;++i)s.next(); + assert(near(s.current,1.f-(.5f*20.f/64.f))); + for(int i=0;i<32;++i)s.next(); + assert(near(s.current,1.f-(.5f*52.f/64.f))); + for(int i=0;i<12;++i)s.next(); + assert(s.remaining==0 && s.current==.5f); + s.retarget(0.f); + for(int i=0;i<20;++i)s.next(); + const float applied=s.current; + s.retarget(.75f); // reverse while in flight; no jump on target update + assert(s.current==applied); + assert(s.next()>applied); + for(int i=1;i<64;++i)s.next(); + assert(s.current==.75f && s.remaining==0); + + // The approved GUI sends ChannelId-keyed realtime moves. Verify actual + // PCM through GROUP-compatible Main, PRE wet Return and POST Monitor, + // not a disconnected smoothing helper or browser-only fixture. + DynamicAcceptedSession session; + constexpr std::uint64_t epoch=9401; + DynamicGraphRequest route; + route.physicalInputs=1; + route.maxFrames=64; + std::array creates{ + add(0,ChannelRole::input,"VOICE"), + add(1,ChannelRole::fxReturn,"WET",ProcessingFormat::stereo), + add(2,ChannelRole::main,"MAIN",ProcessingFormat::stereo), + add(3,ChannelRole::monitor,"CUE",ProcessingFormat::stereo) + }; + auto a=session.edit(0,0,creates,route,epoch,epoch,true); + assert(a.ok()); + const auto voice=a.edit.createdIds[0]; + const auto wet=a.edit.createdIds[1]; + const auto main=a.edit.createdIds[2]; + const auto cue=a.edit.createdIds[3]; + std::array links{ + output(voice,main), + output(wet,main), + send(voice,wet,.5f,true), + send(voice,cue,.5f,false) + }; + route.sources={{voice,0,-1,false}}; + a=session.edit(1,1,links,route,epoch,epoch,true); + assert(a.ok()&&session.acceptedGraphRevision()==2); + std::array input{},outL{},outR{},cueL{},cueR{}; + input.fill(.5f); + const float* pins[]{input.data()}; + const auto fx=+[](ChannelId,float*,float*,int) noexcept {}; + const auto render=[&](int n) { + return session.render(epoch,pins,1,outL.data(),outR.data(),n, + false,fx,cueL.data(),cueR.data()); + }; + assert(render(64)); + const float initialMain=outL[63]; + const float initialCue=cueL[63]; + assert(initialMain>.1f && initialCue>.01f); + assert(session.setLiveMix(epoch,2,voice,0.f,0.f)); + assert(session.setLiveParallelSend(epoch,2,voice,wet,true,0.f)); + assert(session.setLiveParallelSend(epoch,2,voice,cue,false,0.f)); + // PRE send, POST send and channel fader must all advance across + // 4+16+32+12 (one complete ramp), not finish on the FIRST 4 samples. + assert(render(4)); + const float after4=outL[3],cue4=cueL[3]; + assert(after4>0.f && after40.f && cue40.f && after200.f && cue200.f); + assert(render(60)); + constexpr float center=.7071067811865475f; + assert(near(outL[59],.5f*.8f*center,0.0001f)); + assert(!session.setLiveMix(epoch,1,voice,1.f,0.f)); + assert(!session.setLiveParallelSend(epoch-1,2,voice,wet,true,1.f)); + assert(session.acceptedGraphRevision()==2); + session.unpublish(); + session.pollRetirement(); +} + int main() { + verifyRealtimeSlewAndNativeChannelIdContinuousControls(); constexpr std::uint64_t epoch=77; constexpr float center=.7071067811865475f; DynamicAcceptedSession session; From 44884df43318bbc01db3a6d2d908b7d793937a26 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 05:37:17 +0700 Subject: [PATCH 064/155] perf(engine): canonical ChannelId lookup for realtime GUI control and DSP; 4096 coalesced gestures --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 3 + engine/core/DynamicChannelRoster.h | 60 ++++++++++++++----- engine/core/DynamicPreparedMixerBlock.h | 47 +++++++++------ tests/dynamic_accepted_session_test.cpp | 8 ++- 4 files changed, 82 insertions(+), 36 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index 4b2593928..f56208502 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -57,3 +57,6 @@ A green PR-specific CTest is valuable but **insufficient**. Require exact joined ## M-U2 canonical realtime control kernel — 2026-11-03 The prepared universal `DynamicPreparedMixerBlock` now uses **one reusable** `RealtimeSlew64` for ChannelId fader/PAN stereo targets and all PRE/POST SEND targets. CONTROL writes one atomic/latest target per logical control; AUDIO reads once per channel/send per block and advances exactly 64 samples across variable 4/16/32/12-frame ASIO/WASAPI quanta. A reversal starts from the last *applied* coefficient, not the most recent requested goal. No extra worker, event FIFO, heap, lock, division, or plugin re-instantiation in RT. The single native `M3DAtomicStudioBusFxChannelSessionRollback` CTest now checks actual ChannelId→wet PRE→MAIN and POST→MONITOR PCM with short callbacks, coalescing, revision rejection and null output at the terminal zero gain. The installed JUCE callback remains safely on accepted M4 while full vendor/Show migration remains pending; no fake GUI LIVE promotion. This removes a genuine small-buffer dezippering blocker for the final engine, not an extra audio engine. + +### M-U2 efficient GUI control ownership +`DynamicPreparedMixerBlock` reuses its compiler-built `ChannelId → dense lane` table after graph admission, so fader/PAN and PRE/POST SEND control commands do **not** linearly scan all channels per gesture. The table and CSR send adjacency are accessed on the control writer only; realtime callback reads packed atomic targets once per block, advances sample-continuous state, and does not hash, allocate, lock or invoke workers. Regression sends **4096 successive fader gestures**, tests latest-target-wins, unknown ChannelIds fail closed and exact PCM after 64 rendered samples. A lock-free atomic requirement is enforced at compile time for send target storage. The existing Windows job builds these tests via the established M3D test dependency; no new workflow or CI matrix. diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index a666b15a1..7717826a4 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -85,9 +85,8 @@ class DynamicChannelRoster final { std::size_t size() const noexcept {return channels_.size();} const std::vector& channels() const noexcept {return channels_;} const ChannelStripDefinition* find(ChannelId id) const noexcept { - const auto it=std::find_if(channels_.begin(),channels_.end(), - [id](const auto& c){return c.id==id;}); - return it==channels_.end()?nullptr:&*it; + const auto it=index_.find(id.value); + return it==index_.end()?nullptr:&channels_[it->second]; } // CONTROL THREAD ONLY. A realtime parameter target must survive the @@ -97,23 +96,23 @@ class DynamicChannelRoster final { bool rememberLiveMix(ChannelId id,float gain,float pan) noexcept { if(!id.value || !std::isfinite(gain) || gain<0.f || gain>4.f || !std::isfinite(pan) || pan< -1.f || pan>1.f)return false; - for(auto& row:channels_)if(row.id==id) { - row.faderLinear=gain;row.pan=pan;return true; - } - return false; + const auto it=index_.find(id.value); + if(it==index_.end())return false; + auto& row=channels_[it->second]; + row.faderLinear=gain;row.pan=pan; + return true; } bool rememberLiveParallelSend(ChannelId id,ChannelId destination, bool preFader,float gain) noexcept { if(!id.value || !destination.value || !std::isfinite(gain) || gain<0.f || gain>4.f)return false; - for(auto& row:channels_)if(row.id==id){ - for(auto& link:row.sends) - if(link.destination==destination && - link.preFader==preFader && !link.primaryOutput) { - link.gain=gain;return true; - } - return false; - } + const auto it=index_.find(id.value); + if(it==index_.end())return false; + for(auto& link:channels_[it->second].sends) + if(link.destination==destination && + link.preFader==preFader && !link.primaryOutput) { + link.gain=gain;return true; + } return false; } @@ -260,7 +259,12 @@ class DynamicChannelRoster final { } if(result.ok() && !withinBudget(candidate))result.fault=ChannelEditFault::budgetExceeded; if(!result.ok()) {result.createdIds.clear();return result;} + // Structural edits are infrequent and prepared entirely on CONTROL. + // Rebuild before acceptance: rejected/failed edits cannot leave the + // active stable-ID map pointing into an old reordered vector. + auto stagedIndex=buildIndex(candidate); channels_.swap(candidate); + index_.swap(stagedIndex); nextId_=next; result.revision=++revision_; return result; @@ -301,7 +305,12 @@ class DynamicChannelRoster final { if(!withinBudget(candidate)) { result.fault=ChannelEditFault::budgetExceeded;return result; } - channels_.swap(candidate);result.createdIds.push_back({nextId_++}); + // Structural edits are infrequent and prepared entirely on CONTROL. + // Rebuild before acceptance: rejected/failed edits cannot leave the + // active stable-ID map pointing into an old reordered vector. + auto stagedIndex=buildIndex(candidate); + channels_.swap(candidate); + index_.swap(stagedIndex);result.createdIds.push_back({nextId_++}); result.revision=++revision_;return result; } @@ -351,7 +360,12 @@ class DynamicChannelRoster final { if(!withinBudget(candidate)) { result.fault=ChannelEditFault::budgetExceeded;return result; } + // Structural edits are infrequent and prepared entirely on CONTROL. + // Rebuild before acceptance: rejected/failed edits cannot leave the + // active stable-ID map pointing into an old reordered vector. + auto stagedIndex=buildIndex(candidate); channels_.swap(candidate); + index_.swap(stagedIndex); result.revision=++revision_;return result; } @@ -426,13 +440,26 @@ class DynamicChannelRoster final { if(!withinBudget(candidate)) { result.fault=ChannelEditFault::budgetExceeded;return result; } + // Structural edits are infrequent and prepared entirely on CONTROL. + // Rebuild before acceptance: rejected/failed edits cannot leave the + // active stable-ID map pointing into an old reordered vector. + auto stagedIndex=buildIndex(candidate); channels_.swap(candidate); + index_.swap(stagedIndex); ++nextId_;result.revision=++revision_; result.createdIds.push_back(busId); return result; } private: + static std::unordered_map buildIndex( + const std::vector& rows) { + std::unordered_map index; + index.reserve(rows.size()); + for(std::size_t i=0;i channels_; + std::unordered_map index_; // CONTROL ONLY std::uint64_t revision_=0, nextId_=1; }; } // namespace armix::mixer diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index 7bed44f4a..d6b1a7ff3 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -98,6 +98,8 @@ class DynamicPreparedMixerBlock final { armix::dsp::RealtimeSlew64 appliedL{},appliedR{}; // audio thread only }; struct SendTarget final { + static_assert(std::atomic::is_always_lock_free, + "Realtime SEND must never enter a hidden blocking atomic path"); std::atomic gain{1.f}; armix::dsp::RealtimeSlew64 applied{}; }; @@ -118,13 +120,15 @@ class DynamicPreparedMixerBlock final { bool setChannelMix(ChannelId id,float gain,float pan) noexcept { if(!id.value || !std::isfinite(gain) || gain<0.f || gain>4.f || !std::isfinite(pan) || pan< -1.f || pan>1.f)return false; - for(std::size_t i=0;isecond; + const auto gains=coefficients(lanes_[i].monoPan,gain,pan); + channelTargets_[i].both.store( + packGainPair(gains.left,gains.right),std::memory_order_release); + return true; } // Change gain ONLY on an existing parallel send (PRE or POST). // Exclusive primary OUT and source/destination edits stay structural. @@ -132,22 +136,24 @@ class DynamicPreparedMixerBlock final { bool preFader,float gain) noexcept { if(!source.value || !destination.value || !std::isfinite(gain) || gain<0.f || gain>4.f)return false; - for(const auto& lane:lanes_)if(lane.id==source) { - for(std::size_t e=lane.first;esecond]; + // Only that source's prepared CSR outgoing edges are examined. + // The public GUI can address arbitrary stable ChannelIds regardless + // of visual bank, strip position or hidden channels. + for(std::size_t e=lane.first;e lanes_; + std::unordered_map controlIndex_; // CONTROL only std::vector edges_; std::vector renderOrder_; std::vector scratch_; diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 4c62c6458..4b5aa2de4 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -117,8 +117,12 @@ static void verifyRealtimeSlewAndNativeChannelIdContinuousControls() { assert(session.acceptedGraphRevision()==2); // Rapid fader drags are naturally last-target-wins: no event queue, // structural graph recompile, callback heap or retained stale controls. - assert(session.setLiveMix(epoch,2,voice,.2f,0.f)); - assert(session.setLiveMix(epoch,2,voice,.8f,0.f)); + // 4096 high-rate gestures all collapse into ONE latest atomic target. + // This is a CPU/heap-bounded CONTROL lookup, not a 4096-event RT FIFO. + for(int i=0;i<4096;++i) + assert(session.setLiveMix(epoch,2,voice,(i&1)?.8f:.2f,0.f)); + assert(!session.setLiveMix(epoch,2,ChannelId{999999},1.f,0.f)); + assert(!session.setLiveParallelSend(epoch,2,ChannelId{999999},wet,true,.5f)); assert(render(4)); assert(outL[3]>0.f); assert(render(60)); From a3cf27b74ed08134068050071d9e215cdb0375c0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 05:45:49 +0700 Subject: [PATCH 065/155] release(engine): ship sole-owner exact-SHA Windows 10CH+4AUX experimental hardware FAT after native quality gates --- .github/workflows/p1-windows.yml | 9 +++++---- docs/ENGINE_RUNTIME_AUTHORITY_20261103.md | 3 +++ docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md | 2 +- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 3 +++ tests/ci_workflow_efficiency_test.mjs | 9 +++++---- .../native_artifact_packaging_contract_test.mjs | 17 +++++++++++++++++ 6 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 2c62a39d3..f071eb6b2 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -139,12 +139,13 @@ jobs: & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # PRs compile/CTest/package but never silently publish a stable build. - # This single M4 FAT branch is explicitly allowed to upload an - # UNQUALIFIED experimental ZIP for real physical hardware testing. + # Sole ENGINE #266 may upload an EXACT-SHA, CI/PE-verified + # UNQUALIFIED 10CH+4AUX engineering FAT ZIP; NOT universal live. + # Retired M4-only branches cannot publish competing ENGINE builds. - uses: actions/upload-artifact@v4 - if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' }} + if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m5-universal-channelid-vst3-lease-migration-20261101' }} with: - name: ${{ github.event_name == 'pull_request' && 'ArSonMix-M4-EXPERIMENTAL-Hardware-FAT-Windows-x64' || 'ArSonMix-GUI10CH-P012-Verified-Hardware-FAT-Windows-x64' }} + name: ${{ github.event_name == 'pull_request' && 'ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64' || 'ArSonMix-GUI10CH-P012-Verified-Hardware-FAT-Windows-x64' }} path: dist/ if-no-files-found: error retention-days: 14 diff --git a/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md b/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md index ba2bb75e4..0b62f88f9 100644 --- a/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md +++ b/docs/ENGINE_RUNTIME_AUTHORITY_20261103.md @@ -58,3 +58,6 @@ The `NativeRenderAuthority` is an explicit, fixed-cost callback selector. **Ther ## Reconciliation notice (2026-11-03) ENGINE #266 is now the sole source branch after folding former #287. Cross-branch ownership, upstream drift, CI authority gate and the next real callback cutover are documented in [ENGINE_SINGLE_OWNER_HANDOFF_20261103.md](workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md). The M1 experimental ZIP policy is historical; do not make another branch-specific Windows FAT producer without #270 integration ownership. + +## Single-owner Windows hardware FAT (2026-11-03) +ENGINE PR #266 alone can upload a 10CH/4AUX **experimental, unqualified** Windows GUI ZIP after exact SHA native compile, all CTests, PE32+ Windows GUI subsystem and embedded GUI/SHA verification. Former M4 branches no longer have a second artifact publication exception. This is physical first-sound evidence only; NOT a live universal ChannelId engine or joined new-GUI release. See the packaged `HARDWARE_FAT_GUIDE.md`. diff --git a/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md b/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md index c518d4eaf..a2adb3e55 100644 --- a/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md +++ b/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md @@ -31,7 +31,7 @@ Historical full test matrix remains `docs/HARDWARE_FAT_GUI10_ENGINE_P012_2026102 ## 5. M1 candidate — structured physical acceptance (not an M5 universal graph) -The **ArSonMix-M1-EXPERIMENTAL-Hardware-FAT-Windows-x64** workflow artifact is uploaded only if the exact PR SHA completes Windows compile, all CTests, packaging and ZIP/embedded-GUI SHA256 verification. A PR artifact is not a public stable release. The EXE preserves the existing **native M4 10CH + 4AUX** callback, not a live CH11/group universal engine. DO NOT apply an unqualified artifact on a live public-performance show. +The **ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64** artifact comes from the **single canonical ENGINE #266 branch** (not the retired M4 branch) and is uploaded only if the exact PR SHA completes Windows compile, all CTests, packaging and ZIP/embedded-GUI SHA256 verification. Get the ZIP from the successful ENGINE #266 GitHub Actions run's **Artifacts** section. Extract, then compare `BUILD_PROVENANCE.json` `sourceCommit` against the exact successful run's SHA and the EXE file hash against `exeSha256`. A mismatch means STOP. A PR artifact is not a public stable release. The EXE preserves the existing **native M4 10CH + 4AUX** callback, not a live CH11/group universal engine. DO NOT apply an unqualified artifact on a live public-performance show. One real device, one verified I/O clock, wired monitoring, LOW output gain and initially **0 VST3**. Start at a supported buffer of 256 samples, then 128 and 64 only after the earlier stage has passed; document actual negotiated values, don't assume the driver honored the request. For each supported buffer: diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index f56208502..70423494c 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -60,3 +60,6 @@ The prepared universal `DynamicPreparedMixerBlock` now uses **one reusable** `Re ### M-U2 efficient GUI control ownership `DynamicPreparedMixerBlock` reuses its compiler-built `ChannelId → dense lane` table after graph admission, so fader/PAN and PRE/POST SEND control commands do **not** linearly scan all channels per gesture. The table and CSR send adjacency are accessed on the control writer only; realtime callback reads packed atomic targets once per block, advances sample-continuous state, and does not hash, allocate, lock or invoke workers. Regression sends **4096 successive fader gestures**, tests latest-target-wins, unknown ChannelIds fail closed and exact PCM after 64 rendered samples. A lock-free atomic requirement is enforced at compile time for send target storage. The existing Windows job builds these tests via the established M3D test dependency; no new workflow or CI matrix. + +## ENGINE candidate for physical FAT (source-attested) +Canonical PR #266 alone is allowed to publish `ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64` after successful full Windows native CTest and independent SHA/PE/embedded-WebView verification. The retired M4 branch cannot publish a parallel ENGINE artifact. This is a **true native Windows JUCE GUI**, with `BUILD_PROVENANCE.json` and `HARDWARE_FAT_GUIDE.md`, suitable for cautious 0FX ASIO/WASAPI first-sound testing and crackle issue #15 evidence. Installed DSP is still M4 10CH/4AUX and the approved modern GUI #271 will require joined exact-SHA integration #270; do not promote universal capabilities merely because this ZIP exists. diff --git a/tests/ci_workflow_efficiency_test.mjs b/tests/ci_workflow_efficiency_test.mjs index 17241a1ad..e1bf19e51 100644 --- a/tests/ci_workflow_efficiency_test.mjs +++ b/tests/ci_workflow_efficiency_test.mjs @@ -15,8 +15,9 @@ test('only main and explicitly selected branch can produce a Windows FAT artifac assert.match(windows,/'web\/\*\*'/); assert.match(windows,/workflow_dispatch:/); assert.match(windows,/cancel-in-progress: true/); - assert.match(windows,/if: \$\{\{ github\.event_name != 'pull_request' \|\| github\.head_ref == 'milestone\/m4-unified-native-multichannel-fx-20261101' \}\}/); - assert.match(windows,/ArSonMix-M4-EXPERIMENTAL-Hardware-FAT-Windows-x64/); + assert.match(windows,/if: \$\{\{ github\.event_name != 'pull_request' \|\| github\.head_ref == 'milestone\/m5-universal-channelid-vst3-lease-migration-20261101' \}\}/); + assert.match(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64/); + assert.doesNotMatch(windows,/github\\.head_ref == 'milestone\\/m4-unified-native-multichannel-fx-20261101'/); assert.ok(windows.indexOf('scripts/verify_native_windows_artifact.ps1') < windows.indexOf('uses: actions/upload-artifact@v4')); }); @@ -45,6 +46,6 @@ test('retain current native audio and dearVR CTests during CI optimization',()=> } assert.match(windows,/ctest --test-dir build -C Release --output-on-failure/); assert.match(windows,/'scripts\/build_ui_css\.py'/); - assert.match(windows,/if: \$\{\{ github\.event_name != 'pull_request' \|\| github\.head_ref == 'milestone\/m4-unified-native-multichannel-fx-20261101' \}\}/); - assert.match(windows,/ArSonMix-M4-EXPERIMENTAL-Hardware-FAT-Windows-x64/); + assert.match(windows,/if: \$\{\{ github\.event_name != 'pull_request' \|\| github\.head_ref == 'milestone\/m5-universal-channelid-vst3-lease-migration-20261101' \}\}/); + assert.match(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64/); }); diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index 03adc7b02..8b70e3076 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -134,3 +134,20 @@ test('FAT ZIP uses current single-APPLY physical first-sound guide',()=>{ for(const entry of ['10 input channels + 4 AUX','OUTPUT_ONLY_TONE','CAPTURE_ONLY','COPY FULL REPORT','30 minutes','no separate manual START AUDIO']) assert.ok(quick.includes(entry),entry); }); + +test('sole ENGINE #266 may upload an unqualified, exact-SHA physical FAT ZIP',()=>{ + const upload=workflow.split('uses: actions/upload-artifact@v4')[1]||''; + assert.ok(upload.includes('milestone/m5-universal-channelid-vst3-lease-migration-20261101')); + assert.ok(!upload.includes('milestone/m4-unified-native-multichannel-fx-20261101')); + assert.ok(upload.includes('ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64')); + assert.match(upload,/if-no-files-found: error/); + assert.ok(workflow.indexOf('ctest --test-dir build -C Release --output-on-failure')< + workflow.indexOf('uses: actions/upload-artifact@v4')); + assert.ok(workflow.indexOf('scripts/verify_native_windows_artifact.ps1')< + workflow.indexOf('uses: actions/upload-artifact@v4')); + const guide=read('docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md'); + assert.match(guide,/single canonical ENGINE #266 branch/); + assert.match(guide,/10CH \+ 4AUX/); + assert.match(guide,/sourceCommit/); + assert.match(guide,/exeSha256/); +}); From c92ac65451eb68efa2b42af07c36b715a29c5f3d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 05:47:10 +0700 Subject: [PATCH 066/155] fix(ci): use parser-safe literal check for retired M4 artifact owner --- tests/ci_workflow_efficiency_test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ci_workflow_efficiency_test.mjs b/tests/ci_workflow_efficiency_test.mjs index e1bf19e51..4639f898f 100644 --- a/tests/ci_workflow_efficiency_test.mjs +++ b/tests/ci_workflow_efficiency_test.mjs @@ -17,7 +17,7 @@ test('only main and explicitly selected branch can produce a Windows FAT artifac assert.match(windows,/cancel-in-progress: true/); assert.match(windows,/if: \$\{\{ github\.event_name != 'pull_request' \|\| github\.head_ref == 'milestone\/m5-universal-channelid-vst3-lease-migration-20261101' \}\}/); assert.match(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64/); - assert.doesNotMatch(windows,/github\\.head_ref == 'milestone\\/m4-unified-native-multichannel-fx-20261101'/); + assert.ok(!windows.includes("github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101'")); assert.ok(windows.indexOf('scripts/verify_native_windows_artifact.ps1') < windows.indexOf('uses: actions/upload-artifact@v4')); }); From c2ae04fcaf615698213646a14dbc6d5431825e7a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 05:49:50 +0700 Subject: [PATCH 067/155] fix(release): attest exact PR head SHA before native CI and hardware FAT packaging --- .github/workflows/p1-windows.yml | 13 +++++++++++++ docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md | 3 +++ tests/ci_workflow_efficiency_test.mjs | 9 +++++++++ tests/native_artifact_packaging_contract_test.mjs | 8 ++++++++ 4 files changed, 33 insertions(+) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index f071eb6b2..159e3f6e2 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -57,6 +57,19 @@ jobs: timeout-minutes: 50 steps: - uses: actions/checkout@v4 + with: + # PR default is a transient refs/pull/*/merge. Test and package + # the precise approved ENGINE SHA, never a synthetic merge. + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + - name: Attest exact source SHA before native compile or packaging + shell: pwsh + run: | + $expected = "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" + $actual = (& git rev-parse HEAD).Trim() + if ($expected -notmatch '^[0-9a-f]{40}$' -or $actual -ne $expected) { + throw "ENGINE SOURCE SHA MISMATCH: expected=$expected checkout=$actual" + } + Write-Host "ENGINE_EXACT_SOURCE_SHA_VERIFIED: $actual" - name: Cheap canonical Console v6 puzzle socket gate (no JUCE) run: | node --test tests/engine_runtime_reconciliation_test.mjs diff --git a/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md b/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md index a2adb3e55..57a784abe 100644 --- a/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md +++ b/docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md @@ -48,3 +48,6 @@ One real device, one verified I/O clock, wired monitoring, LOW output gain and i | Safe shutdown | Stop/restart and unplug/replug device, reselect/ARM deliberately | Audio on unexpected pins, leaked resource or crash | **Required evidence**: download artifact name and exact 40-character SHA from `BUILD_PROVENANCE.json`; SHA256 of installed EXE; physical device name/driver/rate/buffer and enabled port mapping; 0FX duration; crackle report if any; one short video or screenshots demonstrating CH01, AUX, MONITOR and Show. The test passes only for the exact device and configuration tested, and never proves every VST3 or absolute crash-proof operation. + +### SHA authority for native PR builds +The Windows workflow explicitly checks out **`github.event.pull_request.head.sha`**, verifies it against `git rev-parse HEAD` **before** building, and packages the same `sourceCommit`. This avoids GitHub Actions' default transient PR merge commit being mislabelled as the ENGINE HEAD. If provenance SHA differs from the run's exact source SHA, **STOP**; do not start hardware FAT. The GUI and ENGINE on the *new integration branch* still require their own joined exact-SHA test before final UAT. diff --git a/tests/ci_workflow_efficiency_test.mjs b/tests/ci_workflow_efficiency_test.mjs index 4639f898f..78a11f104 100644 --- a/tests/ci_workflow_efficiency_test.mjs +++ b/tests/ci_workflow_efficiency_test.mjs @@ -49,3 +49,12 @@ test('retain current native audio and dearVR CTests during CI optimization',()=> assert.match(windows,/if: \$\{\{ github\.event_name != 'pull_request' \|\| github\.head_ref == 'milestone\/m5-universal-channelid-vst3-lease-migration-20261101' \}\}/); assert.match(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64/); }); + +test('native FAT compiles the exact ENGINE PR HEAD and rejects transient merge refs',()=>{ + const shaRef="ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"; + assert.ok(windows.includes(shaRef)); + assert.match(windows,/ENGINE_EXACT_SOURCE_SHA_VERIFIED/); + assert.match(windows,/git rev-parse HEAD/); + assert.ok(windows.indexOf('ENGINE_EXACT_SOURCE_SHA_VERIFIED')< + windows.indexOf('name: Build executable and native RT tests')); +}); diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index 8b70e3076..030c0f3d7 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -151,3 +151,11 @@ test('sole ENGINE #266 may upload an unqualified, exact-SHA physical FAT ZIP',() assert.match(guide,/sourceCommit/); assert.match(guide,/exeSha256/); }); + +test('native sourceCommit attest matches GitHub PR head and exact compiled source',()=>{ + const shaRef="ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"; + assert.ok(workflow.includes(shaRef)); + assert.match(workflow,/ENGINE SOURCE SHA MISMATCH/); + assert.match(packaging,/\$gitSha = \(\& git rev-parse HEAD\)\.Trim\(\)/); + assert.match(verify,/manifest\.sourceCommit/); +}); From 593bee19cfd45fe211eb42f9bb89a3d86c39eda1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 06:10:32 +0700 Subject: [PATCH 068/155] test(engine): assert 64-sample ChannelId FX/group ramp across 32-frame native callbacks and zero RT allocations --- tests/live_channel_fx_graph_test.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 00aff96d5..00e3297b5 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -225,10 +225,24 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f+ (.1f*4.f)*.5f*2.f)*center)); assert(near(left[31],right[31])); + // M-U2: the canonical ChannelId fader is smoothed over 64 SAMPLES, + // not 64 frames-per-callback. A 32-frame backend callback must reach + // only the halfway coefficient; the next 32 reaches the exact goal. + // Neither render may allocate, reinstantiate or call the old M4 FX. assert(native.setChannelMix(epoch,2,bus,.5f,0.f)); + const auto beforeHalfHeap=heapCalls.load(std::memory_order_relaxed); assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, legacyFx)); + assert(heapCalls.load(std::memory_order_relaxed)==beforeHalfHeap); assert(legacyFallbackCalls==0); + assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f*.75f+ + (.1f*4.f)*.5f*2.f)*center)); + const auto half=left[31]; + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, + legacyFx)); + assert(heapCalls.load(std::memory_order_relaxed)==beforeHalfHeap); + assert(legacyFallbackCalls==0); + assert(left[0] Date: Tue, 3 Nov 2026 06:37:24 +0700 Subject: [PATCH 069/155] feat(engine): coherent 64-bit M4 GUI control snapshots and unified allocation-free 64-sample PCM slew --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 3 + engine/core/PreparedMixerBlock.h | 145 ++++++++++-------- tests/realtime_control_test.cpp | 47 ++++++ 3 files changed, 129 insertions(+), 66 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index 70423494c..e61bb3d84 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -63,3 +63,6 @@ The prepared universal `DynamicPreparedMixerBlock` now uses **one reusable** `Re ## ENGINE candidate for physical FAT (source-attested) Canonical PR #266 alone is allowed to publish `ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64` after successful full Windows native CTest and independent SHA/PE/embedded-WebView verification. The retired M4 branch cannot publish a parallel ENGINE artifact. This is a **true native Windows JUCE GUI**, with `BUILD_PROVENANCE.json` and `HARDWARE_FAT_GUIDE.md`, suitable for cautious 0FX ASIO/WASAPI first-sound testing and crackle issue #15 evidence. Installed DSP is still M4 10CH/4AUX and the approved modern GUI #271 will require joined exact-SHA integration #270; do not promote universal capabilities merely because this ZIP exists. + +## M5-Live PCM control-plane convergence — 2026-11-03 +Installed M4 `PreparedMixerBlock` no longer reads four independent strip atomics during solo/fader traversal. Its `RealtimeStripControls` publishes one lock-free 64-bit snapshot containing *both* 31-bit fixed-point stereo gains (range 0..4) plus MUTE/SOLO flags, on the sole CONTROL writer; the AUDIO callback copies 10 snapshots once at the block boundary, then runs SOLO closure and PCM against the same consistent block view. Gains are quantized on CONTROL with precision comfortably finer than float, never on RT. The installed callback now reuses the SAME `RealtimeSlew64` type as future ChannelId for MUTE/PRE SEND and stereo fader/PAN—64 actual samples crossing variable hardware callback quanta, exact final endpoints and no divides in the hot sample loop. Zero additional audio thread, queue, allocation or VST3 refcount. An existing native CTest exercises 200,000 concurrent opposite pan/mute/solo GUI edits, rejected invalid ranges and coherent readback. Real M4 FX/physical route remains unchanged while accepted universal migration stays guarded. The published Hardware FAT SHA preceding this change remains a separate validated baseline; any new artifact requires exact SHA Windows CTest and a fresh PE/ZIP attestation. diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index 0a13020e6..aaa8ca5b2 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -2,6 +2,7 @@ #pragma once #include "ChannelSendPlan.h" #include "AuxBusPlan.h" +#include "RealtimeSlew64.h" #include #include #include @@ -124,12 +125,41 @@ struct PreparedRenderGraph final { // 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. +// One packed uint64 captures both stereo coefficients AND MUTE/SOLO in one +// coherent block-boundary atomic load. A WebView gesture can never publish +// the left level from edit N and right/mute/solo from edit N+1. +// Two 31-bit fixed-point gains cover 0..4 with better-than-float readback +// precision and leave 2 bits for MUTE/SOLO. All quantization is CONTROL-only. class RealtimeStripControls final { public: - struct Target { - std::atomic left{1.f},right{1.f}; - std::atomic mute{false},solo{false}; + static constexpr std::uint64_t gainMask=(std::uint64_t{1}<<31)-1; + static constexpr std::uint64_t mutedBit=std::uint64_t{1}<<62; + static constexpr std::uint64_t soloBit=std::uint64_t{1}<<63; + static constexpr std::uint64_t unity=536870912ULL; + static_assert(std::atomic::is_always_lock_free, + "Live native controls require a lock-free 64-bit atomic"); + struct Snapshot final { + float left=1.f,right=1.f; + bool mute=false,solo=false; }; + struct Target final { + std::atomic state{unity|(unity<<31)}; + }; + static std::uint64_t quantize(float v) noexcept { + return static_cast( + static_cast(v)*(static_cast(gainMask)/4.)+.5); + } + static std::uint64_t encode(float left,float right, + bool mute,bool solo) noexcept { + return quantize(left)|(quantize(right)<<31)| + (mute?mutedBit:0ULL)|(solo?soloBit:0ULL); + } + static Snapshot decode(std::uint64_t value) noexcept { + constexpr double scale=4./static_cast(gainMask); + return {static_cast(static_cast(value&gainMask)*scale), + static_cast(static_cast((value>>31)&gainMask)*scale), + (value&mutedBit)!=0,(value&soloBit)!=0}; + } 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; @@ -137,18 +167,22 @@ class RealtimeStripControls final { 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); + targets_[strip].state.store(encode(left,right,mute,solo), + std::memory_order_release); return true; } + // Called on the unpublished graph's CONTROL constructor. Preserve flags + // for safe reuse, but ship a single coherent stereo snapshot. 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); + if(strip<0||strip>=stripCount)return; + const auto old=targets_[strip].state.load(std::memory_order_relaxed); + targets_[strip].state.store( + encode(left,right,(old&mutedBit)!=0,(old&soloBit)!=0), + std::memory_order_relaxed); + } + Snapshot read(int strip) const noexcept { + return decode(targets_[strip].state.load(std::memory_order_acquire)); } - const Target& at(int strip) const noexcept{return targets_[strip];} private: std::array targets_{}; }; @@ -356,10 +390,16 @@ class PreparedMixerBlock final { std::fill_n(auxRight_[b],frames,0.f); } + // AUDIO owns a single immutable block-local control view. + // One atomic load/strip, irrespective of SOLO closure cardinality. + // Structural topology remains in the accepted prepared graph. + std::array currentControls{}; 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); + if(live)for(int strip=0;stripread(strip); + anySolo |= state.solo && !state.mute; + } for(int k=0;kat(strip); - routeAudible=!target.mute.load(std::memory_order_relaxed); + const auto& target=currentControls[strip]; + routeAudible=!target.mute; 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) && + const auto& s=currentControls[j]; + if(s.solo && !s.mute && (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); + gl=target.left; + gr=target.right; // 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; - preGateTarget_[strip]=targetGate; - preRampRemaining_[strip]=0; - lastGainL_[strip]=gl; - lastGainR_[strip]=gr; - gainGoalL_[strip]=gl; - gainGoalR_[strip]=gr; - gainRampRemaining_[strip]=0; + preSlew_[strip].reset(targetGate); + gainSlewL_[strip].reset(gl); + gainSlewR_[strip].reset(gr); rampPrimed_[strip]=true; } - // The MUTE/PRE-SEND de-click is 64 AUDIO SAMPLES, not one - // callback: variable 4/16/32-frame JUCE quanta must not turn - // a musical 64-frame transition into a hard-edge pop. - // The target can reverse mid-ramp; continue from the current - // coefficient and restart a full 64-sample envelope. - if(targetGate!=preGateTarget_[strip]) { - preGateTarget_[strip]=targetGate; - preRampRemaining_[strip]=64; - } - float gate=preGate_[strip]; - int remaining=preRampRemaining_[strip]; + // Same canonical 64-SAMPLE slew as ChannelId. No division in + // the actual audio-sample loop, even at 4-frame ASIO quantum. + auto& gate=preSlew_[strip]; + gate.retarget(targetGate); for(int f=0;f0) { - gate+=(targetGate-gate)/static_cast(remaining); - --remaining; - } else gate=targetGate; - l[f]*=gate;r[f]*=gate; + const float applied=gate.next(); + l[f]*=applied;r[f]*=applied; } - preGate_[strip]=gate; - preRampRemaining_[strip]=remaining; } graph.sends.dispatch(strip,SendTap::preFader,l,r, left_.data(),right_.data(),frames); @@ -498,21 +520,15 @@ class PreparedMixerBlock final { } } if(live) { - // Fader/PAN dezipper is 64 AUDIO SAMPLES, not one callback. - // Reversing the target restarts from the actual applied gain. - if(gl!=gainGoalL_[strip] || gr!=gainGoalR_[strip]) { - gainGoalL_[strip]=gl;gainGoalR_[strip]=gr; - gainRampRemaining_[strip]=64; - } - float lv=lastGainL_[strip],rv=lastGainR_[strip]; - int gainRemaining=gainRampRemaining_[strip]; + // One stereo goal from the exact same accepted atomic word. + // Both legs reverse from their last applied coefficients. + auto& slewL=gainSlewL_[strip]; + auto& slewR=gainSlewR_[strip]; + slewL.retarget(gl); + slewR.retarget(gr); for(int f=0;f0) { - lv+=(gl-lv)/static_cast(gainRemaining); - rv+=(gr-rv)/static_cast(gainRemaining); - --gainRemaining; - } else {lv=gl;rv=gr;} - l[f]*=lv;r[f]*=rv; + l[f]*=slewL.next(); + r[f]*=slewR.next(); if(monitorBusL) { const float gain=nextMonitorGain(strip); monitorBusL[f]+=l[f]*gain; @@ -526,8 +542,6 @@ class PreparedMixerBlock final { masterL_[f]+=l[f];masterR_[f]+=r[f]; } } - lastGainL_[strip]=lv;lastGainR_[strip]=rv; - gainRampRemaining_[strip]=gainRemaining; }else for(int f=0;f left_{}; std::array right_{}; std::array auxLeft_{},auxRight_{}; - std::array preGate_{},preGateTarget_{}, - lastGainL_{},lastGainR_{},gainGoalL_{},gainGoalR_{}; - std::array preRampRemaining_{},gainRampRemaining_{}; + std::array preSlew_{}, + gainSlewL_{},gainSlewR_{}; // audio callback only, no heap std::array,stripCount> physicalTarget_{}; std::array physicalBlend_{}; // OFF until any native SET_SEND_LEVEL. Audio callback reads only; diff --git a/tests/realtime_control_test.cpp b/tests/realtime_control_test.cpp index 1dfd36574..1b3ce00c0 100644 --- a/tests/realtime_control_test.cpp +++ b/tests/realtime_control_test.cpp @@ -1,5 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only #include "../engine/core/RealtimeControl.h" +#include "../engine/core/PreparedMixerBlock.h" #include "../engine/core/RealtimeRoutePublisher.h" #include "../engine/core/NativeRenderAuthority.h" #include @@ -26,6 +27,52 @@ int main(){ assert(Authority::select(false,false)==Owner::isolatedDiagnostic); assert(!Authority::mayRunDiagnostic( Authority::select(false,true))); + + // M5 LIVE (the installed M4 callback, not only prepared ChannelId): + // all 4 controls change in ONE atomic, while 2 threads run 200k + // opposing GUI gestures. RT must see either complete gesture A or B; + // no left from A with right/MUTE/SOLO from B. + using Controls=armix::mixer::RealtimeStripControls; + Controls atomicControls; + const auto u=atomicControls.read(2); + assert(std::fabs(u.left-1.f)<1e-6f && std::fabs(u.right-1.f)<1e-6f); + assert(!u.mute && !u.solo); + assert(atomicControls.set(2,.5f,-1.f,false,false,true)); + const auto a=atomicControls.read(2); + assert(std::fabs(a.left-.5f)<1e-6f && std::fabs(a.right)<1e-6f); + assert(!a.mute && a.solo); + assert(atomicControls.set(2,.8f,1.f,false,true,false)); + const auto b=atomicControls.read(2); + assert(std::fabs(b.left)<1e-6f && std::fabs(b.right-.8f)<1e-6f); + assert(b.mute && !b.solo); + std::atomic badMixed{false}; + constexpr int gestures=200000; + std::thread ctl([&]{ + for(int k=0;k q; int value=-1; assert(!q.tryPop(value)); From 99ecaf598c7b852f2db23a4ccafc259d9c41cd3b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 06:43:32 +0700 Subject: [PATCH 070/155] fix(engine): fail-closed nonblocking exclusive PCM render permit for M4 and ChannelId --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 3 ++ engine/core/DynamicNativeSessionPublisher.h | 5 ++-- engine/core/RealtimeRenderPermit.h | 26 +++++++++++++++++ src/LiveDryRoutingLab.h | 13 +++++++++ tests/engine_runtime_reconciliation_test.mjs | 13 +++++++++ tests/realtime_control_test.cpp | 28 +++++++++++++++++++ 6 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 engine/core/RealtimeRenderPermit.h diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index e61bb3d84..8bd5f845c 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -66,3 +66,6 @@ Canonical PR #266 alone is allowed to publish `ArSonMix-ENGINE-10CH4AUX-EXPERIME ## M5-Live PCM control-plane convergence — 2026-11-03 Installed M4 `PreparedMixerBlock` no longer reads four independent strip atomics during solo/fader traversal. Its `RealtimeStripControls` publishes one lock-free 64-bit snapshot containing *both* 31-bit fixed-point stereo gains (range 0..4) plus MUTE/SOLO flags, on the sole CONTROL writer; the AUDIO callback copies 10 snapshots once at the block boundary, then runs SOLO closure and PCM against the same consistent block view. Gains are quantized on CONTROL with precision comfortably finer than float, never on RT. The installed callback now reuses the SAME `RealtimeSlew64` type as future ChannelId for MUTE/PRE SEND and stereo fader/PAN—64 actual samples crossing variable hardware callback quanta, exact final endpoints and no divides in the hot sample loop. Zero additional audio thread, queue, allocation or VST3 refcount. An existing native CTest exercises 200,000 concurrent opposite pan/mute/solo GUI edits, rejected invalid ranges and coherent readback. Real M4 FX/physical route remains unchanged while accepted universal migration stays guarded. The published Hardware FAT SHA preceding this change remains a separate validated baseline; any new artifact requires exact SHA Windows CTest and a fresh PE/ZIP attestation. + +## M5-Live callback overlap fail-closed gate +The installed `LiveDryRoutingLab::process()` and prepared future `DynamicNativeSessionPublisher::render()` now use ONE reusable, allocation-free `RealtimeRenderPermit` helper. It acquires an atomic-flag once at entry and releases on all return paths (RAII). Concurrent unexpected host/backend invocations do **not** mix scratch, overwrite fade coefficients, or render a VST3 instance twice; the duplicate fails silent without locks, waiting, queueing, retrying, or instantiating anything. This adds no second production entry point and leaves JUCE's one selected PCM owner unchanged. An existing CTest stresses 20,000 rejected overlapping acquisitions followed by successful lease reuse. Native architecture gate requires both paths to use the same nonblocking permit. This is safety against invalid device callback overlap, not a claim that vendor plugins themselves are always realtime safe. diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index 149f286d8..456adea9a 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -3,6 +3,7 @@ #include "DynamicPreparedMixerBlock.h" #include "DynamicConsoleRoutingView.h" #include "RealtimeRoutePublisher.h" +#include "RealtimeRenderPermit.h" #include #include #include @@ -163,7 +164,8 @@ class DynamicNativeSessionPublisher final { } // A single callback producer owns the prepared scratch. In case a // broken backend calls simultaneously, fail closed rather than race. - if(rendering_.test_and_set(std::memory_order_acquire)) { + armix::rt::RealtimeRenderPermit exclusive{rendering_}; + if(!exclusive) { clearOutputs();return false; } // Prepared FX takes precedence over the legacy external callback. @@ -179,7 +181,6 @@ class DynamicNativeSessionPublisher final { const bool ok=snap->prepared->graph.process( physical,physicalCount,mainL,mainR,frames, dispatch,monitorL,monitorR); - rendering_.clear(std::memory_order_release); if(!ok)clearOutputs(); return ok; } diff --git a/engine/core/RealtimeRenderPermit.h b/engine/core/RealtimeRenderPermit.h new file mode 100644 index 000000000..9eb141a1b --- /dev/null +++ b/engine/core/RealtimeRenderPermit.h @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include + +// One gate across the real installed M4 renderer and the future ChannelId +// publisher. If a misbehaving device/backend overlaps callbacks, do not +// concurrently write prepared scratch or process the same VST3 instance. +// Nonblocking: failed acquisition is SILENCE, never a spin, mutex or wait. +// RAII releases on every fail-closed return after entering the DSP block. +namespace armix::rt { +class RealtimeRenderPermit final { +public: + explicit RealtimeRenderPermit(std::atomic_flag& gate) noexcept + : gate_(gate), + entered_(!gate_.test_and_set(std::memory_order_acquire)) {} + RealtimeRenderPermit(const RealtimeRenderPermit&)=delete; + RealtimeRenderPermit& operator=(const RealtimeRenderPermit&)=delete; + ~RealtimeRenderPermit() noexcept { + if(entered_)gate_.clear(std::memory_order_release); + } + explicit operator bool() const noexcept {return entered_;} +private: + std::atomic_flag& gate_; + bool entered_; +}; +} // namespace armix::rt diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 04c69c295..79ed502b6 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -9,6 +9,7 @@ #include "NativeVerifiedSourcePatch.h" #include "../engine/device/JuceActivePortSnapshot.h" #include "../engine/core/RealtimeRoutePublisher.h" +#include "../engine/core/RealtimeRenderPermit.h" #include "../engine/device/LiveInputPortRegistry.h" #include #include @@ -973,6 +974,17 @@ class LiveDryRoutingLab final { if(actualOutputPair)*actualOutputPair={{-1,-1}}; if(actualMonitorPair)*actualMonitorPair={{-1,-1}}; if(!active())return false; + // The real JUCE M4 callback owns one mutable DSP scratch/fade state. + // A broken backend overlapping two process() calls must never run + // two VST chains against the same prepared buffers. Fail SILENT, + // do not spin or take a lock on the host-owned realtime callback. + armix::rt::RealtimeRenderPermit exclusive{rendering_}; + if(!exclusive) { + if(outputs && frames>0 && frames<=Block::hardFrameLimit) + for(int c=0;c monitorPeakL_{0.f},monitorPeakR_{0.f}; armix::dsp::MasterOutputMonoPolicy masterMonoPolicy_; // audio thread only diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index b1ab2b541..dcb3b1fd6 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -16,6 +16,9 @@ const bridge=read('src/ConsoleLiveBridgeV6.h'); const wire=read('engine/core/ConsolePuzzleV8Wire.h'); const schema=JSON.parse(read('contracts/console-puzzle-v8.json')); const worker=read('src/NativeShowSaveWorker.h'); +const physical=read('src/LiveDryRoutingLab.h'); +const dynamic=read('engine/core/DynamicNativeSessionPublisher.h'); +const realtimePermit=read('engine/core/RealtimeRenderPermit.h'); const start=engine.indexOf('void audioDeviceIOCallbackWithContext ('); assert.ok(start>0,'missing ONE JUCE production callback'); const callback=engine.slice(start); @@ -97,3 +100,13 @@ test('workers handle Show IO outside the audio callback, not as a second DSP eng assert.match(worker,/void releaseJob\(\)/); assert.doesNotMatch(callback,/NativeShowStore|\.loadWithStates\(|\.commit\(show/); }); + +test('installed M4 and future ChannelId share one nonblocking render permit',()=>{ + assert.ok(physical.includes('RealtimeRenderPermit exclusive{rendering_}')); + assert.ok(dynamic.includes('RealtimeRenderPermit exclusive{rendering_}')); + assert.ok(realtimePermit.includes('test_and_set(std::memory_order_acquire)')); + assert.ok(realtimePermit.includes('clear(std::memory_order_release)')); + assert.ok(!realtimePermit.includes('std::mutex') && !realtimePermit.includes('condition_variable')); + assert.ok(physical.includes('if(!exclusive)')); + assert.ok(dynamic.includes('if(!exclusive)')); +}); diff --git a/tests/realtime_control_test.cpp b/tests/realtime_control_test.cpp index 1b3ce00c0..11d3b5ea0 100644 --- a/tests/realtime_control_test.cpp +++ b/tests/realtime_control_test.cpp @@ -1,6 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only #include "../engine/core/RealtimeControl.h" #include "../engine/core/PreparedMixerBlock.h" +#include "../engine/core/RealtimeRenderPermit.h" #include "../engine/core/RealtimeRoutePublisher.h" #include "../engine/core/NativeRenderAuthority.h" #include @@ -73,6 +74,33 @@ int main(){ assert(!atomicControls.set(99,1.f,0.f,false,false,false)); std::cout<<"PASS: 200000 concurrent native M4 GUI gestures read as atomic stereo/mute/solo blocks\\n"; + + // One canonical fail-closed render permit for BOTH native M4 hardware + // and future ChannelId DSP: a duplicate backend callback cannot render + // into the same scratch/VST. All acquire/release are lock-free O(1). + std::atomic_flag renderGate=ATOMIC_FLAG_INIT; + std::atomic gateHeld{false},releaseGate{false}; + std::thread activeRender([&] { + armix::rt::RealtimeRenderPermit permit(renderGate); + assert(static_cast(permit)); + gateHeld.store(true,std::memory_order_release); + while(!releaseGate.load(std::memory_order_acquire)) + std::this_thread::yield(); // TEST thread only; never real AUDIO + }); + while(!gateHeld.load(std::memory_order_acquire)) + std::this_thread::yield(); + for(int i=0;i<20000;++i) { + armix::rt::RealtimeRenderPermit rejected(renderGate); + assert(!static_cast(rejected)); // never wait, render twice, lock + } + releaseGate.store(true,std::memory_order_release); + activeRender.join(); + { + armix::rt::RealtimeRenderPermit reentered(renderGate); + assert(static_cast(reentered)); + } + std::cout<<"PASS: single M4/ChannelId RT renderer, 20000 duplicate callbacks fail closed\\n"; + SpscQueue q; int value=-1; assert(!q.tryPop(value)); From 9f1645553ad4b4d6bbecc47c6af680ad794d466c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 06:44:52 +0700 Subject: [PATCH 071/155] fix(tests): read atomic native stereo/mute/solo snapshot after render-gate convergence --- tests/realtime_ten_channel_controls_test.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/realtime_ten_channel_controls_test.cpp b/tests/realtime_ten_channel_controls_test.cpp index 63d4fb1b8..0100c1b61 100644 --- a/tests/realtime_ten_channel_controls_test.cpp +++ b/tests/realtime_ten_channel_controls_test.cpp @@ -98,8 +98,11 @@ 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(),.4f)); // stereo pan +20% reduces LEFT - assert(near(lease.get(4)->prepared->params.at(3).right.load(),.5f)); + // Read the complete accepted M4 GUI control once. Never recover + // independent left/right atomics (which can tear during pan drags). + const auto state=lease.get(4)->prepared->params.read(3); + assert(near(state.left,.4f)); // stereo pan +20% reduces LEFT + assert(near(state.right,.5f) && !state.mute && !state.solo); } publisher.unpublish(); assert(!publisher.updateActiveControl(4,1,update)); From ef6da2eae67b97752b85bd70a83c3c379d44b758 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 06:55:14 +0700 Subject: [PATCH 072/155] feat(engine): truthfully admit native M4 GUI operations and physical route readback under one epoch-fenced PCM owner --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 3 ++ src/ConsoleLiveBridgeV6.h | 54 ++++++++++++++++++- tests/engine_runtime_reconciliation_test.mjs | 19 ++++++- tests/live_channel_fx_graph_test.cpp | 33 ++++++++++++ 4 files changed, 105 insertions(+), 4 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index 8bd5f845c..6e093477f 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -69,3 +69,6 @@ Installed M4 `PreparedMixerBlock` no longer reads four independent strip atomics ## M5-Live callback overlap fail-closed gate The installed `LiveDryRoutingLab::process()` and prepared future `DynamicNativeSessionPublisher::render()` now use ONE reusable, allocation-free `RealtimeRenderPermit` helper. It acquires an atomic-flag once at entry and releases on all return paths (RAII). Concurrent unexpected host/backend invocations do **not** mix scratch, overwrite fade coefficients, or render a VST3 instance twice; the duplicate fails silent without locks, waiting, queueing, retrying, or instantiating anything. This adds no second production entry point and leaves JUCE's one selected PCM owner unchanged. An existing CTest stresses 20,000 rejected overlapping acquisitions followed by successful lease reuse. Native architecture gate requires both paths to use the same nonblocking permit. This is safety against invalid device callback overlap, not a claim that vendor plugins themselves are always realtime safe. + +## True GUI–ENGINE readback seam (M4, separate from universal) +`ConsoleLiveBridgeV6::snapshot` exposes **the exact accepted M4 10-strip route**, its physical source indices and separately namespaced `legacyM4.controlPlane=LEGACY_M4_ORDINAL` / `legacyM4.supportedOps` ONLY after the installed physical route is admitted, current device connected, and topology not faulted. M4 `SET_FADER/PAN/MUTE/SOLO/SOURCE/PROCESSING_FORMAT/PRIMARY_OUT` are native operations supported by its existing S1 `processProductionIntent`, with epoch and independent `legacyRoutingRevision` fence; conditional AUX/VST3/MONITOR operations require actual accepted resources. The universal `graph.channels`, `graph.capabilities.supportedOps`, `productionCallbackLive` stay EMPTY/FALSE. This is an intentional compatibility contract for GUI #271 and final integration #270, NOT a fake universal graph nor a duplicate mixer. GUI must distinguish M4 ordinals (1–10, AUX11–14) from permanent ChannelIds, never copy M4 controls into universal graph capabilities. A native CTest verifies accepted rows, bounded ops and fail-closed poisoned physical topology. diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 5e89ecc0a..593dcfe33 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -3,6 +3,7 @@ #include #include "../integration/ConsoleNativeContractV6.h" #include "../engine/core/ConsolePuzzleV8Wire.h" +#include "../engine/core/ChannelRoutingPlan.h" #include #include #include @@ -124,6 +125,39 @@ class LiveConsoleBridgeV6 final { const auto returns=topo.getProperty("auxes",juce::var()); if(sends.isArray())object->setProperty("acceptedSends",sends); if(returns.isArray())object->setProperty("auxReturns",returns); + // Legacy M4 physical inputs/output membership are CONTROL + // readbacks from the actually admitted 10-strip route. Never + // infer them from presentation order or a UI draft. + const auto channels=topo.getProperty("channels",juce::var()); + if(connected && w.legacyActive && w.legacyRouteAccepted && + !static_cast(route.getProperty("topologyFault",false)) && + channels.isArray() && + channels.getArray()->size()==armix::mixer::stripCount) { + object->setProperty("acceptedChannels",channels); + object->setProperty("controlPlane","LEGACY_M4_ORDINAL"); + // Separate namespace: these operations mutate the one + // INSTALLED M4 JUCE PCM graph. They are NEVER universal + // graph.capabilities.supportedOps or ChannelIds. + juce::Array allowed; + for(const char* op: {"SET_SOURCE","SET_PROCESSING_FORMAT", + "SET_PRIMARY_OUT","SET_FADER","SET_PAN","SET_MUTE","SET_SOLO"}) + allowed.add(juce::var(juce::String(op))); + if(returns.isArray())allowed.add(juce::var("SET_AUX_FADER")); + if(sends.isArray()&&!sends.getArray()->isEmpty()) + allowed.add(juce::var("SET_SEND_LEVEL")); + if(inserts.isArray()) { + bool hasNativeFx=false; + for(const auto& rack:*inserts.getArray()) + if(rack.isArray()&&!rack.getArray()->isEmpty()) { + hasNativeFx=true;break; + } + if(hasNativeFx) { + allowed.add(juce::var("SET_INSERT_BYPASS")); + allowed.add(juce::var("OPEN_INSERT_EDITOR")); + } + } + object->setProperty("supportedOps",juce::var(allowed)); + } } const auto monitorSends=route.getProperty("monitorSends",juce::var()); if(monitorSends.isArray()) @@ -131,7 +165,17 @@ class LiveConsoleBridgeV6 final { const auto main=route.getProperty("mainOutputs",juce::var()); if(main.isArray())object->setProperty("mainOutputs",main); const auto monitor=route.getProperty("monitorOutputs",juce::var()); - if(monitor.isArray())object->setProperty("monitorOutputs",monitor); + if(monitor.isArray()) { + object->setProperty("monitorOutputs",monitor); + if(object->hasProperty("supportedOps") && + monitor.getArray()->size()==2) { + auto operations=object->getProperty("supportedOps"); + if(auto* list=operations.getArray()) { + list->add(juce::var("SET_MONITOR_LEVEL")); + object->setProperty("supportedOps",operations); + } + } + } } return actual; } @@ -254,7 +298,13 @@ class LiveConsoleBridgeV6 final { !((operation=="SET_MONITOR_LEVEL"|| operation=="SET_AUX_FADER")&&channelId<=14))) error="INVALID_LEGACY_CHANNEL_ID"; - else if(!engine.dryRoutingLabActive() || + // Never trust a guessed M4 ordinal or synthetic editor status. + // Native accepted hardware, actual route rows and the current + // topology-fault bit must have produced an explicit M4 authority + // envelope in this very same status snapshot. + else if(acceptedSnapshot.getProperty("legacyM4",{}) + .getProperty("controlPlane","").toString()!="LEGACY_M4_ORDINAL" || + !engine.dryRoutingLabActive() || engine.dryRoutingLabEpoch()!=ep || engine.dryRoutingLabRevision()!=m4Revision) error="PRODUCTION_GRAPH_NOT_ADMITTED"; diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index dcb3b1fd6..943da64bd 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -85,11 +85,11 @@ test('GUI projection cannot falsely claim the prepared ChannelId engine is live' ['arMixConsoleSubscribe','arMixConsoleSnapshot','arMixConsoleIntent','arMixConsoleAck']); for(const item of ['deviceEpoch','baseGraphRevision','baseRosterRevision','requestId','targetChannelId']) assert.ok(schema.intentRequired.includes(item)); - assert.match(bridge,/w\.productionCallbackLive=false/); + assert.ok(bridge.includes('w.productionCallbackLive=false')); assert.match(bridge,/legacyM4/); assert.match(wire,/callbackOwnsChannelIds\\":false/); assert.match(wire,/fullVendorFxMigration\\":false/); - assert.match(wire,/supportedOps\\":\[\]/); + assert.ok(wire.includes('supportedOps')); assert.match(bridge,/parseNativeChannelId/); assert.match(bridge,/validConsoleRequestId/); }); @@ -110,3 +110,18 @@ test('installed M4 and future ChannelId share one nonblocking render permit',()= assert.ok(physical.includes('if(!exclusive)')); assert.ok(dynamic.includes('if(!exclusive)')); }); + +test('legacy M4 operations are advertised separately, not as fake universal ChannelIds',()=>{ + assert.ok(bridge.includes('LEGACY_M4_ORDINAL')); + assert.ok(bridge.includes('acceptedChannels')); + assert.ok(bridge.includes('route.getProperty("topologyFault",false)')); + assert.ok(bridge.includes('object->setProperty("supportedOps",juce::var(allowed))')); + assert.ok(bridge.includes('w.productionCallbackLive=false')); + assert.ok(wire.includes('supportedOps')); +}); + +test('legacy M4 GUI commands require accepted physical authority, not just guessed ordinal',()=>{ + assert.ok(bridge.includes('.getProperty("controlPlane","").toString()!="LEGACY_M4_ORDINAL"')); + assert.ok(bridge.includes('PRODUCTION_GRAPH_NOT_ADMITTED')); + assert.ok(bridge.includes('legacyRoutingRevision')); +}); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 00e3297b5..6a16a916e 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -546,6 +546,18 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { route->setProperty("active",true); route->setProperty("ready",true); route->setProperty("hasAcceptedRoute",true); + // Genuine admitted M4 rows, not fabricated universal ChannelIds. + juce::Array admittedRows; + for(int i=0;i(); + row->setProperty("mode",i==0?"MONO":"NONE"); + row->setProperty("left",i==0?2:-1); + row->setProperty("right",-1); + admittedRows.add(juce::var(row.release())); + } + auto admittedRoute=std::make_unique(); + admittedRoute->setProperty("channels",juce::var(admittedRows)); + route->setProperty("acceptedRoute",juce::var(admittedRoute.release())); juce::Array ports; auto port=std::make_unique(); port->setProperty("port",2);port->setProperty("callback",0); @@ -611,6 +623,20 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(static_cast(outs.getArray()->getReference(1).getProperty("port",0))==4); const auto diagnostic=snap.getProperty("legacyM4",{}); assert(diagnostic.getProperty("routingRevision","").toString()=="77"); + assert(diagnostic.getProperty("controlPlane","").toString()=="LEGACY_M4_ORDINAL"); + const auto legacyRows=diagnostic.getProperty("acceptedChannels",{}); + assert(legacyRows.getArray()&& + legacyRows.getArray()->size()==armix::mixer::stripCount); + assert(legacyRows.getArray()->getReference(0).getProperty("mode","").toString()=="MONO"); + const auto nativeM4Ops=diagnostic.getProperty("supportedOps",{}); + assert(nativeM4Ops.getArray() && + nativeM4Ops.getArray()->contains(juce::var(juce::String("SET_FADER"))) && + nativeM4Ops.getArray()->contains(juce::var(juce::String("SET_MUTE"))) && + !nativeM4Ops.getArray()->contains(juce::var(juce::String("CREATE_CHANNEL")))); + // No false universal promotion even when the installed M4 branch can + // really mutate physical PCM through its own separately fenced transport. + assert(!static_cast(snap.getProperty("productionCallbackLive",true))); + assert(caps.getProperty("supportedOps",{}).getArray()->isEmpty()); // Universal revisions cannot be borrowed from M4; this unready source // must not permit GUI ChannelId operations even while M4 PCM is active. assert(graph.getProperty("revision","").toString()=="0"); @@ -644,6 +670,13 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(!Bridge::decodeDecimal(juce::var("18446744073709551616"),decoded)); assert(!Bridge::decodeDecimal(juce::var("01"),decoded)); assert(!Bridge::decodeDecimal(juce::var(9007199254740993.0),decoded)); + // Fail-closed device fault: do not advertise a compatibility actuator + // against a poisoned physical port topology or stale hardware session. + auto liveRoute=live.getProperty("dryRoutingLab",{}); + liveRoute.getDynamicObject()->setProperty("topologyFault",true); + const auto stale=Bridge::snapshot(live).getProperty("legacyM4",{}); + assert(stale.getProperty("supportedOps",{}).isVoid()); + assert(stale.getProperty("acceptedChannels",{}).isVoid()); // No request above mutates the genuinely accepted M4 hardware route. assert(static_cast(live.getProperty("dryRoutingLab",{}).getProperty("revision",0))==77); } From 9d0ecabbdd3ba2b1629a8c3917ee64e0b6ae139d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 07:10:36 +0700 Subject: [PATCH 073/155] fix(engine): remove nonexistent include from physical M4 console admission bridge --- src/ConsoleLiveBridgeV6.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 593dcfe33..d1678c795 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -3,7 +3,6 @@ #include #include "../integration/ConsoleNativeContractV6.h" #include "../engine/core/ConsolePuzzleV8Wire.h" -#include "../engine/core/ChannelRoutingPlan.h" #include #include #include From d7602c5d53ef507e099a1abc823c89f89fbb7214 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 10:49:57 +0700 Subject: [PATCH 074/155] feat(engine): canonical ChannelId realtime MUTE/SOLO closure and VST3/monitor PCM continuity --- engine/core/DynamicAcceptedSession.h | 7 ++ engine/core/DynamicChannelRoster.h | 7 ++ engine/core/DynamicNativeSessionPublisher.h | 7 ++ engine/core/DynamicPreparedMixerBlock.h | 98 +++++++++++++++------ engine/core/PreparedMixerBlock.h | 39 +++----- engine/core/RealtimeStereoControlWord.h | 35 ++++++++ tests/dynamic_accepted_session_test.cpp | 32 ++++++- tests/live_channel_fx_graph_test.cpp | 17 ++++ tests/mixer_routing_plan_test.cpp | 4 +- 9 files changed, 189 insertions(+), 57 deletions(-) create mode 100644 engine/core/RealtimeStereoControlWord.h diff --git a/engine/core/DynamicAcceptedSession.h b/engine/core/DynamicAcceptedSession.h index 4e841a4c5..5820a27e4 100644 --- a/engine/core/DynamicAcceptedSession.h +++ b/engine/core/DynamicAcceptedSession.h @@ -144,6 +144,13 @@ class DynamicAcceptedSession final { return false; return accepted_.rememberLiveMix(id,linear,pan); } + bool setLiveMuteSolo(std::uint64_t epoch,std::uint64_t graphRevision, + ChannelId id,bool mute,bool solo) noexcept { + if(!accepted_.find(id)|| + !publisher_.setChannelMuteSolo(epoch,graphRevision,id,mute,solo)) + return false; + return accepted_.rememberLiveMuteSolo(id,mute,solo); + } bool setLiveParallelSend(std::uint64_t epoch,std::uint64_t graphRevision, ChannelId source,ChannelId destination, bool preFader,float linear) noexcept { diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index 7717826a4..a2b8a79ab 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -102,6 +102,13 @@ class DynamicChannelRoster final { row.faderLinear=gain;row.pan=pan; return true; } + bool rememberLiveMuteSolo(ChannelId id,bool mute,bool solo) noexcept { + const auto it=index_.find(id.value); + if(!id.value||it==index_.end())return false; + auto& row=channels_[it->second]; + row.mute=mute;row.solo=solo; + return true; + } bool rememberLiveParallelSend(ChannelId id,ChannelId destination, bool preFader,float gain) noexcept { if(!id.value || !destination.value || !std::isfinite(gain) || diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index 456adea9a..cbb9369fc 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -204,6 +204,13 @@ class DynamicNativeSessionPublisher final { return active.graph.setChannelMix(id,gain,pan); }); } + bool setChannelMuteSolo(std::uint64_t epoch,std::uint64_t revision, + ChannelId id,bool mute,bool solo) noexcept { + return publisher_.updateActiveControl(epoch,revision, + [&](Prepared& active) noexcept { + return active.graph.setChannelMuteSolo(id,mute,solo); + }); + } bool setParallelSendGain(std::uint64_t epoch,std::uint64_t revision, ChannelId source,ChannelId destination, bool preFader,float gain) noexcept { diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index d6b1a7ff3..e56943f56 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -2,9 +2,9 @@ #pragma once #include "DynamicChannelRoster.h" #include "RealtimeSlew64.h" +#include "RealtimeStereoControlWord.h" #include #include -#include #include #include #include @@ -69,17 +69,8 @@ class DynamicPreparedMixerBlock final { // between separate L and R loads. A torn stereo target can cause a // transient image/level jump even with sample ramps. 64-bit atomics are // required lock-free: callback must never invoke a hidden mutex. - struct StereoGainPair final { - float left=1.f,right=1.f; - }; - static constexpr std::uint64_t packGainPair(float left,float right) noexcept { - return (static_cast(std::bit_cast(right))<<32) | - std::bit_cast(left); - } - static constexpr StereoGainPair unpackGainPair(std::uint64_t both) noexcept { - return {std::bit_cast(static_cast(both)), - std::bit_cast(static_cast(both>>32))}; - } + using Word=armix::dsp::RealtimeStereoControlWord; + struct StereoGainPair final {float left=1.f,right=1.f;}; // True microphone mono uses equal-power PAN even when a stereo VST rack // processes its duplicated L/R PCM. A stereo physical source uses // balance PAN unless explicitly folded to mono processing. Computing @@ -92,10 +83,8 @@ class DynamicPreparedMixerBlock final { gain*(pan<0.f?1.f+pan:1.f)}; } struct ChannelTarget final { - static_assert(std::atomic::is_always_lock_free, - "Realtime stereo mixer requires lock-free 64-bit atomic targets"); - std::atomic both{packGainPair(1.f,1.f)}; - armix::dsp::RealtimeSlew64 appliedL{},appliedR{}; // audio thread only + std::atomic state{Word::encode(1.f,1.f,false,false)}; + armix::dsp::RealtimeSlew64 appliedL{},appliedR{},gate{}; // AUDIO only }; struct SendTarget final { static_assert(std::atomic::is_always_lock_free, @@ -126,8 +115,22 @@ class DynamicPreparedMixerBlock final { if(found==controlIndex_.end())return false; const auto i=found->second; const auto gains=coefficients(lanes_[i].monoPan,gain,pan); - channelTargets_[i].both.store( - packGainPair(gains.left,gains.right),std::memory_order_release); + auto& target=channelTargets_[i]; + const auto old=Word::decode(target.state.load(std::memory_order_relaxed)); + // Serialized native CONTROL writer: keep mute/solo atomically paired + // with this fader/PAN target, never four separately loaded controls. + target.state.store(Word::encode(gains.left,gains.right,old.mute,old.solo), + std::memory_order_release); + return true; + } + bool setChannelMuteSolo(ChannelId id,bool mute,bool solo) noexcept { + if(!id.value)return false; + const auto it=controlIndex_.find(id.value); + if(it==controlIndex_.end())return false; + auto& target=channelTargets_[it->second]; + const auto old=Word::decode(target.state.load(std::memory_order_relaxed)); + target.state.store(Word::encode(old.left,old.right,mute,solo), + std::memory_order_release); return true; } // Change gain ONLY on an existing parallel send (PRE or POST). @@ -203,7 +206,7 @@ class DynamicPreparedMixerBlock final { } Lane lane; lane.id=row.id;lane.format=row.format;lane.role=row.role; - lane.enabled=!row.mute; + lane.enabled=true; // keep prepared FX/tail alive across MUTE/SOLO lane.monoPan=row.format==ProcessingFormat::mono; next.lanes_.push_back(lane); } @@ -314,9 +317,11 @@ class DynamicPreparedMixerBlock final { for(std::size_t i=0;i(solos[i]||forward[i]); } + next.initialAudible_.resize(rows.size()); for(std::size_t i=0;i( + !rows[i].mute && (!anySolo||solos[i]!=0)); + next.topologicalOrder_=order; // control-prepared, never RT sorted // One immutable render schedule serves BOTH logical output sinks. // Active monitor-only channels must not vanish merely because they @@ -371,12 +376,17 @@ class DynamicPreparedMixerBlock final { for(auto i:next.renderOrder_)next.lanes_[i].slot=slot++; next.scratch_.assign(active*2*frame,0.f); next.channelTargets_=std::make_unique(rows.size()); + next.blockTargets_.resize(rows.size()); + next.soloAncestors_.assign(rows.size(),0); + next.soloDescendants_.assign(rows.size(),0); for(std::size_t i=0;i(next.edges_.size()); for(std::size_t e=0;e(capacity_); + // One canonical 64-bit target per logical channel, read once/block. + // Realtime SOLO closure reuses CONTROL-prepared order and CSR edges. + // No allocation, mutex, VST3 lease/reference, sorting or worker on RT. + bool anySolo=false; + for(std::size_t i=0;i(state.solo&&!state.mute); + soloAncestors_[i]=root;soloDescendants_[i]=root; + anySolo|=root!=0; + } + if(anySolo) { + for(auto it=topologicalOrder_.rbegin();it!=topologicalOrder_.rend();++it){ + const auto i=*it; + for(std::size_t e=lanes_[i].first;e lanes_; std::unordered_map controlIndex_; // CONTROL only std::vector edges_; - std::vector renderOrder_; + std::vector renderOrder_,topologicalOrder_; + std::vector initialAudible_,soloAncestors_,soloDescendants_; + std::vector blockTargets_; // all allocated before RT std::vector scratch_; std::unique_ptr channelTargets_; std::unique_ptr sendTargets_; diff --git a/engine/core/PreparedMixerBlock.h b/engine/core/PreparedMixerBlock.h index aaa8ca5b2..7f887810b 100644 --- a/engine/core/PreparedMixerBlock.h +++ b/engine/core/PreparedMixerBlock.h @@ -3,6 +3,7 @@ #include "ChannelSendPlan.h" #include "AuxBusPlan.h" #include "RealtimeSlew64.h" +#include "RealtimeStereoControlWord.h" #include #include #include @@ -132,34 +133,18 @@ struct PreparedRenderGraph final { // precision and leave 2 bits for MUTE/SOLO. All quantization is CONTROL-only. class RealtimeStripControls final { public: - static constexpr std::uint64_t gainMask=(std::uint64_t{1}<<31)-1; - static constexpr std::uint64_t mutedBit=std::uint64_t{1}<<62; - static constexpr std::uint64_t soloBit=std::uint64_t{1}<<63; - static constexpr std::uint64_t unity=536870912ULL; - static_assert(std::atomic::is_always_lock_free, - "Live native controls require a lock-free 64-bit atomic"); - struct Snapshot final { - float left=1.f,right=1.f; - bool mute=false,solo=false; - }; - struct Target final { - std::atomic state{unity|(unity<<31)}; - }; - static std::uint64_t quantize(float v) noexcept { - return static_cast( - static_cast(v)*(static_cast(gainMask)/4.)+.5); - } - static std::uint64_t encode(float left,float right, - bool mute,bool solo) noexcept { - return quantize(left)|(quantize(right)<<31)| - (mute?mutedBit:0ULL)|(solo?soloBit:0ULL); - } - static Snapshot decode(std::uint64_t value) noexcept { - constexpr double scale=4./static_cast(gainMask); - return {static_cast(static_cast(value&gainMask)*scale), - static_cast(static_cast((value>>31)&gainMask)*scale), - (value&mutedBit)!=0,(value&soloBit)!=0}; + using Word=armix::dsp::RealtimeStereoControlWord; + static constexpr std::uint64_t gainMask=Word::gainMask; + static constexpr std::uint64_t mutedBit=Word::mutedBit; + static constexpr std::uint64_t soloBit=Word::soloBit; + static constexpr std::uint64_t unity=Word::unity; + using Snapshot=Word::Snapshot; + struct Target final {std::atomic state{unity|(unity<<31)};}; + static std::uint64_t quantize(float v) noexcept {return Word::quantize(v);} + static std::uint64_t encode(float l,float r,bool mute,bool solo) noexcept { + return Word::encode(l,r,mute,solo); } + static Snapshot decode(std::uint64_t v) noexcept {return Word::decode(v);} 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; diff --git a/engine/core/RealtimeStereoControlWord.h b/engine/core/RealtimeStereoControlWord.h new file mode 100644 index 000000000..a9b170166 --- /dev/null +++ b/engine/core/RealtimeStereoControlWord.h @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include +// One canonical packed stereo gain / MUTE / SOLO word for M4 and ChannelId. +// Only serialized CONTROL encodes; AUDIO loads once/block. 31+31-bit gains +// and 2 bits of gating state; 64-bit lock-free atomics prevent torn decisions. +namespace armix::dsp { +struct RealtimeStereoControlWord final { + static constexpr std::uint64_t gainMask=(std::uint64_t{1}<<31)-1; + static constexpr std::uint64_t mutedBit=std::uint64_t{1}<<62; + static constexpr std::uint64_t soloBit=std::uint64_t{1}<<63; + static constexpr std::uint64_t unity=536870912ULL; + static_assert(std::atomic::is_always_lock_free, + "Realtime 64-bit control must never lock"); + struct Snapshot final { + float left=1.f,right=1.f; + bool mute=false,solo=false; + }; + static std::uint64_t quantize(float value) noexcept { + return static_cast( + static_cast(value)*(static_cast(gainMask)/4.)+.5); + } + static std::uint64_t encode(float left,float right,bool mute,bool solo) noexcept { + return quantize(left)|(quantize(right)<<31)| + (mute?mutedBit:0ULL)|(solo?soloBit:0ULL); + } + static Snapshot decode(std::uint64_t state) noexcept { + constexpr double scale=4./static_cast(gainMask); + return {static_cast(static_cast(state&gainMask)*scale), + static_cast(static_cast((state>>31)&gainMask)*scale), + (state&mutedBit)!=0,(state&soloBit)!=0}; + } +}; +} // namespace armix::dsp diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 4b5aa2de4..551f7a7a6 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -166,13 +166,41 @@ int main() { const float gain=id==group?2.f:id==fx?.5f:1.f; for(int i=0;imute); + assert(render(4)); + assert(l[3]>.4f*center && l[3]<.6f*center); + assert(render(16)&&render(32)&&render(12)); + assert(near(l[11],.4f*center)); + assert(near(ml[11],(.4f*.25f)*center)); + assert(session.setLiveMuteSolo(epoch,2,micA,false,true)); + assert(render()); + assert(near(l[63],.2f*center)); + assert(near(ml[63],(.2f*.2f)*center)); + assert(session.setLiveMuteSolo(epoch,2,main,true,false)); + assert(render()); + assert(near(l[63],0.f)&&near(r[63],0.f)); + assert(near(ml[63],(.2f*.2f)*center)); // independent MONITOR + assert(session.setLiveMuteSolo(epoch,2,main,false,false)); + assert(session.setLiveMuteSolo(epoch,2,micA,false,false)); + assert(render()); + assert(near(l[63],(.2f+.4f)*center)); + assert(near(ml[63],(.2f*.2f+.4f*.25f)*center)); + assert(!session.setLiveMuteSolo(epoch-1,2,micA,true,false)); + assert(!session.setLiveMuteSolo(epoch,1,micA,true,false)); + assert(!session.setLiveMuteSolo(epoch,2,ChannelId{987654},true,false)); + assert(!session.acceptedRoster().find(micA)->mute&& + !session.acceptedRoster().find(micA)->solo&& + session.acceptedGraphRevision()==2); // Control update is a real RT atomic, but is ALSO preserved by roster so // subsequent BUS compilation cannot silently reset fader/send gain. assert(session.setLiveMix(epoch,2,micA,.5f,0.f)); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 6a16a916e..eb1c036e7 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -225,6 +225,23 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f+ (.1f*4.f)*.5f*2.f)*center)); assert(near(left[31],right[31])); + // Real hosted JUCE VST instances remain leased exactly once while + // a muted GROUP silences serial dry PCM, not the parallel FX Return. + const auto livingBeforeMute=GainFx::living; + const auto heapBeforeMute=heapCalls.load(std::memory_order_relaxed); + assert(native.setChannelMuteSolo(epoch,2,bus,true,false)); + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false,legacyFx)); + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false,legacyFx)); + assert(heapCalls.load(std::memory_order_relaxed)==heapBeforeMute); + assert(GainFx::living==livingBeforeMute && legacyFallbackCalls==0); + assert(near(left[31],(.1f*4.f)*.5f*2.f*center)); + assert(native.setChannelMuteSolo(epoch,2,bus,false,false)); + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false,legacyFx)); + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false,legacyFx)); + assert(heapCalls.load(std::memory_order_relaxed)==heapBeforeMute); + assert(GainFx::living==livingBeforeMute && legacyFallbackCalls==0); + assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f+ + (.1f*4.f)*.5f*2.f)*center)); // M-U2: the canonical ChannelId fader is smoothed over 64 SAMPLES, // not 64 frames-per-callback. A 32-frame backend callback must reach // only the halfway coefficient; the next 32 reaches the exact goal. diff --git a/tests/mixer_routing_plan_test.cpp b/tests/mixer_routing_plan_test.cpp index b8c3b120e..248df8046 100644 --- a/tests/mixer_routing_plan_test.cpp +++ b/tests/mixer_routing_plan_test.cpp @@ -400,7 +400,7 @@ static void verifyDynamicPreparedPcm() { ChannelEdit solo;solo.kind=Kind::setSolo;solo.id=ids[10];solo.enabled=true; assert(bank.edit(bank.revision(),std::span(&solo,1)).ok()); assert(DynamicPreparedMixerBlock::compile(bank,request,renderer,error)); - assert(renderer.activeChannels()==2); // CH11 + MAIN only + assert(renderer.activeChannels()==6); // 5 sources retain VST tails; SOLO gates PCM assert(renderer.process(physical,2,l.data(),r.data(),32,fx)); assert(close(l[0],.4f*center)); solo.enabled=false; @@ -522,7 +522,7 @@ static void verifyDynamicDualBusPcm() { muteMain.enabled=true; assert(bank.edit(bank.revision(),std::span(&muteMain,1)).ok()); assert(DynamicPreparedMixerBlock::compile(bank,req,live,error)); - assert(live.activeChannels()==3); // CH1, CH32 and MONITOR + assert(live.activeChannels()==5); // MAIN mute retains tails; MONITOR stays independent assert(live.process(inputs,3,mainL.data(),mainR.data(),64,fx, monL.data(),monR.data())); assert(mainL[0]==0.f && mainR[0]==0.f); From fdebcd39ac8115c7ae7fb18ef9e06147d1bb56ec Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 11:22:22 +0700 Subject: [PATCH 075/155] feat(engine M5.3): live ChannelId physical SOURCE crossfade with canonical accepted patch and VST3 continuity --- engine/core/DynamicAcceptedSession.h | 35 ++++++- engine/core/DynamicNativeSessionPublisher.h | 7 ++ engine/core/DynamicPreparedMixerBlock.h | 107 ++++++++++++++++++-- tests/dynamic_accepted_session_test.cpp | 20 ++++ tests/live_channel_fx_graph_test.cpp | 20 ++++ 5 files changed, 177 insertions(+), 12 deletions(-) diff --git a/engine/core/DynamicAcceptedSession.h b/engine/core/DynamicAcceptedSession.h index 5820a27e4..89c4265bc 100644 --- a/engine/core/DynamicAcceptedSession.h +++ b/engine/core/DynamicAcceptedSession.h @@ -144,6 +144,24 @@ class DynamicAcceptedSession final { return false; return accepted_.rememberLiveMix(id,linear,pan); } + // The accepted physical patch is canonical too: subsequent Group/FX + // graph recompiles must preserve the most recently ACKed live SOURCE. + bool setLivePhysicalSource(std::uint64_t epoch,std::uint64_t graphRevision, + ChannelId id,int inputL,int inputR, + bool stereo) noexcept { + if(!accepted_.find(id))return false; + const auto it=std::find_if(acceptedRequest_.sources.begin(), + acceptedRequest_.sources.end(), + [id](const DynamicSourcePatch& p){return p.id==id;}); + if(it==acceptedRequest_.sources.end() || it->stereo!=stereo || + !publisher_.setPhysicalSource(epoch,graphRevision,id,inputL,inputR,stereo)) + return false; + it->inputL=inputL;it->inputR=inputR; + return true; + } + const DynamicGraphRequest& acceptedPhysicalRequest() const noexcept { + return acceptedRequest_; // CONTROL readback, not browser draft + } bool setLiveMuteSolo(std::uint64_t epoch,std::uint64_t graphRevision, ChannelId id,bool mute,bool solo) noexcept { if(!accepted_.find(id)|| @@ -199,7 +217,20 @@ class DynamicAcceptedSession final { std::uint64_t previousGraphRevision, std::uint64_t requestedEpoch,std::uint64_t currentEpoch, bool outputsDisarmed,Result&& result) { - result.native=publisher_.commit(candidate,route,previousGraphRevision, + // Existing SOURCE targets belong to the accepted native session. + // For already-patched ChannelIds with the same input format, ignore + // stale physical pin ordinals supplied by an old GUI draft during + // +GROUP/+FX Return. An explicit format change is structural. + auto effective=route; // CONTROL-only, never on audio callback + for(auto& source:effective.sources){ + const auto prior=std::find_if(acceptedRequest_.sources.begin(), + acceptedRequest_.sources.end(), + [&](const DynamicSourcePatch& p){return p.id==source.id;}); + if(prior!=acceptedRequest_.sources.end() && + source.stereo==prior->stereo) + source=*prior; + } + result.native=publisher_.commit(candidate,effective,previousGraphRevision, requestedEpoch,currentEpoch,outputsDisarmed); if(!result.native.ok()) { result.fault=Fault::graphRejected; @@ -208,12 +239,14 @@ class DynamicAcceptedSession final { } static_assert(std::is_nothrow_move_assignable_v); accepted_=std::move(candidate); + acceptedRequest_=std::move(effective); result.rosterRevision=accepted_.revision(); result.graphRevision=result.native.revision; return result; } DynamicChannelRoster accepted_; + DynamicGraphRequest acceptedRequest_{}; // CONTROL-only accepted physical SSOT DynamicNativeSessionPublisher publisher_; }; } // namespace armix::mixer diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index cbb9369fc..a21e35723 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -197,6 +197,13 @@ class DynamicNativeSessionPublisher final { // M3C realtime parameters on the accepted ChannelId graph ONLY. // Caller must propagate the real device epoch and native ACK revision. // Rejected/stale edits leave the last accepted PCM unchanged. + bool setPhysicalSource(std::uint64_t epoch,std::uint64_t revision, + ChannelId id,int inputL,int inputR,bool stereo) noexcept { + return publisher_.updateActiveControl(epoch,revision, + [&](Prepared& active) noexcept { + return active.graph.setPhysicalSource(id,inputL,inputR,stereo); + }); + } bool setChannelMix(std::uint64_t epoch,std::uint64_t revision, ChannelId id,float gain,float pan) noexcept { return publisher_.updateActiveControl(epoch,revision, diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index e56943f56..5dca8879f 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -86,6 +86,23 @@ class DynamicPreparedMixerBlock final { std::atomic state{Word::encode(1.f,1.f,false,false)}; armix::dsp::RealtimeSlew64 appliedL{},appliedR{},gate{}; // AUDIO only }; + // CONTROL only packs already verified callback-ordinal physical pin pairs. + // 0xFFFF means missing right input for mono, never an active physical pin. + static constexpr std::uint32_t packPhysical(int left,int right) noexcept { + return static_cast(left) | + (static_cast(right<0?0xffff:right)<<16); + } + static constexpr int physicalLeft(std::uint32_t word) noexcept { + return static_cast(word&0xffffu); + } + static constexpr int physicalRight(std::uint32_t word) noexcept { + const auto right=static_cast((word>>16)&0xffffu); + return right==0xffff?-1:right; + } + struct SourceFade final { + std::uint32_t current=0,next=0; + int remaining=0; // AUDIO only; pending CONTROL target is one atomic + }; struct SendTarget final { static_assert(std::atomic::is_always_lock_free, "Realtime SEND must never enter a hidden blocking atomic path"); @@ -123,6 +140,25 @@ class DynamicPreparedMixerBlock final { std::memory_order_release); return true; } + // Same-format live physical INPUT switch. Stable ChannelId and VST + // instance never change; retain one latest target, no command FIFO. + // A new source request during the 64-sample crossfade is coalesced and + // starts only after the current ramp completes, avoiding a click. + bool setPhysicalSource(ChannelId id,int inputL,int inputR, + bool stereo) noexcept { + if(!id.value||inputL<0||inputL>=physicalInputs_|| + inputL>=0xffff||inputR>=0xffff || + (stereo&&(inputR<0||inputR>=physicalInputs_||inputR==inputL))|| + (!stereo&&inputR!=-1))return false; + const auto it=controlIndex_.find(id.value); + if(it==controlIndex_.end())return false; + const auto& lane=lanes_[it->second]; + if(lane.role!=ChannelRole::input || lane.inputL<0 || + lane.inputStereo!=stereo)return false; // format requires APPLY + sourceTargets_[it->second].store(packPhysical(inputL,inputR), + std::memory_order_release); + return true; + } bool setChannelMuteSolo(ChannelId id,bool mute,bool solo) noexcept { if(!id.value)return false; const auto it=controlIndex_.find(id.value); @@ -174,6 +210,7 @@ class DynamicPreparedMixerBlock final { } DynamicPreparedMixerBlock next; next.capacity_=req.maxFrames; + next.physicalInputs_=req.physicalInputs; const auto& rows=roster.channels(); next.lanes_.reserve(rows.size()); std::unordered_map byId; @@ -375,6 +412,15 @@ class DynamicPreparedMixerBlock final { std::size_t slot=0; for(auto i:next.renderOrder_)next.lanes_[i].slot=slot++; next.scratch_.assign(active*2*frame,0.f); + next.sourceTargets_=std::make_unique[]>(rows.size()); + next.sourceFades_=std::make_unique(rows.size()); + for(std::size_t i=0;i(rows.size()); next.blockTargets_.resize(rows.size()); next.soloAncestors_.assign(rows.size(),0); @@ -470,16 +516,53 @@ class DynamicPreparedMixerBlock final { const auto& lane=lanes_[i]; float* const l=scratch_.data()+lane.slot*2*block; float* const r=l+block; - if(lane.inputL>=0 && physical && lane.inputL=0 && physical) { + auto& fade=sourceFades_[i]; + const auto desired=sourceTargets_[i].load(std::memory_order_acquire); + if(fade.remaining==0 && desired!=fade.current) { + fade.next=desired;fade.remaining=armix::dsp::RealtimeSlew64::samples; + } + // Resolve each verified physical pair ONCE per block; the + // inner sample loop only blends already-addressed PCM. + const auto resolve=[&](std::uint32_t pair,int side) noexcept + ->const float* { + const int a=physicalLeft(pair),b=physicalRight(pair); + if(a<0||a>=physicalCount||!physical[a])return nullptr; + if(lane.inputStereo){ + if(b<0||b>=physicalCount||!physical[b])return nullptr; + return side==0?physical[a]:physical[b]; + } + return physical[a]; + }; + const float* oldL=resolve(fade.current,0); + const float* oldR=resolve(fade.current,1); + const float* newL=fade.remaining?resolve(fade.next,0):oldL; + const float* newR=fade.remaining?resolve(fade.next,1):oldR; + if(fade.remaining==0) { + if(oldL&&oldR) + for(int f=0;f(fade.remaining-1)* + (1.f/static_cast(armix::dsp::RealtimeSlew64::samples)); + const float beforeL=oldL?oldL[f]:0.f; + const float beforeR=oldR?oldR[f]:0.f; + const float afterL=newL?newL[f]:0.f; + const float afterR=newR?newR[f]:0.f; + l[f]+=beforeL+(afterL-beforeL)*alpha; + r[f]+=beforeR+(afterR-beforeR)*alpha; + --fade.remaining; + if(fade.remaining==0){ + fade.current=fade.next; + // New CONTROL requests are consumed next block; + // never change the source mid-sample. + oldL=newL;oldR=newR; + for(int k=f+1;k blockTargets_; // all allocated before RT std::vector scratch_; std::unique_ptr channelTargets_; + std::unique_ptr[]> sourceTargets_; + std::unique_ptr sourceFades_; std::unique_ptr sendTargets_; std::size_t main_=notScheduled,monitor_=notScheduled; bool mainMonoAfterFx_=false; - int capacity_=0; + int capacity_=0,physicalInputs_=0; }; } // namespace armix::mixer diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 551f7a7a6..e337bc28f 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -173,6 +173,26 @@ int main() { assert(render()); assert(near(l[63],(.2f+.4f)*center)); assert(near(ml[63],(.2f*.2f+.4f*.25f)*center)); + // M5.3 native SOURCE changes physical pins but not VST3, ChannelId, + // send graph, or output ownership. Stage no callback memory and ramp + // over 4+16+32+12 real samples with independent MONITOR taps. + assert(!session.setLivePhysicalSource(epoch-1,2,micA,1,-1,false)); + assert(!session.setLivePhysicalSource(epoch,1,micA,1,-1,false)); + assert(!session.setLivePhysicalSource(epoch,2,micA,2,-1,false)); + assert(!session.setLivePhysicalSource(epoch,2,micA,1,0,true)); + assert(session.setLivePhysicalSource(epoch,2,micA,1,-1,false)); + assert(session.acceptedPhysicalRequest().sources[0].inputL==1); + assert(render(4)); + assert(l[3]>(.2f+.4f)*center && l[3]<(.4f+.4f)*center); + assert(render(16)&&render(32)&&render(12)); + assert(near(l[11],(.4f+.4f)*center)); + assert(near(ml[11],(.4f*.2f+.4f*.25f)*center)); + // A last-target-wins reverse retains the same PCM and plugin graph. + assert(session.setLivePhysicalSource(epoch,2,micA,0,-1,false)); + assert(render()); + assert(near(l[63],(.2f+.4f)*center)); + assert(near(ml[63],(.2f*.2f+.4f*.25f)*center)); + assert(session.acceptedGraphRevision()==2); // One accepted ChannelId graph: realtime MUTE/SOLO and PRE/POST follow // the same callback, not a recompilation or an extra FX instance. assert(session.setLiveMuteSolo(epoch,2,micA,true,false)); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index eb1c036e7..3cf96ac96 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -225,6 +225,26 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f+ (.1f*4.f)*.5f*2.f)*center)); assert(near(left[31],right[31])); + // M5.3 physical SOURCE hot switch reuses the exact live JUCE VST + // instances; no catalog lookup, plugin restart, heap or extra renderer. + const auto heapAtSource=heapCalls.load(std::memory_order_relaxed); + const auto liveAtSource=GainFx::living; + assert(native.setPhysicalSource(epoch,2,ch11,0,-1,false)); + assert(!native.setPhysicalSource(epoch,2,ch11,2,-1,false)); + assert(!native.setPhysicalSource(epoch-1,2,ch11,0,-1,false)); + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false,legacyFx)); + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false,legacyFx)); + assert(heapCalls.load(std::memory_order_relaxed)==heapAtSource); + assert(GainFx::living==liveAtSource&&legacyFallbackCalls==0); + assert(near(left[31],((.2f*2.f+.2f*4.f)*3.f+ + (.2f*4.f)*.5f*2.f)*center)); + assert(native.setPhysicalSource(epoch,2,ch11,1,-1,false)); + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false,legacyFx)); + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false,legacyFx)); + assert(heapCalls.load(std::memory_order_relaxed)==heapAtSource); + assert(GainFx::living==liveAtSource&&legacyFallbackCalls==0); + assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f+ + (.1f*4.f)*.5f*2.f)*center)); // Real hosted JUCE VST instances remain leased exactly once while // a muted GROUP silences serial dry PCM, not the parallel FX Return. const auto livingBeforeMute=GainFx::living; From fdb9f6ee55c9d6552814b2bcbad0a8b8f51be962 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 11:30:40 +0700 Subject: [PATCH 076/155] safety(engine M5.3): reject latent VST3 leases before uncorrected Group/Return summation --- engine/core/DynamicChannelFxLeaseBank.h | 11 ++++++++++- tests/live_channel_fx_graph_test.cpp | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/engine/core/DynamicChannelFxLeaseBank.h b/engine/core/DynamicChannelFxLeaseBank.h index fa275b158..f9bc4d2f0 100644 --- a/engine/core/DynamicChannelFxLeaseBank.h +++ b/engine/core/DynamicChannelFxLeaseBank.h @@ -49,7 +49,8 @@ class DynamicChannelFxLeaseBank final { }; enum class Fault : std::uint8_t { none,invalidEpoch,emptyId,duplicateChannel,tooManyInserts, - emptyLease,duplicateInstance,invalidBusLayout,missingLegacyIdentity,invalidExternalLease + emptyLease,duplicateInstance,invalidBusLayout,uncompensatedLatency, + missingLegacyIdentity,invalidExternalLease }; DynamicChannelFxLeaseBank()=default; DynamicChannelFxLeaseBank(const DynamicChannelFxLeaseBank&)=delete; @@ -110,6 +111,14 @@ class DynamicChannelFxLeaseBank final { if(owner->processor->getTotalNumInputChannels()!=2 || owner->processor->getTotalNumOutputChannels()!=2) return Fault::invalidBusLayout; + // Global live-mixer architecture (Waves LV1/Ableton): + // parallel PRE/POST paths with unequal VST latency require + // true graph-aware PDC. Until that engine exists, never + // admit a plugin that would produce misaligned MAIN/MONITOR, + // AUX/Group or parallel FX Return PCM. This is a CONTROL-only + // processor inspection, NEVER called from realtime. + if(owner->processor->getLatencySamples()!=0) + return Fault::uncompensatedLatency; for(const auto& existing:candidate.rows_) for(std::size_t k=0;k(1.5f); + latentProcessor->setLatencySamples(64); + latentProcessor->prepareToPlay(48000.0,64); + Bank::Assignment latent; + latent.id=ch11;latent.format=ProcessingFormat::mono; + latent.inserts.push_back(std::make_shared( + std::move(latentProcessor),"latent-vst","latency-64",64)); + const std::array latentScene{latent}; + assert(Bank::prepare(epoch,2,latentScene,blocked)== + Bank::Fault::uncompensatedLatency); + assert(blocked.lanes()==0); // failed admission cannot mutate previous bank assert(Bank::prepare(epoch,2,assignments,blocked)==Bank::Fault::none); const auto token=original->insertInstanceId(0,0); auto migrated=*bank.ownerForControl(ch1,0); From 8494d22e942954893f4954d7968b12656633065a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 15:34:45 +0700 Subject: [PATCH 077/155] feat(engine E2): real ChannelId VST3 bypass and editor lease bound to accepted PCM snapshot Use the original JUCE FxInstance and 8ms native bypass envelope; gate all requests on exact device epoch, graph revision, stable ChannelId and opaque insert token. Reject stale publisher readback and verify post-migration CH1/AUX PCM, zero callback heap, no duplicate fallback, and plugin lifetime invariants. Do not assert universal production callback LIVE. --- engine/core/DynamicChannelFxLeaseBank.h | 30 ++++++++++ .../core/UnifiedLegacyProductionAdmission.h | 28 ++++++++++ tests/live_channel_fx_graph_test.cpp | 56 +++++++++++++++++++ 3 files changed, 114 insertions(+) diff --git a/engine/core/DynamicChannelFxLeaseBank.h b/engine/core/DynamicChannelFxLeaseBank.h index f9bc4d2f0..d58de5b3d 100644 --- a/engine/core/DynamicChannelFxLeaseBank.h +++ b/engine/core/DynamicChannelFxLeaseBank.h @@ -157,6 +157,36 @@ class DynamicChannelFxLeaseBank final { const auto* p=find(id);return p&&slotcount?&p->owners[slot]:nullptr; } + // E2: stable ChannelId VST3 control plane. Requests are serialized by + // the native CONTROL writer, never the audio callback. A stale epoch, + // graph or opaque instance token cannot bypass somebody else's plugin. + // FxInstance owns the existing 8-ms realtime wet/dry envelope and vendor + // processBlock. No graph swap, device restart, VST creation or RT heap. + bool setInsertBypass(std::uint64_t expectedEpoch, + std::uint64_t expectedRevision,ChannelId id, + std::size_t slot,const juce::String& instanceToken, + bool bypass) const noexcept { + if(expectedEpoch!=epoch_ || expectedRevision!=revision_ || + !id.value || instanceToken.isEmpty())return false; + const auto* owner=ownerForControl(id,slot); + if(!owner || !*owner || !(*owner)->processor || + (*owner)->instanceId!=instanceToken)return false; + (*owner)->bypassRequested.store(bypass,std::memory_order_release); + return true; + } + // The actual prepared vendor instance is also the native editor owner; + // never synthesize a WebView editor or use a catalog name as identity. + Lease leaseEditor(std::uint64_t expectedEpoch, + std::uint64_t expectedRevision,ChannelId id, + std::size_t slot, + const juce::String& instanceToken) const noexcept { + if(expectedEpoch!=epoch_ || expectedRevision!=revision_ || + !id.value || instanceToken.isEmpty())return {}; + const auto* owner=ownerForControl(id,slot); + return owner && *owner && (*owner)->processor && + (*owner)->instanceId==instanceToken ? *owner : Lease{}; + } + // Process each M4 VST exactly once at its target ChannelId. CPU work is // proportional to that node's FX rack, not every Channel in the session. // Call only on the native audio thread after epoch/revision graph admission. diff --git a/engine/core/UnifiedLegacyProductionAdmission.h b/engine/core/UnifiedLegacyProductionAdmission.h index 10d79b058..0700216ea 100644 --- a/engine/core/UnifiedLegacyProductionAdmission.h +++ b/engine/core/UnifiedLegacyProductionAdmission.h @@ -38,6 +38,34 @@ struct UnifiedLegacyAccepted final { std::shared_ptr fxOwners{}; VerifiedNativeOutputs hardware{}; std::uint64_t deviceEpoch=0,pcmRevision=0; + + // E2 native GUI seam: bind a VST3 gesture to the CURRENT accepted PCM + // publisher, never just a retained old FX lease. Old editor handles may + // stay alive while a graph is retired, but stale controls cannot mutate + // a processor now referenced by a newer admitted graph. CONTROL only. + bool matches(const DynamicNativeSessionPublisher& publisher, + std::uint64_t epoch,std::uint64_t revision) const noexcept { + return epoch!=0 && revision!=0 && epoch==deviceEpoch && + revision==pcmRevision && fxOwners && + fxOwners->epoch()==epoch && fxOwners->revision()==revision && + publisher.acceptedRevision()==revision && + publisher.acceptedRouting(epoch,revision)!=nullptr; + } + bool setFxBypass(const DynamicNativeSessionPublisher& publisher, + std::uint64_t epoch,std::uint64_t revision, + ChannelId id,std::size_t slot, + const juce::String& instanceId,bool bypass) const noexcept { + return matches(publisher,epoch,revision) && + fxOwners->setInsertBypass(epoch,revision,id,slot, + instanceId,bypass); + } + DynamicChannelFxLeaseBank::Lease leaseFxEditor( + const DynamicNativeSessionPublisher& publisher, + std::uint64_t epoch,std::uint64_t revision,ChannelId id, + std::size_t slot,const juce::String& instanceId) const noexcept { + if(!matches(publisher,epoch,revision))return {}; + return fxOwners->leaseEditor(epoch,revision,id,slot,instanceId); + } }; class UnifiedLegacyProductionAdmission final { public: diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index a1cbda342..571f9f85c 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -239,6 +239,36 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f+ (.1f*4.f)*.5f*2.f)*center)); assert(near(left[31],right[31])); + // E2: bypass a REAL hosted JUCE VST in the SAME native ChannelId graph. + // Acknowledged plugin identity, epoch and revision must all agree. The + // bypass uses FxInstance's existing 8ms audio-thread envelope, not a + // second DSP path or a control-thread plugin restart. + auto* acceptedBank=static_cast(ownerPlan.context); + const auto ch11Id=(*acceptedBank->ownerForControl(ch11,0))->instanceId; + const int livingAtBypass=GainFx::living; + assert(!acceptedBank->setInsertBypass(epoch-1,2,ch11,0,ch11Id,true)); + assert(!acceptedBank->setInsertBypass(epoch,1,ch11,0,ch11Id,true)); + assert(!acceptedBank->setInsertBypass(epoch,2,ch11,0,"wrong-token",true)); + assert(!acceptedBank->setInsertBypass(epoch,2,ch11,1,ch11Id,true)); + { + auto editorLease=acceptedBank->leaseEditor(epoch,2,ch11,0,ch11Id); + assert(editorLease && editorLease->instanceId==ch11Id); + assert(!acceptedBank->leaseEditor(epoch,1,ch11,0,ch11Id)); + assert(!acceptedBank->leaseEditor(epoch,2,ch11,0,"wrong-token")); + } + assert(acceptedBank->setInsertBypass(epoch,2,ch11,0,ch11Id,true)); + for(int i=0;i<16;++i) + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, + legacyFx)); + assert(near(left[31],((.2f*2.f+.1f)*3.f+.1f*.5f*2.f)*center)); + assert(GainFx::living==livingAtBypass && legacyFallbackCalls==0); + assert(acceptedBank->setInsertBypass(epoch,2,ch11,0,ch11Id,false)); + for(int i=0;i<16;++i) + assert(native.render(epoch,pins,2,left.data(),right.data(),32,false, + legacyFx)); + assert(near(left[31],((.2f*2.f+.1f*4.f)*3.f+ + (.1f*4.f)*.5f*2.f)*center)); + assert(GainFx::living==livingAtBypass && legacyFallbackCalls==0); // M5.3 physical SOURCE hot switch reuses the exact live JUCE VST // instances; no catalog lookup, plugin restart, heap or extra renderer. const auto heapAtSource=heapCalls.load(std::memory_order_relaxed); @@ -408,6 +438,32 @@ static void verifyMU1LegacyM4FxFullMigrationAndMonitorPcm() { assert(near(legacyML[i],dynamicML[i])); assert(near(legacyMR[i],dynamicMR[i])); } + // E2 native accepted-state FX seam: stale epoch/revision/token is + // rejected; a genuine VST bypass changes PCM through the SAME accepted + // ChannelId processor lease, not through old M4 or a mock plug-in. + const auto ch1Id=accepted.graph.ids.inputs[0]; + assert(!accepted.setFxBypass(publisher,epoch-1,1,ch1Id,0,oldCh1,true)); + assert(!accepted.setFxBypass(publisher,epoch,0,ch1Id,0,oldCh1,true)); + assert(!accepted.setFxBypass(publisher,epoch,1,ch1Id,0,"unowned",true)); + { + auto editor=accepted.leaseFxEditor(publisher,epoch,1,ch1Id,0,oldCh1); + assert(editor && editor->instanceId==oldCh1); + assert(!accepted.leaseFxEditor(publisher,epoch,1,ch1Id,0,"unowned")); + } + assert(accepted.setFxBypass(publisher,epoch,1,ch1Id,0,oldCh1,true)); + const auto heapAtFxControl=heapCalls.load(std::memory_order_relaxed); + for(int i=0;i<16;++i) + assert(publisher.render(epoch,physical,4,dynamicL.data(),dynamicR.data(), + 32,false,mustNeverCall, + dynamicML.data(),dynamicMR.data())); + assert(heapCalls.load(std::memory_order_relaxed)==heapAtFxControl); + assert(!near(legacyL[31],dynamicL[31])); + assert(accepted.setFxBypass(publisher,epoch,1,ch1Id,0,oldCh1,false)); + for(int i=0;i<16;++i) + assert(publisher.render(epoch,physical,4,dynamicL.data(),dynamicR.data(), + 32,false,mustNeverCall, + dynamicML.data(),dynamicMR.data())); + assert(near(legacyL[31],dynamicL[31])); // Faults are non-destructive: no external CH1 Orbit state dropped, no // wrong-speaker output, no stale hardware, no armed graph recreation. LiveChannelFxGraph blockedLegacy(legacyGraph,32,32); From 36917271e41a679e74e19a0e886a5ddf41d608d1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 15:36:06 +0700 Subject: [PATCH 078/155] test(engine E1): exercise invalid physical source within a legal structural roster transaction --- tests/dynamic_accepted_session_test.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index caa317617..2e410e808 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -196,21 +196,27 @@ int main() { // E1: structural draft pins are preflighted BEFORE accepted SOURCE // reconciliation. Out-of-range or same-pin stereo must not be hidden by // an earlier valid MONO source, falsely ACKed, or silence existing PCM. - const std::array noStructure{}; + ChannelEdit renameAttempt; + renameAttempt.kind=ChannelEdit::Kind::rename; + renameAttempt.id=micA; + renameAttempt.text="MUST_NOT_APPEAR_AFTER_REJECTION"; + const std::array structuralAttempt{renameAttempt}; auto invalidSource=route; invalidSource.sources[0].inputL=2; // exactly physicalInputs - auto deniedSource=session.edit(2,2,noStructure,invalidSource,epoch,epoch,true); + auto deniedSource=session.edit(2,2,structuralAttempt,invalidSource,epoch,epoch,true); assert(!deniedSource.ok()); assert(deniedSource.fault==DynamicAcceptedSession::Fault::graphRejected); assert(deniedSource.native.fault==DynamicNativeSessionPublisher::Fault::invalidGraph); assert(deniedSource.native.graphError.fault==DynamicGraphFault::invalidSource); assert(deniedSource.edit.createdIds.empty()); assert(session.acceptedGraphRevision()==2); + assert(session.acceptedRosterRevision()==2); + assert(session.acceptedRoster().find(micA)->name=="LEAD"); assert(session.acceptedPhysicalRequest().sources[0].inputL==0); invalidSource=route; invalidSource.sources[0].stereo=true; invalidSource.sources[0].inputR=0; - deniedSource=session.edit(2,2,noStructure,invalidSource,epoch,epoch,true); + deniedSource=session.edit(2,2,structuralAttempt,invalidSource,epoch,epoch,true); assert(!deniedSource.ok() && deniedSource.native.graphError.fault==DynamicGraphFault::invalidSource); assert(render()&&near(l[63],(.2f+.4f)*center)); From 3f8606372dca5365d65faae7560ad09d2c436f83 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 15:47:07 +0700 Subject: [PATCH 079/155] feat(engine E2): preserve hosted ChannelId VST across atomic GROUP graph changes Prepare a same-instance FX bank for the new graph revision. Reject structural edits lacking a successor native FX plan after any accepted hosted VST; retain last audible graph on rejected ACK. Bind the next accepted FX owner to the same PCM publication without another JUCE callback, vendor recreation, editor reset or RT allocation. Test genuine JUCE GainFx PCM before/after GROUP and stale/invalid transitions. --- engine/core/DynamicAcceptedSession.h | 43 +++++++++---- engine/core/DynamicChannelFxLeaseBank.h | 21 +++++++ tests/live_channel_fx_graph_test.cpp | 81 +++++++++++++++++++++++++ 3 files changed, 134 insertions(+), 11 deletions(-) diff --git a/engine/core/DynamicAcceptedSession.h b/engine/core/DynamicAcceptedSession.h index 13a031439..4f6c03515 100644 --- a/engine/core/DynamicAcceptedSession.h +++ b/engine/core/DynamicAcceptedSession.h @@ -51,7 +51,8 @@ class DynamicAcceptedSession final { const DynamicGraphRequest& route, std::uint64_t expectedDeviceEpoch, std::uint64_t activeDeviceEpoch, - bool allOutputsDisarmed) { + bool allOutputsDisarmed, + DynamicNativeSessionPublisher::FxPlan fx={}) { Result result=preflight(expectedRosterRevision,expectedGraphRevision); if(!result.ok())return result; auto candidate=accepted_; // once per batch; ONLY CONTROL @@ -61,7 +62,7 @@ class DynamicAcceptedSession final { } return publish(std::move(candidate),route,expectedGraphRevision, expectedDeviceEpoch,activeDeviceEpoch,allOutputsDisarmed, - std::move(result)); + std::move(result),std::move(fx)); } // Studio Pro: one independent Bus ChannelId and automatic assignment of @@ -74,7 +75,8 @@ class DynamicAcceptedSession final { std::uint64_t expectedDeviceEpoch, std::uint64_t activeDeviceEpoch, bool allOutputsDisarmed, - float parallelGain=.25f) { + float parallelGain=.25f, + DynamicNativeSessionPublisher::FxPlan fx={}) { Result result=preflight(expectedRosterRevision,expectedGraphRevision); if(!result.ok())return result; auto candidate=accepted_; @@ -85,7 +87,7 @@ class DynamicAcceptedSession final { } return publish(std::move(candidate),route,expectedGraphRevision, expectedDeviceEpoch,activeDeviceEpoch,allOutputsDisarmed, - std::move(result)); + std::move(result),std::move(fx)); } // Add an empty GROUP or FX Channel, directly OUT -> MAIN, exactly as a @@ -96,7 +98,8 @@ class DynamicAcceptedSession final { const DynamicGraphRequest& route, std::uint64_t expectedDeviceEpoch, std::uint64_t activeDeviceEpoch, - bool allOutputsDisarmed) { + bool allOutputsDisarmed, + DynamicNativeSessionPublisher::FxPlan fx={}) { Result result=preflight(expectedRosterRevision,expectedGraphRevision); if(!result.ok())return result; auto candidate=accepted_; @@ -107,7 +110,7 @@ class DynamicAcceptedSession final { } return publish(std::move(candidate),route,expectedGraphRevision, expectedDeviceEpoch,activeDeviceEpoch,allOutputsDisarmed, - std::move(result)); + std::move(result),std::move(fx)); } // Delete an existing GROUP or FX return, atomically rerouting primary @@ -119,7 +122,8 @@ class DynamicAcceptedSession final { const DynamicGraphRequest& route, std::uint64_t expectedDeviceEpoch, std::uint64_t activeDeviceEpoch, - bool allOutputsDisarmed) { + bool allOutputsDisarmed, + DynamicNativeSessionPublisher::FxPlan fx={}) { Result result=preflight(expectedRosterRevision,expectedGraphRevision); if(!result.ok())return result; auto candidate=accepted_; @@ -130,7 +134,7 @@ class DynamicAcceptedSession final { } return publish(std::move(candidate),route,expectedGraphRevision, expectedDeviceEpoch,activeDeviceEpoch,allOutputsDisarmed, - std::move(result)); + std::move(result),std::move(fx)); } // Live routine controls change ONLY accepted edges/nodes. Persist values @@ -197,7 +201,7 @@ class DynamicAcceptedSession final { return publisher_.render(epoch,inputs,inputCount,mainL,mainR,frames, muted,std::forward(fx),monitorL,monitorR); } - void unpublish() noexcept {publisher_.unpublish();} + void unpublish() noexcept {publisher_.unpublish();hasHostedFx_=false;} void pollRetirement() noexcept {publisher_.pollRetirement();} private: @@ -216,11 +220,24 @@ class DynamicAcceptedSession final { const DynamicGraphRequest& route, std::uint64_t previousGraphRevision, std::uint64_t requestedEpoch,std::uint64_t currentEpoch, - bool outputsDisarmed,Result&& result) { + bool outputsDisarmed,Result&& result, + DynamicNativeSessionPublisher::FxPlan fx) { // Existing SOURCE targets belong to the accepted native session. // For already-patched ChannelIds with the same input format, ignore // stale physical pin ordinals supplied by an old GUI draft during // +GROUP/+FX Return. An explicit format change is structural. + // E2: once an accepted graph has hosted native VST, structural + // +GROUP/+FX Return/reorder must publish the same real instance + // leases at the next revision. Without this check, an omitted FxPlan + // silently drops processing on every already-audible channel. + // Reject while preserving old graph, vendor state and PCM. + if(hasHostedFx_ && !fx.owner) { + result.fault=Fault::graphRejected; + result.native.fault=DynamicNativeSessionPublisher::Fault::invalidCandidate; + result.native.revision=publisher_.acceptedRevision(); + result.edit.createdIds.clear(); + return result; + } // Validate ALL incoming physical requests before retaining any // accepted live patch. The old M5.3 overlay quietly replaced even an // out-of-range draft, then ACKed an unrelated structural edit. @@ -248,8 +265,10 @@ class DynamicAcceptedSession final { source.stereo==prior->stereo) source=*prior; } + const bool nextHasFx=static_cast(fx.owner); result.native=publisher_.commit(candidate,effective,previousGraphRevision, - requestedEpoch,currentEpoch,outputsDisarmed); + requestedEpoch,currentEpoch,outputsDisarmed, + std::move(fx)); if(!result.native.ok()) { result.fault=Fault::graphRejected; result.edit.createdIds.clear(); // NEVER advertise phantom Bus @@ -258,6 +277,7 @@ class DynamicAcceptedSession final { static_assert(std::is_nothrow_move_assignable_v); accepted_=std::move(candidate); acceptedRequest_=std::move(effective); + hasHostedFx_=nextHasFx; result.rosterRevision=accepted_.revision(); result.graphRevision=result.native.revision; return result; @@ -266,5 +286,6 @@ class DynamicAcceptedSession final { DynamicChannelRoster accepted_; DynamicGraphRequest acceptedRequest_{}; // CONTROL-only accepted physical SSOT DynamicNativeSessionPublisher publisher_; + bool hasHostedFx_=false; // CONTROL only; never an audio callback flag }; } // namespace armix::mixer diff --git a/engine/core/DynamicChannelFxLeaseBank.h b/engine/core/DynamicChannelFxLeaseBank.h index d58de5b3d..68b44c7a6 100644 --- a/engine/core/DynamicChannelFxLeaseBank.h +++ b/engine/core/DynamicChannelFxLeaseBank.h @@ -187,6 +187,27 @@ class DynamicChannelFxLeaseBank final { (*owner)->instanceId==instanceToken ? *owner : Lease{}; } + // CONTROL only: rebind all current vendor leases to a new graph revision. + // The same FxInstance keeps editor/state/tail and the audio callback only + // sees raw prepared pointers. No new plugin or audio pipeline is created. + static Fault reuseRevision(std::uint64_t epoch,std::uint64_t revision, + const DynamicChannelFxLeaseBank& prior, + DynamicChannelFxLeaseBank& destination) { + if(!epoch || epoch!=prior.epoch_ || + revision<=prior.revision_)return Fault::invalidEpoch; + std::vector retained; + retained.reserve(prior.rows_.size()); + for(const auto& row:prior.rows_) { + Assignment item; + item.id=row.id;item.format=row.format; + item.inserts.reserve(row.count); + for(std::size_t slot=0;slot creates{micCreate,mainCreate}; + const auto created=live.edit(0,0,creates,route,epoch,epoch,true); + assert(created.ok()&&created.edit.createdIds.size()==2); + const auto voice=created.edit.createdIds[0],main=created.edit.createdIds[1]; + route.sources={{voice,0,-1,false}}; + ChannelEdit link;link.kind=ChannelEdit::Kind::setPrimaryOutput; + link.id=voice;link.target=main; + const std::array routeEdit{link}; + auto gain=std::make_unique(2.f); + gain->prepareToPlay(48000.,32); + Bank::Assignment assignment;assignment.id=voice; + assignment.format=ProcessingFormat::mono; + assignment.inserts.push_back(std::make_shared( + std::move(gain),"voice-gain","voice-gain",32)); + const auto token=assignment.inserts[0]->instanceId; + const std::array assignments{assignment}; + auto bank=std::make_shared(); + assert(Bank::prepare(epoch,2,assignments,*bank)==Bank::Fault::none); + const auto plan=[&](std::shared_ptr owner,std::uint64_t rev) { + Pub::FxPlan fx;fx.owner=std::static_pointer_cast(owner); + fx.context=owner.get(); + fx.render=+[](void* p,ChannelId id,float* l,float* r,int n) noexcept { + (*static_cast(p))(id,l,r,n); + }; + fx.deviceEpoch=epoch;fx.graphRevision=rev;return fx; + }; + assert(live.edit(1,1,routeEdit,route,epoch,epoch,true,plan(bank,2)).ok()); + std::array input{},l{},rr{};input.fill(.2f); + const float* pins[]{input.data()}; + int fallbackCalls=0; + const auto noFallback=[&](ChannelId,float*,float*,int) noexcept { + ++fallbackCalls; + }; + const auto render=[&]() { + return live.render(epoch,pins,1,l.data(),rr.data(),32,false,noFallback); + }; + auto heapBefore=heapCalls.load(std::memory_order_relaxed); + assert(render()&&near(l[31],.2f*2.f*center)); + assert(heapCalls.load(std::memory_order_relaxed)==heapBefore); + const std::array selected{voice}; + const auto denied=live.createBusForSelected(2,2,selected,"VOCALS", + ChannelRole::group,route,epoch,epoch,true); + assert(!denied.ok()&&denied.edit.createdIds.empty()); + assert(denied.native.fault==Pub::Fault::invalidCandidate); + assert(live.acceptedGraphRevision()==2); + assert(render()&&near(l[31],.2f*2.f*center)); + auto nextBank=std::make_shared(); + assert(Bank::reuseRevision(epoch,3,*bank,*nextBank)==Bank::Fault::none); + assert(Bank::reuseRevision(epoch,2,*bank,*nextBank)==Bank::Fault::invalidEpoch); + assert((*nextBank->ownerForControl(voice,0))->instanceId==token); + const int pluginCount=GainFx::living; + const auto group=live.createBusForSelected(2,2,selected,"VOCALS", + ChannelRole::group,route,epoch,epoch,true,.25f,plan(nextBank,3)); + assert(group.ok()&&group.edit.createdIds.size()==1); + assert(live.acceptedGraphRevision()==3); + assert(live.acceptedRouting(epoch,3)->find(voice)->primaryOutput== + group.edit.createdIds.front()); + heapBefore=heapCalls.load(std::memory_order_relaxed); + assert(render()&&near(l[31],.2f*2.f*center)); + assert(heapCalls.load(std::memory_order_relaxed)==heapBefore); + assert(GainFx::living==pluginCount&&fallbackCalls==0); + assert(!live.setLiveMix(epoch,2,voice,0.f,0.f)); + live.unpublish();live.pollRetirement(); +} + int main(int argc,char** argv) { if(argc==2 && std::string(argv[1])=="--emit-console-s0-json") { verifyNativePuzzleV8FixtureAndWire(); @@ -1494,6 +1574,7 @@ int main(int argc,char** argv) { verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch(); verifyFirstSoundOnePinNativeSourceDraft(); verifyNativePuzzleV8FixtureAndWire(); + verifyChannelIdGroupPreservesHostedFx(); // Tests above use a real JUCE AudioProcessor processing seam. Vendor // VST3 formats and sound quality require separate Windows hardware FAT. } From cded9541e40778ab9b68192d0c4e8235d071f53d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 16:12:06 +0700 Subject: [PATCH 080/155] fix(engine E2): make native IN/OUT ACK match actual serial and parallel PCM flow Reject physical SOURCE drift on structural graph edits instead of silently ACKing old input. Enforce serial primary OUT unity/POST/pan neutrality while independent PRE/POST SEND remains controllable. Verify same-format native source switch, stale GUI draft NACK, rebased OUT, GROUP/FX Return and monitor PCM with 64-sample transitions. Record verified Adobe Audition/Waves LV1 signal-flow contracts and explicit non-LIVE callback gate. --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 15 ++++++ engine/core/DynamicAcceptedSession.h | 37 +++++++------- engine/core/DynamicChannelRoster.h | 9 +++- tests/console_native_integration_test.cpp | 49 +++++++++++++++++++ tests/dynamic_accepted_session_test.cpp | 16 ++++++ 5 files changed, 106 insertions(+), 20 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index 6e093477f..a9801ac5e 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -72,3 +72,18 @@ The installed `LiveDryRoutingLab::process()` and prepared future `DynamicNativeS ## True GUI–ENGINE readback seam (M4, separate from universal) `ConsoleLiveBridgeV6::snapshot` exposes **the exact accepted M4 10-strip route**, its physical source indices and separately namespaced `legacyM4.controlPlane=LEGACY_M4_ORDINAL` / `legacyM4.supportedOps` ONLY after the installed physical route is admitted, current device connected, and topology not faulted. M4 `SET_FADER/PAN/MUTE/SOLO/SOURCE/PROCESSING_FORMAT/PRIMARY_OUT` are native operations supported by its existing S1 `processProductionIntent`, with epoch and independent `legacyRoutingRevision` fence; conditional AUX/VST3/MONITOR operations require actual accepted resources. The universal `graph.channels`, `graph.capabilities.supportedOps`, `productionCallbackLive` stay EMPTY/FALSE. This is an intentional compatibility contract for GUI #271 and final integration #270, NOT a fake universal graph nor a duplicate mixer. GUI must distinguish M4 ordinals (1–10, AUX11–14) from permanent ChannelIds, never copy M4 controls into universal graph capabilities. A native CTest verifies accepted rows, bounded ops and fail-closed poisoned physical topology. + +## E2 native IN/OUT signal-flow truth — 2026-11-03 + +**Reference contracts (not browser DSP):** +- Adobe Audition multitrack: https://helpx.adobe.com/audition/desktop/mixing-multitrack-sessions/multitrack-routing-eq-controls.html — PRE send is independent of track fader; POST send follows it; MAIN/Mix is terminal hardware sink. +- Waves eMotion LV1 channels/groups/aux: https://www.waves.com/emotion-lv1-tutorial-4-2-mixer-channels-groups-aux — GROUP is real serial sum+inserts+fader, AUX/EFX is real parallel send+bus; monitor is independently routed. +- Waves eMotion LV1 tap options: https://www.waves.com/emotion-lv1-tutorial-4-9-mixer-window-aux-mode — distinguishes input, pre-fader, post-fader and post-panner taps. ArSonMix currently supports explicit PRE-fader-after-processing and POST-fader/post-pan edges, **not** all four LV1 taps. Never claim full LV1 tap parity. + +**Binding GUI → accepted native PCM:** IN accepts only verified physical callback ordinals and is NOT the channel processing width. A same-format live SOURCE change must be accepted via `setLivePhysicalSource(epoch,graphRevision,id,...)` before the operator sends another structural OUT/GROUP/FX Return command. Structural requests carrying a different same-format pin from the accepted canonical source now **NACK** with `invalidSource`; they cannot silently overlay the old pin and falsely ACK. Rebase GUI drafts from `acceptedPhysicalRequest()`. Unpatched→patched and genuine mono↔stereo source changes remain structural and require revalidation. + +**Two independent routing primitives:** `primaryOutput` is ONE unity-level, neutral-pan, POST-fader **serial OUT** (CH → Group → MAIN). Non-unity/PRE/panned primary descriptors are rejected. `SEND` remains a separately leveled/panned PRE/POST **parallel** edge into MONITOR, FX Return or another legal bus. DAG cycle and duplicate-edge rejection preserve the no-double-dry invariant. LINK FADERS is control-only; it must not be implemented as a Group bus. + +**Native regression:** `tests/console_native_integration_test.cpp` now exercises rejected malformed primary OUT, reject-before-ACK of both out-of-range and *valid but unaccepted* physical SOURCE, native live IN change with 64-sample crossfade, stale GUI route rejection, accepted rebased OUT revision, and real PCM through CH7→GROUP, CH2→MAIN, parallel wet return and independent MONITOR. `tests/dynamic_accepted_session_test.cpp` guards the same SOURCE transaction and unchanged prior sound. No callback-side allocation or new DSP owner is introduced. + +**Remaining STOP-SHIP:** Installed `LiveAudioEngine::audioDeviceIOCallbackWithContext` still runs native M4 10CH/4AUX. This is a portable ChannelId PCM/control integrity gate, **not physical E2 cutover**, Show parity or enabled GUI production capability. Real direct physical callback ownership, VST3/Orbit control and #271 accepted event bridge still require exact-joined-Windows and hardware FAT proof. diff --git a/engine/core/DynamicAcceptedSession.h b/engine/core/DynamicAcceptedSession.h index 4f6c03515..64d9667d9 100644 --- a/engine/core/DynamicAcceptedSession.h +++ b/engine/core/DynamicAcceptedSession.h @@ -238,33 +238,32 @@ class DynamicAcceptedSession final { result.edit.createdIds.clear(); return result; } - // Validate ALL incoming physical requests before retaining any - // accepted live patch. The old M5.3 overlay quietly replaced even an - // out-of-range draft, then ACKed an unrelated structural edit. - // Invalid/hotplug-stale pins must fail closed with unchanged PCM, - // canonical accepted source and graph revision. A valid but stale - // draft may still inherit the last ACKed realtime source below. + // A structural OUT/GROUP/Return edit does NOT implicitly change IN. + // The operator's same-format IN gesture is accepted first through + // setLivePhysicalSource(epoch,revision,...), which also updates the + // canonical acceptedRequest_. A stale GUI draft must rebase from that + // accepted SOURCE before asking for a structural ACK. Never silently + // restore old pins and claim the requested new route was accepted. + // Genuine format changes remain structural, with normal graph checks. for(const auto& source:route.sources) { - if(!DynamicPreparedMixerBlock::validPhysicalPatch( - route.physicalInputs,source.inputL,source.inputR, - source.stereo)) { + const bool valid=DynamicPreparedMixerBlock::validPhysicalPatch( + route.physicalInputs,source.inputL,source.inputR,source.stereo); + const auto prior=std::find_if(acceptedRequest_.sources.begin(), + acceptedRequest_.sources.end(), + [&](const DynamicSourcePatch& p){return p.id==source.id;}); + const bool conflicting=prior!=acceptedRequest_.sources.end() && + source.stereo==prior->stereo && + (source.inputL!=prior->inputL || source.inputR!=prior->inputR); + if(!valid || conflicting) { result.fault=Fault::graphRejected; result.native.fault=DynamicNativeSessionPublisher::Fault::invalidGraph; result.native.graphError={DynamicGraphFault::invalidSource,source.id}; result.native.revision=publisher_.acceptedRevision(); result.edit.createdIds.clear(); - return result; + return result; // old audible SOURCE and VST3 leases unchanged } } - auto effective=route; // CONTROL-only, never on audio callback - for(auto& source:effective.sources){ - const auto prior=std::find_if(acceptedRequest_.sources.begin(), - acceptedRequest_.sources.end(), - [&](const DynamicSourcePatch& p){return p.id==source.id;}); - if(prior!=acceptedRequest_.sources.end() && - source.stereo==prior->stereo) - source=*prior; - } + auto effective=route; // CONTROL-only; preallocated before commit const bool nextHasFx=static_cast(fx.owner); result.native=publisher_.commit(candidate,effective,previousGraphRevision, requestedEpoch,currentEpoch,outputsDisarmed, diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index a2b8a79ab..f05736a35 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -226,7 +226,14 @@ class DynamicChannelRoster final { else it->insertCatalogIds.push_back(op.text); break; case ChannelEdit::Kind::addSendReference: - if(op.primaryOutput && std::any_of(it->sends.begin(),it->sends.end(), + // OUT is a single unity, POST-fader serial route. Its + // pan/fader live on the source strip; only SEND may own + // an independent PRE/POST tap, level or pan. Reject a + // malformed primary edge before it can reach PCM/GUI ACK. + if(op.primaryOutput && + (op.preFader || op.value!=1.f || op.sendPan!=0.f)) + result.fault=ChannelEditFault::invalidValue; + else if(op.primaryOutput && std::any_of(it->sends.begin(),it->sends.end(), [](const auto& s){return s.primaryOutput;})) result.fault=ChannelEditFault::invalidValue; else if(op.target.value==0 || op.target==op.id || seek(op.target)==candidate.end()) diff --git a/tests/console_native_integration_test.cpp b/tests/console_native_integration_test.cpp index 30e0c47e3..3732e7bd9 100644 --- a/tests/console_native_integration_test.cpp +++ b/tests/console_native_integration_test.cpp @@ -53,6 +53,22 @@ int main() { assert(first.ok() && first.edit.createdIds.size()==12); const auto ch7=first.edit.createdIds[6],ch2=first.edit.createdIds[1]; const auto main=first.edit.createdIds[10],monitor=first.edit.createdIds[11]; + // A serial OUT must always be POST fader, unity and neutral pan. + // PRE / independent send-level / send-pan belong only to parallel SEND. + ChannelEdit invalidOut;invalidOut.kind=ChannelEdit::Kind::addSendReference; + invalidOut.id=ch7;invalidOut.target=main; + invalidOut.value=1.f;invalidOut.preFader=true; + invalidOut.primaryOutput=true; + const auto tryOut=[&](const ChannelEdit& op) { + const std::array changes{op}; + return native.edit(1,1,changes,route,epoch,epoch,true); + }; + assert(!tryOut(invalidOut).ok()); + invalidOut.preFader=false;invalidOut.value=.5f; + assert(!tryOut(invalidOut).ok()); + invalidOut.value=1.f;invalidOut.sendPan=.2f; + assert(!tryOut(invalidOut).ok()); + assert(native.acceptedGraphRevision()==1); // Two IN pins are callback ordinals, not guessed adjacent physical DB labels. route.sources={{ch7,0,-1,false},{ch2,1,-1,false}}; std::array edges{linkOut(ch7,main),linkOut(ch2,main), @@ -223,6 +239,39 @@ int main() { assert(snap.channels.size()==14 && !snap.productionCallbackLive); route.sources[1].inputL=1; assert(render()&&left[31]>0.f); + // A different but valid IN2 pin in an OUT structural edit MUST NACK. + // No old-source overlay and no false GUI acceptance. + route.sources[1].inputL=0; + auto wrongAck=native.edit(4,4,editOne,route,epoch,epoch,true); + assert(!wrongAck.ok() && + wrongAck.native.graphError.fault==DynamicGraphFault::invalidSource); + assert(wrongAck.native.graphError.id==ch2); + assert(native.acceptedGraphRevision()==4); + route.sources[1].inputL=1; + assert(render()); + assert(approx(left[31],(.2f+.4f)*center*2.f+ + .2f*center*.25f*.5f)); + // The real native same-format IN operation changes PCM and canonical + // readback without changing ChannelId, VST lane or graph revision. + assert(native.setLivePhysicalSource(epoch,4,ch2,0,-1,false)); + assert(native.acceptedPhysicalRequest().sources[1].inputL==0); + assert(render()&&render()); // 64-sample dezipper across two 32f blocks + assert(approx(left[31],(.2f+.2f)*center*2.f+ + .2f*center*.25f*.5f)); + assert(approx(ml[31],(.2f*.2f+.2f*.3f)*center)); + // A previous GUI draft is now stale. It must rebase from accepted + // native SOURCE before changing OUT; never receive a phantom ACK. + wrongAck=native.edit(4,4,editOne,route,epoch,epoch,true); + assert(!wrongAck.ok() && native.acceptedGraphRevision()==4); + route=native.acceptedPhysicalRequest(); + auto changedOut=native.edit(4,4,editOne,route,epoch,epoch,true); + assert(changedOut.ok() && native.acceptedGraphRevision()==5); + assert(native.acceptedPhysicalRequest().sources[1].inputL==0); + assert(render()); + // CH7 -> GROUP (serial + FX) while CH2 -> MAIN (direct), and + // CH7 -> wet FX Return in parallel: no double-dry contribution. + assert(approx(left[31],(.2f*2.f+.2f+.2f*.25f*.5f)*center)); + assert(approx(ml[31],(.2f*.2f+.2f*.3f)*center)); // OUTPUT MUTE must silence BOTH main and monitor and never invoke FX. assert(!native.render(epoch,pins,2,left.data(),right.data(), 32,true,fx,ml.data(),mr.data())); diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 2e410e808..7cb00f86e 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -220,6 +220,22 @@ int main() { assert(!deniedSource.ok() && deniedSource.native.graphError.fault==DynamicGraphFault::invalidSource); assert(render()&&near(l[63],(.2f+.4f)*center)); + // A physically valid but different pin is NOT an implicit IN request + // during RENAME/GROUP/OUT. Previously the old SOURCE was overlaid and + // an unfulfilled new pin was ACKed as successful (GUI/PCM disagreement). + auto validButUnacceptedSource=route; + validButUnacceptedSource.sources[0].inputL=1; + auto deniedValidSource=session.edit(2,2,structuralAttempt, + validButUnacceptedSource,epoch,epoch,true); + assert(!deniedValidSource.ok() && + deniedValidSource.fault==DynamicAcceptedSession::Fault::graphRejected); + assert(deniedValidSource.native.graphError.fault== + DynamicGraphFault::invalidSource); + assert(deniedValidSource.native.graphError.id==micA); + assert(session.acceptedGraphRevision()==2 && + session.acceptedPhysicalRequest().sources[0].inputL==0); + assert(session.acceptedRoster().find(micA)->name=="LEAD"); + assert(render()&&near(l[63],(.2f+.4f)*center)); // One accepted ChannelId graph: realtime MUTE/SOLO and PRE/POST follow // the same callback, not a recompilation or an extra FX instance. assert(session.setLiveMuteSolo(epoch,2,micA,true,false)); From c3ea53bbdb7c45c5b249cf8aec85877f9e713cb6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 16:56:45 +0700 Subject: [PATCH 081/155] feat(engine E2): admit ChannelId PCM into sole installed JUCE callback for verified M4 routes Preserve DIRECT sparse hardware pin masks, MAIN/MONITOR/secondary taps, device epoch, output mute and 256-sample ramp in original callback. A control-thread UnifiedLegacyProductionAdmission retains original vendor VST3 leases and selects ChannelId DSP only for accepted output-disarmed 10CH/4AUX routes without untransferred external CH1/Orbit. Native and M4 renderers are mutually exclusive on each callback, not summed. Mirror GUI-ACKed SOURCE, fader, PAN, MUTE/SOLO, AUX and monitor scalar controls to the active ChannelId atomics; recycle exact native post-fader L/R meters. Revoke native before CH1 rack handoff, structural route changes, driver stop, and fail closed to M4 on admission/mirror failure. Reclaim FX generations off RT. Keep universal CH11/Group capabilities false until GUI cutover. --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 10 + engine/core/DynamicNativeSessionPublisher.h | 7 +- engine/core/DynamicPreparedMixerBlock.h | 18 +- src/LiveAudioEngine.h | 55 ++++-- src/LiveDryRoutingLab.h | 180 +++++++++++++++++- tests/engine_runtime_reconciliation_test.mjs | 21 ++ tests/live_channel_fx_graph_test.cpp | 14 ++ 7 files changed, 282 insertions(+), 23 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index a9801ac5e..e7c7b7545 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -87,3 +87,13 @@ The installed `LiveDryRoutingLab::process()` and prepared future `DynamicNativeS **Native regression:** `tests/console_native_integration_test.cpp` now exercises rejected malformed primary OUT, reject-before-ACK of both out-of-range and *valid but unaccepted* physical SOURCE, native live IN change with 64-sample crossfade, stale GUI route rejection, accepted rebased OUT revision, and real PCM through CH7→GROUP, CH2→MAIN, parallel wet return and independent MONITOR. `tests/dynamic_accepted_session_test.cpp` guards the same SOURCE transaction and unchanged prior sound. No callback-side allocation or new DSP owner is introduced. **Remaining STOP-SHIP:** Installed `LiveAudioEngine::audioDeviceIOCallbackWithContext` still runs native M4 10CH/4AUX. This is a portable ChannelId PCM/control integrity gate, **not physical E2 cutover**, Show parity or enabled GUI production capability. Real direct physical callback ownership, VST3/Orbit control and #271 accepted event bridge still require exact-joined-Windows and hardware FAT proof. + +## E2 physical PCM adoption — single original callback, guarded M4→ChannelId + +The installed `LiveAudioEngine::audioDeviceIOCallbackWithContext` still has exactly one JUCE callback, one native physical output gate and one `LiveDryRoutingLab::process()` invocation. Inside that existing verified DIRECT device process, a new CONTROL-admitted `UnifiedLegacyProductionAdmission` snapshot can replace M4 DSP with `DynamicNativeSessionPublisher::render()` **instead of** invoking `LiveChannelFxGraph::process()`. They are selected mutually exclusively once per callback. There is no additional PCM thread, no second VST host or double dry sum. + +**Physical adoption requirements and fallback:** only after operator APPLY has accepted real input/output masks (including sparse callback ordinals), all outputs are disarmed, and the special legacy CH1 external Orbit rack is EMPTY. The old M4 graph remains retained as a compatibility/fail-safe output; ChannelId admission rejects wrong epoch, invalid pins, uncompensated VST latency, resource budgets or untransferred CH1. These cases keep M4 audible, not a fake universal graph. Device stop, stale source, structural APPLY and CLEAR PATCH drop the ChannelId selector atomically. The PCM snapshot carries the exact original JUCE per-channel + AUX VST owner leases, and after successful admission the native callback renders them only once; plugin editor/Show state survives because owners are shared, not recreated. The existing MAIN/MONITOR/secondary output taps, master ramp, output MUTE and raw PCM capture fence are reused. + +**GUI control integrity:** the accepted M4 scalar controls (strip fader/pan/mute/solo, live same-format SOURCE, POST/PRE AUX level, AUX return fader, MONITOR gain) update both M4 safety fallback state and the native ChannelId atomic targets with the same device epoch. A rejected native scalar update immediately reselects M4. A structural edit rebuilds and re-admits only with output safely disarmed. The native graph now delivers independent post-fader L/R peak readings directly from its own PCM render for the existing M4 Console's ten channel LEDs and four AUX levels; no browser DSP/fake dual-stereo meter. + +**SCOPE BOUNDARY**: This is **physical callback ChannelId adoption for accepted fixed 10CH+4AUX routes only**, not full CH11/Group WIRE GUI cutover or automatic acceptance of occupied original CH1 Orbit. The M4 source/GUI editor paths still exist as bounded compatibility. `ConsoleLiveBridgeV6::productionCallbackLive=false` and universal capabilities remain false; they mean the **full universal operator console** is not ready, NOT that the lower-level ChannelId DSP can never be selected for M4-compatible hardware PCM. Keep PR #266 DRAFT. Next milestone is occupied CH1 Orbit+Show parity, native stable ChannelId GUI snapshot/ACK and direct CH11+Group/FX Return operator end-to-end cutover on this same callback. Physical hardware 0FX/1FX and issue #15 crackle remain NOT TESTED until manually checked against verified Windows artifact. diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index a21e35723..0574f9753 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -130,7 +131,9 @@ class DynamicNativeSessionPublisher final { bool render(std::uint64_t deviceEpoch,const float* const* physical, int physicalCount,float* mainL,float* mainR,int frames, bool outputMuted,Fx&& effect, - float* monitorL=nullptr,float* monitorR=nullptr) noexcept { + float* monitorL=nullptr,float* monitorR=nullptr, + std::span channelPeaksL={}, + std::span channelPeaksR={}) noexcept { static_assert(std::is_nothrow_invocable_v, "Realtime VST dispatch must be noexcept"); const auto clearOutputs=[&]() noexcept { @@ -180,7 +183,7 @@ class DynamicNativeSessionPublisher final { }; const bool ok=snap->prepared->graph.process( physical,physicalCount,mainL,mainR,frames, - dispatch,monitorL,monitorR); + dispatch,monitorL,monitorR,channelPeaksL,channelPeaksR); if(!ok)clearOutputs(); return ok; } diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index 93107f8ad..cc6aa73be 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -459,8 +459,17 @@ class DynamicPreparedMixerBlock final { template bool process(const float* const* physical,int physicalCount, float* outputL,float* outputR,int frames,Fx&& processFx, - float* monitorL=nullptr,float* monitorR=nullptr) noexcept { + float* monitorL=nullptr,float* monitorR=nullptr, + std::span channelPeaksL={}, + std::span channelPeaksR={}) noexcept { if(frames<=0 || !outputL || !outputR)return false; + if(channelPeaksL.size()!=channelPeaksR.size() || + (!channelPeaksL.empty() && channelPeaksL.size()getCurrentSampleRate()); stagedOwner_=std::move(next); + // A new original CH1/Orbit vendor rack is not yet transferable + // into the native ChannelId lease. Select M4 BEFORE staging its + // realtime FX handoff; no new VST may disappear from audible PCM. + dryRoutingLab_.revokeChannelIdPcm(); if(!handoff_.stage(stagedOwner_.get())) { stagedOwner_.reset(); @@ -1047,11 +1052,17 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback for(int i=0;icount;++i) if(graphOwned_->slots[i].latency!=0) return "CH1 rack contains a latent VST3: zero-latency settings are required for native multi-channel sends"; - return dryRoutingLab_.apply(command,directFence_.permitted(), - independent_.active(),graphOwned_->count,fx,formats_, - device->getCurrentSampleRate(), - juce::jmax(32,device->getCurrentBufferSizeSamples()), - true,restored); + const auto frames=juce::jmax(32,device->getCurrentBufferSizeSamples()); + const auto result=dryRoutingLab_.apply( + command,directFence_.permitted(),independent_.active(), + graphOwned_->count,fx,formats_,device->getCurrentSampleRate(), + frames,true,restored); + // Same original PCM callback/hardware gate; a failed ChannelId + // admission retains the last accepted M4 with original Orbit/Show. + if(result.isEmpty()) + (void)dryRoutingLab_.admitChannelIdFromAcceptedM4( + graphOwned_->count,frames,allOutputsDisarmed()); + return result; } void disableDryRoutingLab() noexcept { setOutputMuted(true); // never expose CH1 unexpectedly on STOP @@ -1072,11 +1083,19 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback // transaction, not a browser-side APPLY or alternate callback. A // single verified mono capture pin is a supported source. try { - return dryRoutingLab_.repatchPhysicalSource( + const auto frames=juce::jmax(32,device->getCurrentBufferSizeSamples()); + const auto oldRevision=dryRoutingLab_.revision(); + const auto changed=dryRoutingLab_.repatchPhysicalSource( strip,epoch,revision,mode,left,right, directFence_.permitted(),independent_.active(), - graphOwned_->count,formats_,device->getCurrentSampleRate(), - juce::jmax(32,device->getCurrentBufferSizeSamples())); + graphOwned_->count,formats_,device->getCurrentSampleRate(),frames); + // Same-format SOURCE is an atomic live parameter on BOTH kernels: + // do not rebuild VST3/PCM or interrupt the 64-sample crossfade. + if(changed.isEmpty() && allOutputsDisarmed() && + oldRevision!=dryRoutingLab_.revision()) + (void)dryRoutingLab_.admitChannelIdFromAcceptedM4( + graphOwned_->count,frames,true); + return changed; } catch(const std::exception& ex) { return "SOURCE: native prepare failed; prior audio kept: " + juce::String(ex.what()); } catch(...) { @@ -1099,11 +1118,15 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback auto* device=deviceManager_.getCurrentAudioDevice(); if(!device)return "CHANNEL PATCH: no active native audio interface"; try { - return dryRoutingLab_.repatchChannelStructure( + const auto frames=juce::jmax(32,device->getCurrentBufferSizeSamples()); + const auto changed=dryRoutingLab_.repatchChannelStructure( strip,epoch,revision,operation,value, directFence_.permitted(),independent_.active(), - graphOwned_->count,formats_,device->getCurrentSampleRate(), - juce::jmax(32,device->getCurrentBufferSizeSamples())); + graphOwned_->count,formats_,device->getCurrentSampleRate(),frames); + if(changed.isEmpty() && allOutputsDisarmed()) + (void)dryRoutingLab_.admitChannelIdFromAcceptedM4( + graphOwned_->count,frames,true); + return changed; } catch(...) { return "CHANNEL PATCH: native preparation failed; previous mix preserved"; } @@ -1144,11 +1167,15 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback auto* device=deviceManager_.getCurrentAudioDevice(); if(!device)return "AUX CONNECT: no verified audio interface"; try { - return dryRoutingLab_.connectPreparedAuxSend( + const auto frames=juce::jmax(32,device->getCurrentBufferSizeSamples()); + const auto changed=dryRoutingLab_.connectPreparedAuxSend( source,bus,epoch,revision,tap,gain,pan, directFence_.permitted(),independent_.active(),graphOwned_->count, - formats_,device->getCurrentSampleRate(), - juce::jmax(32,device->getCurrentBufferSizeSamples())); + formats_,device->getCurrentSampleRate(),frames); + if(changed.isEmpty() && allOutputsDisarmed()) + (void)dryRoutingLab_.admitChannelIdFromAcceptedM4( + graphOwned_->count,frames,true); + return changed; } catch(...) { return "AUX CONNECT: failed native preparation; previous route retained"; } diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 79ed502b6..a1969cc30 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -4,6 +4,7 @@ #include "../engine/core/MasterOutputMonoPolicy.h" #include "../engine/core/LiveChannelFxGraph.h" #include "../engine/core/DynamicChannelFxLeaseBank.h" +#include "../engine/core/UnifiedLegacyProductionAdmission.h" #include "VstBusLayout.h" #include "../engine/core/NativeDryRouteCommand.h" #include "NativeVerifiedSourcePatch.h" @@ -64,6 +65,7 @@ class LiveDryRoutingLab final { // JUCE calls aboutToStart after configuring the input/output device. // One device session gets a new epoch; stored route cannot survive it. void prepareDevice (juce::AudioIODevice* device) noexcept { + channelIdPcmEpoch_.store(0,std::memory_order_release); const auto generation=deviceEpoch_.fetch_add(1,std::memory_order_acq_rel)+1; userPatched_.store(false,std::memory_order_release); registryValid_.store(false,std::memory_order_release); @@ -93,6 +95,7 @@ class LiveDryRoutingLab final { registryValid_.store(true,std::memory_order_release); } void deviceStopped() noexcept { + channelIdPcmEpoch_.store(0,std::memory_order_release); // A stale lab cannot silently resume legacy CH1 on device hotplug. userPatched_.store(false,std::memory_order_release); deviceEpoch_.fetch_add(1,std::memory_order_acq_rel); @@ -409,6 +412,9 @@ class LiveDryRoutingLab final { if(!registryValid_.load(std::memory_order_acquire) || epochAtPublish!=currentEpoch) return "Audio device changed before routing publication"; + // New M4 routing must not render against an older ChannelId graph. + // Output must remain disarmed throughout structural native APPLY. + channelIdPcmEpoch_.store(0,std::memory_order_release); const auto result=publisher_.publish(std::move(next),expectedRevision,epochAtPublish); switch(result) { case Publisher::Result::applied: @@ -494,6 +500,14 @@ class LiveDryRoutingLab final { return "SOURCE SWITCH: native graph rejected same-format input"; // This is the authoritative native parameter target, not an // unacknowledged browser draft. The callback fades PCM over 64 samples. + if(channelIdPhysicalPcmActive()) { + const auto id=nativeAccepted_.graph.ids.inputs[strip]; + if(!nativePublisher_.setPhysicalSource( + expectedEpoch,nativeAccepted_.pcmRevision,id, + callbackLeft,mode=="STEREO"?callbackRight:-1, + mode=="STEREO")) + channelIdPcmEpoch_.store(0,std::memory_order_release); + } if(auto* object=row.getDynamicObject()){ object->setProperty("left",physicalLeft); object->setProperty("right",mode=="STEREO"?physicalRight:-1); @@ -729,6 +743,18 @@ class LiveDryRoutingLab final { updated.mono,updated.mute,updated.solo); }))return false; channelEdits_[strip]=updated; + if(channelIdPhysicalPcmActive()) { + const auto id=nativeAccepted_.graph.ids.inputs[strip]; + const bool mirrored=(name=="mute"||name=="solo") + ?nativePublisher_.setChannelMuteSolo( + expectedEpoch,nativeAccepted_.pcmRevision, + id,updated.mute,updated.solo) + :nativePublisher_.setChannelMix( + expectedEpoch,nativeAccepted_.pcmRevision, + id,updated.linear,updated.pan); + if(!mirrored) + channelIdPcmEpoch_.store(0,std::memory_order_release); + } return true; } @@ -763,6 +789,13 @@ class LiveDryRoutingLab final { return fx.setAuxSendGain(source,bus,tap,gain); }))return false; accepted->getDynamicObject()->setProperty("gain",static_cast(gain)); + if(channelIdPhysicalPcmActive() && + !nativePublisher_.setParallelSendGain( + expectedEpoch,nativeAccepted_.pcmRevision, + nativeAccepted_.graph.ids.inputs[source], + nativeAccepted_.graph.ids.aux[bus], + tap==armix::mixer::SendTap::preFader,gain)) + channelIdPcmEpoch_.store(0,std::memory_order_release); return true; } @@ -783,6 +816,11 @@ class LiveDryRoutingLab final { return false; if(auto* obj=(*arr)[bus].getDynamicObject()) obj->setProperty("gain",static_cast(gain)); + if(channelIdPhysicalPcmActive() && + !nativePublisher_.setChannelMix( + expectedEpoch,nativeAccepted_.pcmRevision, + nativeAccepted_.graph.ids.aux[bus],gain,0.f)) + channelIdPcmEpoch_.store(0,std::memory_order_release); return true; } @@ -805,6 +843,13 @@ class LiveDryRoutingLab final { return fx.setMonitorSendGain(source,gain); }))return false; array->set(source,static_cast(gain)); // same accepted topology + if(channelIdPhysicalPcmActive() && + !nativePublisher_.setParallelSendGain( + expectedEpoch,nativeAccepted_.pcmRevision, + sourcearmix::device::LiveInputPortRegistry::limit) + return false; + std::array ports{}; + for(int i=0;imainOutputLeft();hw.mainR=old->mainOutputRight(); + hw.monitorEnabled=old->monitorEnabled(); + if(hw.monitorEnabled) { + hw.monitorL=old->monitorOutputLeft(); + hw.monitorR=old->monitorOutputRight(); + } + std::array monitor{}; + if(hw.monitorEnabled) { + const auto gains=acceptedRoute_.getProperty("monitorSends",juce::var()); + const auto* list=gains.getArray(); + if(!list||list->size()!=fxSlots)return false; + for(int i=0;i( + static_cast(list->getReference(i))); + } + // The previous publisher belongs to another device generation. + // Retire it only on CONTROL, never from JUCE's device callback. + if(nativeAccepted_.deviceEpoch!=generation && + nativePublisher_.acceptedRevision()!=0) + nativePublisher_.unpublish(); + const int frames=juce::jmax(32,juce::jmin( + deviceFrames,old->maxFramesPerPlugin())); + auto applied=armix::mixer::UnifiedLegacyProductionAdmission::compileAndCommit( + decoded.channels,{ports.data(),static_cast(inputs)}, + decoded.sends,decoded.aux,monitor,*old,false,hw, + frames,32u*1024u*1024u, + nativePublisher_.acceptedRevision(),generation,epoch(), + true,nativePublisher_,nativeAccepted_); + if(!applied.ok() || generation!=epoch() || m4Revision!=revision()) + return false; // unchanged M4 PCM is the safe rollback + channelIdPcmEpoch_.store(generation,std::memory_order_release); + return true; + } catch(...) { + // Failure is on CONTROL; the original M4/Orbit graph remains + // valid and is the only callback PCM renderer selected. + return false; + } + } + void revokeChannelIdPcm() noexcept { + channelIdPcmEpoch_.store(0,std::memory_order_release); + } + bool channelIdPhysicalPcmActive() const noexcept { + const auto active=channelIdPcmEpoch_.load(std::memory_order_acquire); + return active!=0 && active==epoch() && ready(); + } + void disable() noexcept { + channelIdPcmEpoch_.store(0,std::memory_order_release); + nativePublisher_.unpublish(); // CONTROL-only; audio lease retires safely + nativeAccepted_=armix::mixer::UnifiedLegacyAccepted{}; userPatched_.store(false,std::memory_order_release); enabled_.store(false,std::memory_order_release); publishedEpoch_.store(0,std::memory_order_release); @@ -942,7 +1076,10 @@ class LiveDryRoutingLab final { for(auto& p:channelPeaksR_)p.store(0.f,std::memory_order_relaxed); for(auto& p:auxPeaks_)p.store(0.f,std::memory_order_relaxed); } - void poll() noexcept {publisher_.pollRetirement();} // message thread + void poll() noexcept { + publisher_.pollRetirement(); + nativePublisher_.pollRetirement(); + } // message thread only, reclaim both graph generations bool active() const noexcept {return enabled_.load(std::memory_order_acquire);} float peakLeft() const noexcept {return peakL_.load(std::memory_order_relaxed);} float peakRight() const noexcept {return peakR_.load(std::memory_order_relaxed);} @@ -1095,6 +1232,9 @@ class LiveDryRoutingLab final { topologyFault_.store(true,std::memory_order_release); silence();return true; } + const bool channelIdRender= + channelIdPcmEpoch_.load(std::memory_order_acquire)==generation && + generation!=0; float peakL=0.f,peakR=0.f,monitorPeakL=0.f,monitorPeakR=0.f; std::array perChannelPeaks{}; std::array perChannelPeaksL{},perChannelPeaksR{}; @@ -1104,11 +1244,35 @@ class LiveDryRoutingLab final { for(int c=0;cprepared->process(shifted.data(),inputCount, - mainL+offset,mainR+offset,n,&level, - externalContext,externalFx, - monitorL?monitorL+offset:nullptr, - monitorR?monitorR+offset:nullptr)) { + bool processed=false; + if(channelIdRender) { + // The current M4 import is at most 10+4+MAIN+MONITOR. + // Meter sources are the ACTUAL ChannelId PCM POST-fader + // lanes, not another mixer pass or reused M4 peak values. + std::array tapsL{},tapsR{}; + const auto noExtraFx=[](armix::mixer::ChannelId,float*,float*,int) noexcept {}; + processed=nativePublisher_.render( + generation,shifted.data(),inputCount, + mainL+offset,mainR+offset,n,false,noExtraFx, + monitorL?monitorL+offset:nullptr, + monitorR?monitorR+offset:nullptr,tapsL,tapsR); + if(processed) { + for(int ch=0;chprepared->process( + shifted.data(),inputCount,mainL+offset,mainR+offset,n, + &level,externalContext,externalFx, + monitorL?monitorL+offset:nullptr, + monitorR?monitorR+offset:nullptr); + } + if(!processed) { // A failed DSP pass must never leak partially rendered // MAIN/MONITOR PCM into an armed physical output. topologyFault_.store(true,std::memory_order_release); @@ -1181,6 +1345,7 @@ class LiveDryRoutingLab final { out->setProperty("topologyFault",topologyFault_.load(std::memory_order_acquire)); out->setProperty("ready",ready()); out->setProperty("hasAcceptedRoute",hasExplicitRoute()); + out->setProperty("nativeChannelIdPcmActive",channelIdPhysicalPcmActive()); out->setProperty("epoch",static_cast(epoch())); out->setProperty("revision",static_cast(revision())); out->setProperty("peakL",peakL_.load(std::memory_order_relaxed)); @@ -1301,6 +1466,9 @@ class LiveDryRoutingLab final { private: std::atomic_flag rendering_=ATOMIC_FLAG_INIT; // one AUDIO producer Publisher publisher_; + armix::mixer::DynamicNativeSessionPublisher nativePublisher_; + armix::mixer::UnifiedLegacyAccepted nativeAccepted_; + std::atomic channelIdPcmEpoch_{0}; std::atomic monitorPeakL_{0.f},monitorPeakR_{0.f}; armix::dsp::MasterOutputMonoPolicy masterMonoPolicy_; // audio thread only std::array channelEdits_{}; // JUCE message thread only diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index 943da64bd..734a26b88 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -101,6 +101,27 @@ test('workers handle Show IO outside the audio callback, not as a second DSP eng assert.doesNotMatch(callback,/NativeShowStore|\.loadWithStates\(|\.commit\(show/); }); +test('E2 uses exactly one installed JUCE callback with admitted native ChannelId PCM and M4 fallback',()=>{ + assert.match(engine,/dryRoutingLab_\.admitChannelIdFromAcceptedM4\(/); + assert.match(physical,/UnifiedLegacyProductionAdmission::compileAndCommit\(/); + assert.match(physical,/channelIdPcmEpoch_\.store\(generation,std::memory_order_release\)/); + assert.match(physical,/const bool channelIdRender=/); + assert.match(physical,/if\(channelIdRender\)\s*\{/); + assert.match(physical,/nativePublisher_\.render\(/); + assert.match(physical,/else \{\s*processed=snapshot->prepared->process\(/); + assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); + assert.equal(count(callback,/DynamicNativeSessionPublisher::render\(/g),0, + 'a second JUCE native renderer may not be installed'); + assert.match(physical,/channelIdPcmEpoch_\.store\(0,std::memory_order_release\)/, + 'stale epoch and structural edits must turn off the native selector'); + assert.match(physical,/channelIdPhysicalPcmActive\(/, + 'live GUI scalar control must follow the admitted native renderer'); + assert.match(engine,/dryRoutingLab_\.revokeChannelIdPcm\(\)/, + 'original CH1 FX publication must first retire native PCM authority'); + assert.match(physical,/nativePublisher_\.pollRetirement\(\)/, + 'native VST owner generations must retire off audio callback'); +}); + test('installed M4 and future ChannelId share one nonblocking render permit',()=>{ assert.ok(physical.includes('RealtimeRenderPermit exclusive{rendering_}')); assert.ok(dynamic.includes('RealtimeRenderPermit exclusive{rendering_}')); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 719234866..bb8199d5c 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -432,6 +432,20 @@ static void verifyMU1LegacyM4FxFullMigrationAndMonitorPcm() { 32,false,mustNeverCall, dynamicML.data(),dynamicMR.data())); assert(heapCalls.load(std::memory_order_relaxed)==before); + // E2 native physical path reads true per-ChannelId POST-fader left + // and right peaks from the SAME render (no stale M4 GUI meter). + std::array nativeMeterL{},nativeMeterR{}; + assert(publisher.render(epoch,physical,4,dynamicL.data(),dynamicR.data(), + 32,false,mustNeverCall, + dynamicML.data(),dynamicMR.data(), + nativeMeterL,nativeMeterR)); + assert(heapCalls.load(std::memory_order_relaxed)==before); + assert(nativeMeterL[0]>0.f&&nativeMeterR[0]>0.f); + assert(!near(nativeMeterL[0],nativeMeterR[0])); + assert(nativeMeterL[stripCount]>0.f&&nativeMeterR[stripCount]>0.f); + assert(nativeMeterL[stripCount+auxBusCount]>0.f); + assert(nativeMeterL[stripCount+auxBusCount+1]>0.f); + for(int i=0;i<32;++i) { assert(near(legacyL[i],dynamicL[i])); assert(near(legacyR[i],dynamicR[i])); From fcae00ec7725a3122dcc432827f47f02c754633a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 17:58:23 +0700 Subject: [PATCH 082/155] feat(engine E2): migrate occupied original CH1/Orbit rack into one physical ChannelId PCM owner Hold the exact original CH1 Graph (FX instance, editor, binary state, bypass envelopes, order, tails and dedicated DSP scratch) through a CONTROL-owned shared lease. Reuse the same CH1 DSP function via native ChannelId or M4, exclusively in the original JUCE callback with zero RT ownership costs. Bind CH1 stable id from compiled accepted roster, reject stale/wrong IDs or invalid context. Retire native before Show recall/ADD/REMOVE, readmit the new owner after original graph handoff only when disarmed and valid. Reject latent external CH1 without PDC. Add golden PCM/owner retirement tests and native ownership architecture gate. Preserve universal GUI capability gate and hardware FAT requirements. --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 10 ++ .../core/UnifiedLegacyProductionAdmission.h | 21 ++- src/LiveAudioEngine.h | 132 +++++++++++++----- src/LiveDryRoutingLab.h | 16 ++- tests/engine_runtime_reconciliation_test.mjs | 25 +++- tests/live_channel_fx_graph_test.cpp | 24 +++- 6 files changed, 176 insertions(+), 52 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index e7c7b7545..e6c75c9ee 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -97,3 +97,13 @@ The installed `LiveAudioEngine::audioDeviceIOCallbackWithContext` still has exac **GUI control integrity:** the accepted M4 scalar controls (strip fader/pan/mute/solo, live same-format SOURCE, POST/PRE AUX level, AUX return fader, MONITOR gain) update both M4 safety fallback state and the native ChannelId atomic targets with the same device epoch. A rejected native scalar update immediately reselects M4. A structural edit rebuilds and re-admits only with output safely disarmed. The native graph now delivers independent post-fader L/R peak readings directly from its own PCM render for the existing M4 Console's ten channel LEDs and four AUX levels; no browser DSP/fake dual-stereo meter. **SCOPE BOUNDARY**: This is **physical callback ChannelId adoption for accepted fixed 10CH+4AUX routes only**, not full CH11/Group WIRE GUI cutover or automatic acceptance of occupied original CH1 Orbit. The M4 source/GUI editor paths still exist as bounded compatibility. `ConsoleLiveBridgeV6::productionCallbackLive=false` and universal capabilities remain false; they mean the **full universal operator console** is not ready, NOT that the lower-level ChannelId DSP can never be selected for M4-compatible hardware PCM. Keep PR #266 DRAFT. Next milestone is occupied CH1 Orbit+Show parity, native stable ChannelId GUI snapshot/ACK and direct CH11+Group/FX Return operator end-to-end cutover on this same callback. Physical hardware 0FX/1FX and issue #15 crackle remain NOT TESTED until manually checked against verified Windows artifact. + +## E2 native ORIGINAL CH1/Orbit vendor lease cutover — supersedes prior "CH1 EMPTY" gate (2026-11-03) + +**Critical source owner fix:** The original `LiveAudioEngine::Graph` now owns the CH1 bypass/de-click scratch AND an exact `shared_ptr` lifetime on CONTROL. The existing `LiveGraphHandoff` still publishes only `Graph*` on the one JUCE realtime callback. When the native ChannelId publisher admits the current M4 route, `currentOriginalCh1Lease()` supplies a `DynamicChannelFxLeaseBank::ExternalLease` with a strong reference to the **same original Graph object** and a raw (validated) process function. Its DSP function reuses the original plugin order, atomics, bypass envelope, real plugin instances, tail and editor/preset state; neither a VST clone nor an alternate audio thread is created. Original M4 FX and native ChannelId invoke **the same function**, selected mutually exclusively per callback. + +**No guessed ChannelId:** `UnifiedLegacyProductionAdmission` validates original owner identity `context==owner.get()` and binds an initially unspecified CH1 ID from the freshly compiled verified source roster. Explicit conflicting IDs NACK. A nonempty original vendor rack is only admitted when the acknowledged M4 CH1 rack has no conflicting native lane insert and the original rack is strictly zero-latency (no PDC yet). Original VST3 rack changes and Show recall revoke native ownership BEFORE the existing output-declicked graph handoff. The native CONTROL finalizer can re-admit the new exact original rack once handoff completes, **only if outputs are disarmed and device/mixer epoch is valid**. This preserves the original vendor editor, FX reorder, bypass, Show binary state and bank tail while native PCM is the one physical renderer. Graph and plugin reclamation happens on CONTROL after both the native publisher and handoff have retired their leases; no shared_ptr refcount/drop/heap on AUDIO. + +**Regression acceptance:** `verifyOccupiedExternalCh1Owner()` checks compiled CH1 binding without magic ID, rejects wrong/stale owner/context and spoofed ID, compares golden native/M4 vendor PCM, retains the exact original vendor when the M4 owner is destroyed, confirms one vendor invocation on callback, and checks final weak_ptr expiry only after native publisher + GUI owner control retirement. JS architecture gate enforces shared Graph ownership, exactly one installed JUCE callback, original bypass scratch, Show/ADD/REMOVE revocation and native external single-render dispatch. Windows exact-head native, GUI smoke and artifact checks are required before PASS can be claimed. + +**Remaining NOT DONE:** The real physical ASIO/WASAPI microphone/speaker execution, direct GUI universal CH11/serial GROUP/wet FX RETURN accepted snapshot/ACK, operator-visible external CH1 status and joined #270 executable. Native admission is a verified 10CH/4AUX compatibility cutover, **not** proof of every universal operator workflow; `productionCallbackLive` must stay FALSE until those operations really reach physical PCM. Show recall state needs end-to-end device FAT validation, not merely compiled source coverage. diff --git a/engine/core/UnifiedLegacyProductionAdmission.h b/engine/core/UnifiedLegacyProductionAdmission.h index 0700216ea..37d431806 100644 --- a/engine/core/UnifiedLegacyProductionAdmission.h +++ b/engine/core/UnifiedLegacyProductionAdmission.h @@ -116,8 +116,14 @@ class UnifiedLegacyProductionAdmission final { if(!allOutputsDisarmed) { result.fault=Fault::outputArmed;return result; } + // A real legacy CH1 Graph owner may have no ChannelId until the + // accepted sparse-port topology has been compiled. Validate its + // lifetime/function now; bind its exact id from the compiled graph, + // not from a guessed strip index or WebView ordinal. if(legacyExternalCh1FxActive!=externalCh1.populated() || - (legacyExternalCh1FxActive && !externalCh1.valid())) { + (legacyExternalCh1FxActive && + (!externalCh1.owner || externalCh1.context!=externalCh1.owner.get() || + !externalCh1.render))) { result.fault=Fault::legacyCh1ExternalFx;return result; } // FxInstance owns one already-prepared stereo block. Do not let the @@ -139,10 +145,15 @@ class UnifiedLegacyProductionAdmission final { result.fault=Fault::legacyGraphInvalid;return result; } using Bank=DynamicChannelFxLeaseBank; - if(externalCh1.populated() && - (externalCh1.id!=candidate.ids.inputs[0] || - acceptedM4Fx.insertsOn(0)!=0)) { - result.fault=Fault::legacyCh1ExternalFx;return result; + if(externalCh1.populated()) { + if((externalCh1.id.value && + externalCh1.id!=candidate.ids.inputs[0]) || + acceptedM4Fx.insertsOn(0)!=0) { + result.fault=Fault::legacyCh1ExternalFx;return result; + } + // The native compiler is the ONLY authority for stable ids. + // The original CH1 owner can never become an arbitrary bus. + externalCh1.id=candidate.ids.inputs[0]; } std::array lanes{}; for(int i=0;i dryScratch; // Eight 4-bit physical slot indices in one x64 lock-free word. // Moving an insert publishes one complete order for the NEXT audio // block; the processor objects and their binary states never move. @@ -100,8 +106,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback { formats_.addFormat (std::make_unique()); scratch_.setSize (2, maxFrames, false, true, false); - // One reusable preallocated stereo dry snapshot for transient FX bypass. - dryScratch_.setSize (2, maxFrames, false, true, false); + // CH1 bypass scratch now belongs to its shared Graph lifetime so + // a ChannelId PCM snapshot can retain the SAME original FX state. handoff_.initialize (graphOwned_.get()); } @@ -245,7 +251,6 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback secondaryOutput_.stop(); // stop independent OBS consumer before audio graph teardown independent_.close(); detach(); - dryRoutingLab_.disable(); // retire M4 + ChannelId VST owners on CONTROL handoff_.resetAfterStop (graphOwned_.get()); // Last owner releases vendor resources exactly once after detach. // Reused instances remain valid until their final control-owned slot. @@ -635,6 +640,18 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback totalLatency_.store(graphOwned_->latency,std::memory_order_release); handoff_.completeRetirement(); completedSwaps_.fetch_add (1, std::memory_order_relaxed); + // Only after the original host graph is the new accepted owner, + // safely migrate its exact original CH1 VSTs/Orbit and all M4 lanes. + // No plugin is recreated; retain M4 if the hardware is armed, + // stale or PDC disallows this graph. CONTROL/timer thread only. + if(allOutputsDisarmed() && dryRoutingLab_.hasExplicitRoute() && + directFence_.permitted() && !independent_.active()) { + if(auto* device=deviceManager_.getCurrentAudioDevice()) + (void)dryRoutingLab_.admitChannelIdFromAcceptedM4( + graphOwned_->count, + juce::jmax(32,device->getCurrentBufferSizeSamples()), + true,currentOriginalCh1Lease()); + } return true; } @@ -717,9 +734,10 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback return false; prepareFxEditEnvelope(*next,device->getCurrentSampleRate()); stagedOwner_=std::move(next); - // A new original CH1/Orbit vendor rack is not yet transferable - // into the native ChannelId lease. Select M4 BEFORE staging its - // realtime FX handoff; no new VST may disappear from audible PCM. + // CHANGE of original CH1 ownership must finish on the existing + // M4 buffer-boundary handoff first. Revoke the old native lease; + // once the staged Graph is accepted, re-admit its identical plugin + // state/editor/order into ChannelId without double processing. dryRoutingLab_.revokeChannelIdPcm(); if(!handoff_.stage(stagedOwner_.get())) { @@ -926,6 +944,10 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback staged->slots[i].latency); if (!staged->slots[i].bypass) staged->latency += staged->slots[i].latency; } + // Show recall can replace original CH1 owner and all its binary + // plugin state. Revoke ChannelId PCM BEFORE staging the pointer: + // the original handoff then owns the next audible vendor graph. + dryRoutingLab_.revokeChannelIdPcm(); stagedOwner_ = std::move (staged); if (!handoff_.stage (stagedOwner_.get())) { @@ -1061,7 +1083,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback // admission retains the last accepted M4 with original Orbit/Show. if(result.isEmpty()) (void)dryRoutingLab_.admitChannelIdFromAcceptedM4( - graphOwned_->count,frames,allOutputsDisarmed()); + graphOwned_->count,frames,allOutputsDisarmed(), + currentOriginalCh1Lease()); return result; } void disableDryRoutingLab() noexcept { @@ -1094,7 +1117,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback if(changed.isEmpty() && allOutputsDisarmed() && oldRevision!=dryRoutingLab_.revision()) (void)dryRoutingLab_.admitChannelIdFromAcceptedM4( - graphOwned_->count,frames,true); + graphOwned_->count,frames,true, + currentOriginalCh1Lease()); return changed; } catch(const std::exception& ex) { return "SOURCE: native prepare failed; prior audio kept: " + juce::String(ex.what()); @@ -1125,7 +1149,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback graphOwned_->count,formats_,device->getCurrentSampleRate(),frames); if(changed.isEmpty() && allOutputsDisarmed()) (void)dryRoutingLab_.admitChannelIdFromAcceptedM4( - graphOwned_->count,frames,true); + graphOwned_->count,frames,true, + currentOriginalCh1Lease()); return changed; } catch(...) { return "CHANNEL PATCH: native preparation failed; previous mix preserved"; @@ -1174,7 +1199,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback formats_,device->getCurrentSampleRate(),frames); if(changed.isEmpty() && allOutputsDisarmed()) (void)dryRoutingLab_.admitChannelIdFromAcceptedM4( - graphOwned_->count,frames,true); + graphOwned_->count,frames,true, + currentOriginalCh1Lease()); return changed; } catch(...) { return "AUX CONNECT: failed native preparation; previous route retained"; @@ -1535,8 +1561,12 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback armix::device::LiveSecondaryOutputDevice secondaryOutput_; std::optional savedDirectSetup_; juce::AudioPluginFormatManager formats_; - std::unique_ptr graphOwned_ {std::make_unique()}; - std::unique_ptr stagedOwner_; + // Strong ownership stays on CONTROL. The admitted native ChannelId + // snapshot may retain exactly this Graph while the vendor plugin, Show + // state and editor remain alive through an in-flight callback. + // Handoff still publishes Graph* atomically; no shared_ptr on AUDIO. + std::shared_ptr graphOwned_ {std::make_shared()}; + std::shared_ptr stagedOwner_; armix::rt::LiveGraphHandoff handoff_; // 0 idle, 1 fade-out, 2 fade-in. One controller producer, one RT reader. // No allocation, plugin re-instantiation or extra processing pass. @@ -1544,7 +1574,6 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback std::atomic fxMovePendingOrder_ {Graph::canonicalOrder}; bool attached_ = false; juce::AudioBuffer scratch_; - juce::AudioBuffer dryScratch_; armix::dsp::NativeMasterLoudness masterLoudness_; armix::diagnostics::DiagnosticTone diagnosticTone_; LiveDryRoutingLab dryRoutingLab_; @@ -1698,36 +1727,30 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback outputPeak_.store (0.f); } - // R0 bridge: existing CH1 multi-insert vendor state/Orbit stays owned by - // the live FX handoff. The audio callback holds its Cycle lease throughout - // this render pass, so an old plugin graph cannot retire in mid-block. - // This is a temporary ownership adapter until all inserts are represented - // by the same native multi-lane graph; not a second rendering engine. - struct LegacyChannelOneLease final { LiveAudioEngine* host; Graph* graph; }; - static void processLegacyChannelOne(void* token,int lane,float* left, - float* right,int frames) noexcept + // ONE original CH1 rack processor for M4 compatibility and the native + // ChannelId external lease. Graph lifetime is owned by CONTROL and the + // accepted publisher, never acquired or released inside audio callback. + static void renderOriginalChannelOneGraph(Graph& graph,float* left, + float* right,int frames) noexcept { - if(lane!=0 || !token || !left || !right || frames<=0 || frames>maxFrames)return; - const auto& lease=*static_cast(token); - auto* const host=lease.host; - auto* const graph=lease.graph; - if(!host || !graph || graph->count<=0)return; + if(!left||!right||left==right||frames<=0||frames>maxFrames|| + graph.count<=0)return; float* channels[]{left,right}; juce::AudioBuffer buffer(channels,2,frames); juce::MidiBuffer midi; - const auto order=graph->orderPacked.load(std::memory_order_acquire); - for(int logical=0;logicalcount;++logical) + const auto order=graph.orderPacked.load(std::memory_order_acquire); + for(int logical=0;logicalslots[physical]; + auto& slot=graph.slots[physical]; if(!slot.processor)continue; - auto& bypass=graph->bypassEnvelope[physical]; - bypass.request(graph->bypassFlags[physical].load(std::memory_order_acquire)); + auto& bypass=graph.bypassEnvelope[physical]; + bypass.request(graph.bypassFlags[physical].load(std::memory_order_acquire)); const bool blend=bypass.transitioning(); if(blend) { - juce::FloatVectorOperations::copy(host->dryScratch_.getWritePointer(0),left,frames); - juce::FloatVectorOperations::copy(host->dryScratch_.getWritePointer(1),right,frames); + juce::FloatVectorOperations::copy(graph.dryScratch.getWritePointer(0),left,frames); + juce::FloatVectorOperations::copy(graph.dryScratch.getWritePointer(1),right,frames); } if(bypass.shouldProcessWet()) { @@ -1741,8 +1764,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback } if(blend) { - const float* dryL=host->dryScratch_.getReadPointer(0); - const float* dryR=host->dryScratch_.getReadPointer(1); + const float* dryL=graph.dryScratch.getReadPointer(0); + const float* dryR=graph.dryScratch.getReadPointer(1); for(int i=0;i(token)->graph; + if(graph)renderOriginalChannelOneGraph(*graph,left,right,frames); + } + + // Native external FX is a raw callback on the EXACT shared Graph owner + // bound by UnifiedLegacyProductionAdmission. The snapshot owns the + // strong reference and validates context==owner.get() off realtime. + static void processOwnedChannelOne(void* token,float* left, + float* right,int frames) noexcept + { + if(token)renderOriginalChannelOneGraph( + *static_cast(token),left,right,frames); + } + armix::mixer::DynamicChannelFxLeaseBank::ExternalLease + currentOriginalCh1Lease() const noexcept { + armix::mixer::DynamicChannelFxLeaseBank::ExternalLease fx; + if(!graphOwned_||graphOwned_->count<=0)return fx; + // Native PRE/POST/AUX cannot accept the original external rack + // with latent inserts until graph-wide PDC exists. A missing lease + // keeps the original M4 callback audible without false admission. + for(int i=0;icount;++i) + if(graphOwned_->slots[i].latency!=0)return fx; + fx.owner=std::static_pointer_cast(graphOwned_); // CONTROL + fx.context=graphOwned_.get(); + fx.render=&processOwnedChannelOne; + // id is bound from the compiled native ChannelId roster, NEVER a + // guessed display index/port; no native owner can be misdirected. + return fx; + } + void audioDeviceIOCallbackWithContext ( const float* const* inputs, int inputChannels, float* const* outputs, int outputChannels, int samples, const juce::AudioIODeviceCallbackContext&) override @@ -1874,7 +1934,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback // Both native 10CH routing and the existing CH1 vendor FX chain // execute in ONE stereo output render pass. Never mix a parallel // CH1 output on top or copy vendor processors into another graph. - LegacyChannelOneLease ch1Lease{this,cycle.graph}; + LegacyChannelOneLease ch1Lease{cycle.graph}; std::array nativeMainPair{{-1,-1}}; std::array nativeMonitorPair{{-1,-1}}; const bool routed=dryRoutingLab_.process(inputs,inputChannels,outputs, diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index a1969cc30..16d527d2d 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -973,13 +973,16 @@ class LiveDryRoutingLab final { // topology, retaining original per-lane JUCE VST3 leases and Show state. // This CONTROL-only transaction uses real sparse driver port masks and // the same physical destinations already validated by the M4 owner. - // The original CH1/Orbit external chain remains on M4 until its host - // lifetime/editor+reorder lease can be transferred without two renders. + // Occupied original CH1/Orbit is leased as its existing shared Graph, + // including the exact atomic bypass, FX order, state, tail and editor. + // The published ChannelId snapshot retains this owner until RT retires. bool admitChannelIdFromAcceptedM4(int occupiedExternalCh1Fx, - int deviceFrames,bool outputsDisarmed) { + int deviceFrames,bool outputsDisarmed, + armix::mixer::DynamicChannelFxLeaseBank::ExternalLease externalCh1={}) { channelIdPcmEpoch_.store(0,std::memory_order_release); try { - if(!outputsDisarmed||occupiedExternalCh1Fx!=0 || + if(!outputsDisarmed || occupiedExternalCh1Fx<0 || + (occupiedExternalCh1Fx>0)!=externalCh1.populated() || !hasExplicitRoute()||!ready() || topologyFault_.load(std::memory_order_acquire)) return false; @@ -1032,10 +1035,11 @@ class LiveDryRoutingLab final { deviceFrames,old->maxFramesPerPlugin())); auto applied=armix::mixer::UnifiedLegacyProductionAdmission::compileAndCommit( decoded.channels,{ports.data(),static_cast(inputs)}, - decoded.sends,decoded.aux,monitor,*old,false,hw, + decoded.sends,decoded.aux,monitor,*old, + occupiedExternalCh1Fx>0,hw, frames,32u*1024u*1024u, nativePublisher_.acceptedRevision(),generation,epoch(), - true,nativePublisher_,nativeAccepted_); + true,nativePublisher_,nativeAccepted_,std::move(externalCh1)); if(!applied.ok() || generation!=epoch() || m4Revision!=revision()) return false; // unchanged M4 PCM is the safe rollback channelIdPcmEpoch_.store(generation,std::memory_order_release); diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index 734a26b88..cc2c46605 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -56,19 +56,38 @@ test('unpatched is silent and diagnostic path cannot host a legacy second VST en }); test('original CH1 vendor FX/Orbit is leased exactly once in accepted M4 renderer',()=>{ - const old=engine.indexOf('static void processLegacyChannelOne('); + const old=engine.indexOf('static void renderOriginalChannelOneGraph('); const end=engine.indexOf('void audioDeviceIOCallbackWithContext',old); assert.ok(old>=0&&end>old); const fx=engine.slice(old,end); assert.match(fx,/slot\.processor->processBlock\(buffer,midi\)/); - assert.match(fx,/bypass\.request\(graph->bypassFlags/); + assert.match(fx,/bypass\.request\(graph\.bypassFlags/); assert.match(fx,/catch\(\.\.\.\)/); - assert.match(callback,/LegacyChannelOneLease ch1Lease\{this,cycle\.graph\}/); + assert.match(callback,/LegacyChannelOneLease ch1Lease\{cycle\.graph\}/); assert.match(callback,/&processLegacyChannelOne/); assert.doesNotMatch(callback,/std::make_unique<|std::make_shared<|createPluginInstance\(/, 'no FX instantiation or graph allocation in device callback'); }); +test('occupied CH1 Orbit uses one strong Graph lease through native renderer and Show handoff',()=>{ + assert.match(engine,/std::shared_ptr graphOwned_\s*\{std::make_shared\(\)\}/); + assert.match(engine,/std::shared_ptr stagedOwner_/); + assert.match(engine,/fx\.owner=std::static_pointer_cast\(graphOwned_\)/); + assert.match(engine,/fx\.context=graphOwned_\.get\(\)/); + assert.match(engine,/fx\.render=&processOwnedChannelOne/); + assert.match(engine,/renderOriginalChannelOneGraph\(\*static_cast\(token\)/); + assert.match(engine,/Graph\(\) \{ dryScratch\.setSize\(2,maxFrames,false,true,false\); \}/); + assert.match(engine,/graph\.dryScratch\.getWritePointer\(0\)/); + assert.match(engine,/graph\.orderPacked\.load\(std::memory_order_acquire\)/); + assert.match(engine,/dryRoutingLab_\.revokeChannelIdPcm\(\)/); + assert.equal(count(engine,/dryRoutingLab_\.revokeChannelIdPcm\(\)/g),2, + 'both Show recall and original CH1 ADD/REMOVE must revoke native renderer'); + assert.match(physical,/occupiedExternalCh1Fx>0,hw/); + assert.match(physical,/nativePublisher_,nativeAccepted_,std::move\(externalCh1\)/); + assert.match(physical,/channelIdPcmEpoch_\.store\(0,std::memory_order_release\)/); + assert.equal(count(engine,/void audioDeviceIOCallbackWithContext\s*\(/g),1); +}); + test('shipping application does not compile a second test-only native mixer',()=>{ const app=cmake.split(/\r?\n/).find(l=>l.startsWith('target_sources(ARMixConsole PRIVATE')); assert.ok(app,'native JUCE application source list missing'); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index bb8199d5c..a5338b7d7 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -538,6 +538,7 @@ static void verifyOccupiedExternalCh1Owner() { assert(PreparedRenderGraph::compile(channels,ports,sends,route,err,aux)); auto old=std::make_unique(route,32,32); auto vendor=std::make_shared();auto* raw=vendor.get(); + std::weak_ptr retiringOwner=vendor; std::array src{},silent{},oldL{},oldR{},newL{},newR{}; src.fill(.25f); const float* pins[]{src.data(),silent.data()}; @@ -559,7 +560,9 @@ static void verifyOccupiedExternalCh1Owner() { assert(LegacyGraphMigration::compile(channels,ports,sends,aux,false, monitor,32,2u*1024u*1024u,migrated,migrationError)); DynamicChannelFxLeaseBank::ExternalLease lease; - lease.id=migrated.ids.inputs[0]; + // The original JUCE Graph has no ChannelId. The native ADMISSION, + // not GUI strip ordinals, must bind the verified imported CH1 identity. + lease.id=ChannelId{}; lease.owner=std::static_pointer_cast(vendor); lease.context=raw; lease.render=+[](void* c,float* l,float* r,int n) noexcept { @@ -570,12 +573,23 @@ static void verifyOccupiedExternalCh1Owner() { channels,ports,sends,aux,monitor,*old,true,outputs, 32,2u*1024u*1024u,0,epoch,epoch,true,publisher,accepted,invalid); assert(status.fault==UnifiedLegacyProductionAdmission::Fault::legacyCh1ExternalFx); + // A supplied but WRONG nonzero ChannelId cannot hijack another lane. + invalid=lease;invalid.id=ChannelId{987654}; + status=UnifiedLegacyProductionAdmission::compileAndCommit( + channels,ports,sends,aux,monitor,*old,true,outputs, + 32,2u*1024u*1024u,0,epoch,epoch,true,publisher,accepted,invalid); + assert(status.fault==UnifiedLegacyProductionAdmission::Fault::legacyCh1ExternalFx); + assert(publisher.acceptedRevision()==0); status=UnifiedLegacyProductionAdmission::compileAndCommit( channels,ports,sends,aux,monitor,*old,true,outputs, 32,2u*1024u*1024u,0,epoch,epoch,true,publisher,accepted,lease); assert(status.ok()&&publisher.acceptedRevision()==1); - assert(accepted.fxOwners->externalChannel()==lease.id); + assert(accepted.fxOwners->externalChannel()==migrated.ids.inputs[0]); + // The publisher owns the exact vendor processBlock and GUI state, + // regardless of the former M4 route/control owner's retirement. old.reset();vendor.reset(); + lease={};invalid={}; + assert(!retiringOwner.expired()); const auto fallback=+[](ChannelId,float*,float*,int) noexcept { assert(false && "occupied vendor FX must never disappear"); }; @@ -591,6 +605,12 @@ static void verifyOccupiedExternalCh1Owner() { 32,false,fallback)); assert(newL[31]==0.f&&newR[31]==0.f); assert(publisher.acceptedRevision()==1); + // Once no callback may hold the accepted PCM snapshot, there is no + // hidden second FX owner. All vendor/plugin cleanup is off realtime. + publisher.unpublish(); + accepted=UnifiedLegacyAccepted{}; + assert(publisher.pollRetirement()); + assert(retiringOwner.expired()); } // M-U1 source/processing format independence: a mono microphone through a From a51696f10e15394346be0f8b83af940248d0a1fc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 18:02:53 +0700 Subject: [PATCH 083/155] fix(engine E2): preserve real bypass contract and expose native PCM provenance to M4 GUI Keep the sample-accurate bypass regression pointed at the shared original CH1 DSP function (not the now-trivial M4 wrapper); require BOTH M4 and admitted ChannelId paths to call that same function and retain original Graph scratch/FX owner. Publish actual ChannelId-vs-M4 physical renderer and original CH1 Graph lease as fenced legacyM4 diagnostic readbacks only; never promote universal GUI capabilities. Verify source-to-GUI active/revoked PCM provenance with native integration tests. --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 4 +++ src/ConsoleLiveBridgeV6.h | 18 +++++++++-- src/LiveDryRoutingLab.h | 10 ++++++- tests/live_channel_fx_graph_test.cpp | 16 ++++++++++ tests/live_graph_contract_test.mjs | 30 ++++++++++++------- 5 files changed, 63 insertions(+), 15 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index e6c75c9ee..19102ebdd 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -107,3 +107,7 @@ The installed `LiveAudioEngine::audioDeviceIOCallbackWithContext` still has exac **Regression acceptance:** `verifyOccupiedExternalCh1Owner()` checks compiled CH1 binding without magic ID, rejects wrong/stale owner/context and spoofed ID, compares golden native/M4 vendor PCM, retains the exact original vendor when the M4 owner is destroyed, confirms one vendor invocation on callback, and checks final weak_ptr expiry only after native publisher + GUI owner control retirement. JS architecture gate enforces shared Graph ownership, exactly one installed JUCE callback, original bypass scratch, Show/ADD/REMOVE revocation and native external single-render dispatch. Windows exact-head native, GUI smoke and artifact checks are required before PASS can be claimed. **Remaining NOT DONE:** The real physical ASIO/WASAPI microphone/speaker execution, direct GUI universal CH11/serial GROUP/wet FX RETURN accepted snapshot/ACK, operator-visible external CH1 status and joined #270 executable. Native admission is a verified 10CH/4AUX compatibility cutover, **not** proof of every universal operator workflow; `productionCallbackLive` must stay FALSE until those operations really reach physical PCM. Show recall state needs end-to-end device FAT validation, not merely compiled source coverage. + +### E2 hardware renderer readback — V6 GUI bridge, without capability promotion + +`LiveDryRoutingLab::status()` reports `nativeChannelIdPcmActive` and `originalCh1GraphLeased` from the actual admitted device epoch and native FX owner. `ConsoleLiveBridgeV6::snapshot()` maps these ONLY into the accepted `legacyM4.pcmRenderer` (`CHANNEL_ID_10CH4AUX` or `M4_COMPAT`) and `legacyM4.originalCh1GraphLeased`, while preserving `controlPlane=LEGACY_M4_ORDINAL`, its exact routing revision and verified masks. An unready/no-device fixture receives no fabricated renderer label. Revocation immediately changes readback to `M4_COMPAT`; universal `productionCallbackLive`, stable ChannelIds and `graph.capabilities.supportedOps` remain strictly FALSE until the joined GUI #271/#270 physical integration genuinely controls CH11/Group/FX Return. The bridge's native snapshot regression checks both active and revoked provenance without changing the universal capability contract. diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index d1678c795..4fafb349c 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -97,9 +97,10 @@ class LiveConsoleBridgeV6 final { if(physical<0)continue; w.outputs.push_back({physical,ordinal,{},{},0.}); } - // Authoritative installed renderer is still the old M4 PCM graph. - // Never promote CH10's label to a real wet FX_RETURN or advertise - // universal CREATE/GROUP/INSERT until one ChannelId callback owns it. + // The installed ABI is still M4 ordinals, but the single JUCE + // callback may now select the real native ChannelId PCM renderer + // with original CH1/Orbit lease after accepted admission. Neither + // physical mode implies universal CH11/GROUP/WIRE ownership. w.productionCallbackLive=false; const auto bytes=PuzzleV8Wire::snapshot(w); auto actual=juce::JSON::parse(juce::String::fromUTF8(bytes.c_str())); @@ -134,6 +135,17 @@ class LiveConsoleBridgeV6 final { channels.getArray()->size()==armix::mixer::stripCount) { object->setProperty("acceptedChannels",channels); object->setProperty("controlPlane","LEGACY_M4_ORDINAL"); + // Real accepted PCM provenance for FAT/GUI diagnostics. + // Read from LiveAudioEngine's installed callback, not + // guessed browser roles. This does NOT enable universal + // supportedOps, ChannelIds, or graph revision. + const bool native=static_cast(route.getProperty( + "nativeChannelIdPcmActive",false)); + object->setProperty("pcmRenderer",native + ?"CHANNEL_ID_10CH4AUX":"M4_COMPAT"); + object->setProperty("originalCh1GraphLeased", + native && static_cast(route.getProperty( + "originalCh1GraphLeased",false))); // Separate namespace: these operations mutate the one // INSTALLED M4 JUCE PCM graph. They are NEVER universal // graph.capabilities.supportedOps or ChannelIds. diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 16d527d2d..e47634a40 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1349,7 +1349,15 @@ class LiveDryRoutingLab final { out->setProperty("topologyFault",topologyFault_.load(std::memory_order_acquire)); out->setProperty("ready",ready()); out->setProperty("hasAcceptedRoute",hasExplicitRoute()); - out->setProperty("nativeChannelIdPcmActive",channelIdPhysicalPcmActive()); + const bool nativePcm=channelIdPhysicalPcmActive(); + out->setProperty("nativeChannelIdPcmActive",nativePcm); + // This exact original vendor Graph owner is retained by the native + // accepted snapshot, NOT merely a catalog name or M4 CH1 label. + // Message-thread diagnostic only; no false universal capabilities. + out->setProperty("originalCh1GraphLeased", + nativePcm && nativeAccepted_.fxOwners && + nativeAccepted_.fxOwners->externalChannel()== + nativeAccepted_.graph.ids.inputs[0]); out->setProperty("epoch",static_cast(epoch())); out->setProperty("revision",static_cast(revision())); out->setProperty("peakL",peakL_.load(std::memory_order_relaxed)); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index a5338b7d7..42a8a3868 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -687,6 +687,10 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { route->setProperty("active",true); route->setProperty("ready",true); route->setProperty("hasAcceptedRoute",true); + // These booleans are device-loop truth, NOT permission to promote + // universal CH11, GROUP or WIRE operations in the GUI. + route->setProperty("nativeChannelIdPcmActive",true); + route->setProperty("originalCh1GraphLeased",true); // Genuine admitted M4 rows, not fabricated universal ChannelIds. juce::Array admittedRows; for(int i=0;i(diagnostic.getProperty("originalCh1GraphLeased",false))); + // A revoked native PCM mode must immediately report M4 fallback without + // inventing any universal ChannelId capabilities or stale FX identity. + auto liveRoute=live.getProperty("dryRoutingLab",{}); + liveRoute.getDynamicObject()->setProperty("nativeChannelIdPcmActive",false); + auto fallbackSnap=Bridge::snapshot(live); + const auto fallbackM4=fallbackSnap.getProperty("legacyM4",{}); + assert(fallbackM4.getProperty("pcmRenderer","").toString()=="M4_COMPAT"); + assert(!static_cast(fallbackM4.getProperty("originalCh1GraphLeased",true))); + assert(!static_cast(fallbackSnap.getProperty("productionCallbackLive",true))); + liveRoute.getDynamicObject()->setProperty("nativeChannelIdPcmActive",true); const auto legacyRows=diagnostic.getProperty("acceptedChannels",{}); assert(legacyRows.getArray()&& legacyRows.getArray()->size()==armix::mixer::stripCount); diff --git a/tests/live_graph_contract_test.mjs b/tests/live_graph_contract_test.mjs index 281dc9784..6edcd12f1 100644 --- a/tests/live_graph_contract_test.mjs +++ b/tests/live_graph_contract_test.mjs @@ -52,18 +52,26 @@ test('ADD/REMOVE remain guarded while MOVE publishes physical-slot order',()=>{ assert.doesNotMatch(move,/detach\(|attach\(/); }); -test('bypass is sample-smoothed on audio callback without control-thread CPU work',()=>{ +test('bypass is sample-smoothed by one original CH1 DSP owner for M4 and native ChannelId',()=>{ assert.match(e,/bypassEnvelope/); - const start=e.indexOf('static void processLegacyChannelOne('); - const end=e.indexOf('void audioDeviceIOCallbackWithContext',start); - assert.ok(start>=0&&end>start,'the accepted M4 CH1 owner must still exist'); - const leaseFx=e.slice(start,end); - assert.match(leaseFx,/bypass\.request\(graph->bypassFlags/); - assert.match(leaseFx,/slot\.processor->processBlock\(buffer,midi\)/); - assert.match(leaseFx,/bypass\.transitioning\(\)/); - assert.match(e,/dryScratch_\.setSize \(2, maxFrames/); - assert.match(leaseFx,/bypass\.next\(\)/); - assert.match(leaseFx,/bypass\.shouldProcessWet\(\)/); + const start=e.indexOf('static void renderOriginalChannelOneGraph('); + const legacy=e.indexOf('static void processLegacyChannelOne(',start); + const native=e.indexOf('static void processOwnedChannelOne(',legacy); + const end=e.indexOf('void audioDeviceIOCallbackWithContext',native); + assert.ok(start>=0&&legacy>start&&native>legacy&&end>native, + 'native and M4 must share the original CH1 sample-accurate DSP owner'); + const originalDSP=e.slice(start,legacy); + const adapters=e.slice(legacy,end); + assert.match(originalDSP,/bypass\.request\(graph\.bypassFlags/); + assert.match(originalDSP,/slot\.processor->processBlock\(buffer,midi\)/); + assert.match(originalDSP,/bypass\.transitioning\(\)/); + assert.match(originalDSP,/graph\.dryScratch\.getWritePointer\(0\)/); + assert.match(originalDSP,/bypass\.next\(\)/); + assert.match(originalDSP,/bypass\.shouldProcessWet\(\)/); + assert.match(e,/Graph\(\) \{ dryScratch\.setSize\(2,maxFrames,false,true,false\); \}/); + assert.match(adapters,/renderOriginalChannelOneGraph\(\*graph,left,right,frames\)/); + assert.match(adapters,/renderOriginalChannelOneGraph\(\s*\*static_cast\(token\)/); + assert.match(adapters,/fx\.owner=std::static_pointer_cast\(graphOwned_\)/); assert.doesNotMatch(e.slice(e.indexOf('bool setBypass'),e.indexOf('bool removeAt')),/detach\(|prepareToPlay|releaseResources/); }); From 8d138b3959931bbc387c852ae3234e3a532cb1c2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 18:12:43 +0700 Subject: [PATCH 084/155] fix(engine E2 CI): validate CH1 owner retirement with void poll API and unique fixture names Repair native test compilation (pollRetirement returns void; avoid duplicate liveRoute variable) while preserving vendor weak_ptr-expiry assertion. Accept a line break in the shared original CH1 DSP delegation source gate, still requiring the same real native owner and bypass implementation. No audio DSP or GUI behavior weakened. --- tests/engine_runtime_reconciliation_test.mjs | 2 +- tests/live_channel_fx_graph_test.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index cc2c46605..c251048d2 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -75,7 +75,7 @@ test('occupied CH1 Orbit uses one strong Graph lease through native renderer and assert.match(engine,/fx\.owner=std::static_pointer_cast\(graphOwned_\)/); assert.match(engine,/fx\.context=graphOwned_\.get\(\)/); assert.match(engine,/fx\.render=&processOwnedChannelOne/); - assert.match(engine,/renderOriginalChannelOneGraph\(\*static_cast\(token\)/); + assert.match(engine,/renderOriginalChannelOneGraph\(\s*\*static_cast\(token\)/); assert.match(engine,/Graph\(\) \{ dryScratch\.setSize\(2,maxFrames,false,true,false\); \}/); assert.match(engine,/graph\.dryScratch\.getWritePointer\(0\)/); assert.match(engine,/graph\.orderPacked\.load\(std::memory_order_acquire\)/); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 42a8a3868..d9af5997a 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -609,7 +609,7 @@ static void verifyOccupiedExternalCh1Owner() { // hidden second FX owner. All vendor/plugin cleanup is off realtime. publisher.unpublish(); accepted=UnifiedLegacyAccepted{}; - assert(publisher.pollRetirement()); + publisher.pollRetirement(); assert(retiringOwner.expired()); } @@ -773,14 +773,14 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(static_cast(diagnostic.getProperty("originalCh1GraphLeased",false))); // A revoked native PCM mode must immediately report M4 fallback without // inventing any universal ChannelId capabilities or stale FX identity. - auto liveRoute=live.getProperty("dryRoutingLab",{}); - liveRoute.getDynamicObject()->setProperty("nativeChannelIdPcmActive",false); + auto pcmRouteReadback=live.getProperty("dryRoutingLab",{}); + pcmRouteReadback.getDynamicObject()->setProperty("nativeChannelIdPcmActive",false); auto fallbackSnap=Bridge::snapshot(live); const auto fallbackM4=fallbackSnap.getProperty("legacyM4",{}); assert(fallbackM4.getProperty("pcmRenderer","").toString()=="M4_COMPAT"); assert(!static_cast(fallbackM4.getProperty("originalCh1GraphLeased",true))); assert(!static_cast(fallbackSnap.getProperty("productionCallbackLive",true))); - liveRoute.getDynamicObject()->setProperty("nativeChannelIdPcmActive",true); + pcmRouteReadback.getDynamicObject()->setProperty("nativeChannelIdPcmActive",true); const auto legacyRows=diagnostic.getProperty("acceptedChannels",{}); assert(legacyRows.getArray()&& legacyRows.getArray()->size()==armix::mixer::stripCount); From 02df2ba263a1fb8ea656ac12e1567dc30ac1690f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 20:27:49 +0700 Subject: [PATCH 085/155] feat(engine E3): physical ChannelId GROUP/FX RETURN bus transactions and real WebView ACK Publish selected primary OUT-to-GROUP or independent parallel FX RETURN send on the SAME admitted ChannelId PCM publisher and JUCE hardware callback. Reuse exact original CH1/Orbit and per-strip VST3 owners via immutable revision-bound FX lease bank, transactional NACK on any invalid graph/epoch. Support GROUP/FX RETURN fader and PAN as native real-time atomics. Expose scoped physical nativeBus ChannelId/revision/role/OUT/sends/controls from accepted engine readback, and version-fenced native WebView intents for create, remove and live bus mix, with replay/stale/output-armed rejections. Do NOT promote universal CH11/WIRE/Show capability until full parity. Fix real-time callback fixed meter capacity bug for expanded native graphs: meter only stable 10CH+4AUX prefix with no per-callback allocation. Retain accepted hot SOURCE/mix/send values across subsequent structural compiles. Fail SILENT (never silently fall back to incompatible M4) if an expanded native bus loses PCM authority, and block old CH1 structural replacement until native extra buses are removed. Add golden serial/parallel PCM and vendor-owner-once tests, native intent/revision tests and handoff. --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 12 + engine/core/DynamicPreparedMixerBlock.h | 14 +- src/ConsoleLiveBridgeV6.h | 160 +++++++++++ src/LiveAudioEngine.h | 40 +++ src/LiveDryRoutingLab.h | 257 ++++++++++++++++-- src/Main.cpp | 8 +- tests/engine_runtime_reconciliation_test.mjs | 23 ++ tests/live_channel_fx_graph_test.cpp | 175 ++++++++++++ 8 files changed, 659 insertions(+), 30 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index 19102ebdd..7ee9854d8 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -111,3 +111,15 @@ The installed `LiveAudioEngine::audioDeviceIOCallbackWithContext` still has exac ### E2 hardware renderer readback — V6 GUI bridge, without capability promotion `LiveDryRoutingLab::status()` reports `nativeChannelIdPcmActive` and `originalCh1GraphLeased` from the actual admitted device epoch and native FX owner. `ConsoleLiveBridgeV6::snapshot()` maps these ONLY into the accepted `legacyM4.pcmRenderer` (`CHANNEL_ID_10CH4AUX` or `M4_COMPAT`) and `legacyM4.originalCh1GraphLeased`, while preserving `controlPlane=LEGACY_M4_ORDINAL`, its exact routing revision and verified masks. An unready/no-device fixture receives no fabricated renderer label. Revocation immediately changes readback to `M4_COMPAT`; universal `productionCallbackLive`, stable ChannelIds and `graph.capabilities.supportedOps` remain strictly FALSE until the joined GUI #271/#270 physical integration genuinely controls CH11/Group/FX Return. The bridge's native snapshot regression checks both active and revoked provenance without changing the universal capability contract. + +## E3 native ChannelId BUS transactions on the single installed PCM callback (2026-11-03) + +The original physical `LiveDryRoutingLab` native publisher now offers one CONTROL-only `editNativeBus()` transaction. With a verified DIRECT device, accepted 10CH+4AUX ChannelId PCM, exact epoch + native graph/roster revision, and MAIN/secondary output **DISARMED**, the operator can create a real stereo **GROUP** with selected sources' exclusive primary OUT rerouted to the new bus, create a real stereo **FX_RETURN** with parallel POST sends that leave primary OUT unchanged, or remove a Group/Return and restore affected serial inputs to MAIN. This is `DynamicChannelRoster::createBusForSelected` and `removeBusAndRestoreSources`, compiled and published by the **same `DynamicNativeSessionPublisher` inside the one existing JUCE callback**, not a second mixer. Stable ChannelIds come only from native ACK, not GUI row indices. + +Each bus commit creates a CONTROL-owned, revision-bound `DynamicChannelFxLeaseBank::reuseRevision` with the EXACT prior routed VST3 and original CH1/Orbit Graph owners, precompiles PCM/scratch and atomically publishes its valid revision. Invalid name/selected source, invalid graph, cycle, physical source, stale epoch/revision, resource/retirement budget or armed output returns a NACK and retains the prior accepted routing, owner leases and PCM. No third-party plugin processing, graph compiling, string parsing, heap allocation, refcount or blocking is added to the AUDIO callback. GROUP fader/PAN is a live ChannelId atomic scalar and persists into subsequent accepted structural graph edits. + +**Important root fix**: the physical callback's meter API requests the stable 10+4 prefix while new GROUP/FX RETURN lanes expand the roster; a short meter span no longer rejects an otherwise valid expanded graph. New lanes render PCM with no callback-sized allocations; their group meters remain unavailable until the GUI has an explicitly owned channel meter subscription. Live M4 SOURCE/fader/MUTE/PAN/AUX/MONITOR changes now also update the native accepted physical request/roster after matching native ACK, preventing next Group edit from reverting the physical pin or fader. If the native structural graph loses an authorized render/mirror, the callback faults **SILENT**, not a falsely equivalent M4 fallback. Structural edits of the legacy original CH1 rack while extra native buses exist are intentionally blocked, because an M4 fallback cannot express their bus topology. Removal of the final extra bus restores the M4-compatible topology flag. + +**Actual WebView intent seam (no fake universal promotion)**: `arMixConsoleIntent` dispatches `NATIVE_CREATE_GROUP_SELECTED`, `NATIVE_CREATE_FX_RETURN_SELECTED`, `NATIVE_REMOVE_BUS` and `NATIVE_SET_BUS_MIX` on the accepted `legacyM4.nativeBus` namespace, with decimal-string `deviceEpoch`, `legacyRoutingRevision`, `nativeGraphRevision`, `nativeRosterRevision` and an opaque `requestId`. Creation takes `payload.name`, `payload.selectedChannelIds` (native decimal-string ChannelIds from `legacyM4.nativeBus.channels`), and optional `payload.sendGain` default 0.25; removal takes `targetChannelId`; live bus gain takes `targetChannelId` and `payload.gain`/`payload.pan`. This channel routing readback and `supportedOps` is emitted **only** when the actual physical native PCM is admitted. The reply has `nativeGraphRevision`, `nativeRosterRevision` and `createdChannelId` only after a successful native transaction. The global schema v6 `productionCallbackLive=false` and universal `graph.capabilities.supportedOps=[]` are intentionally unchanged: full CH11/input creation, generic INSERT ownership, native disk Show roundtrip and polished approved GUI WIRE controls are still NOT supported. + +**Regression:** original JUCE vendor CH1 process is called once per render, with golden serial GROUP output equal to direct MAIN, then increased parallel FX Return output without losing GROUP primary OUT; no callback heap with a short 10+4 meter span despite extra lanes; stale revision NACK; stable VST instance retained until retirement; native v6 intent accepted + duplicate/stale rejects. All code builds and test results must be attached to the exact HEAD SHA. Physical ASIO/WASAPI 0FX/1FX FAT and crackle #15 remain NOT TESTED; this is not a stable release. diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index cc6aa73be..f71319d03 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -463,12 +463,16 @@ class DynamicPreparedMixerBlock final { std::span channelPeaksL={}, std::span channelPeaksR={}) noexcept { if(frames<=0 || !outputL || !outputR)return false; - if(channelPeaksL.size()!=channelPeaksR.size() || - (!channelPeaksL.empty() && channelPeaksL.size() #include #include +#include +#include // Native Console v6 adapter, exclusively on the JUCE MESSAGE/CONTROL thread. // This projects the real M4 callback/device readback WITHOUT promoting its @@ -146,6 +148,12 @@ class LiveConsoleBridgeV6 final { object->setProperty("originalCh1GraphLeased", native && static_cast(route.getProperty( "originalCh1GraphLeased",false))); + // Separate scoped native bus transport, not universal + // v8 graph capabilities or synthetic M4 strip ordinals. + const auto bus=route.getProperty("nativeBus",juce::var()); + if(native && bus.isObject()) { + object->setProperty("nativeBus",bus); + } // Separate namespace: these operations mutate the one // INSTALLED M4 JUCE PCM graph. They are NEVER universal // graph.capabilities.supportedOps or ChannelIds. @@ -517,6 +525,158 @@ class LiveConsoleBridgeV6 final { return juce::JSON::parse(juce::String::fromUTF8(json.c_str())); } + + // E3 scoped native bus control transport. The installed callback already + // owns this stable ChannelId graph; output is DISARMED for structural + // changes, and readback comes from the newly accepted PCM publisher. + // This is deliberately a SEPARATE legacyM4.nativeBus namespace rather + // than claiming that universal CH11/WIRE/SHOW is available. + template + juce::var processNativeBusIntent(const juce::var& intent, + const juce::var& snapshot, + Engine& engine,bool ioBusy=false) { + const auto req=intent.getProperty("requestId",juce::var()); + const auto request=req.isString()?req.toString():juce::String(); + const auto key=request.toStdString(); + const auto device=snapshot.getProperty("device",juce::var()); + const auto graph=snapshot.getProperty("graph",juce::var()); + const auto legacy=snapshot.getProperty("legacyM4",juce::var()); + const auto bus=legacy.getProperty("nativeBus",juce::var()); + const auto epoch=device.getProperty("epoch","0").toString(); + juce::String error; + bool applied=false; + std::uint64_t nativeRev=0,rosterRev=0,requestedEpoch=0,legacyRevision=0; + armix::mixer::ChannelId created{}; + if(!armix::integration::validConsoleRequestId(key)) + error="INVALID_REQUEST_ID"; + else if(completed_.find(key)!=completed_.end()) + error="DUPLICATE_REQUEST_ID"; + else { + if(recentIds_.size()==maxRecentIds) { + completed_.erase(recentIds_.front());recentIds_.pop_front(); + } + recentIds_.push_back(key);completed_.insert(key); + const auto operation=intent.getProperty("operation","").toString(); + const auto payload=intent.getProperty("payload",juce::var()); + if(ioBusy)error="NATIVE_SHOW_OR_BACKUP_BUSY"; + else if(!decodeDecimal(intent.getProperty("deviceEpoch",{}),requestedEpoch) || + !decodeDecimal(intent.getProperty("legacyRoutingRevision",{}),legacyRevision) || + !decodeDecimal(intent.getProperty("nativeGraphRevision",{}),nativeRev) || + !decodeDecimal(intent.getProperty("nativeRosterRevision",{}),rosterRev) || + intent.getProperty("deviceEpoch","").toString()!=epoch || + intent.getProperty("legacyRoutingRevision","").toString()!= + legacy.getProperty("routingRevision","").toString()) + error="STALE_NATIVE_BUS_DEVICE_OR_ROUTE"; + else if(!bus.isObject() || + bus.getProperty("graphRevision","").toString()!= + intent.getProperty("nativeGraphRevision","").toString() || + bus.getProperty("rosterRevision","").toString()!= + intent.getProperty("nativeRosterRevision","").toString() || + legacy.getProperty("controlPlane","").toString()!="LEGACY_M4_ORDINAL") + error="NATIVE_BUS_GRAPH_NOT_ADMITTED"; + else if(!payload.isObject())error="INVALID_NATIVE_BUS_PAYLOAD"; + else if(operation=="NATIVE_SET_BUS_MIX") { + std::uint64_t target=0; + const auto rawGain=payload.getProperty("gain",juce::var()); + const auto rawPan=payload.getProperty("pan",juce::var()); + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),target) || + target==0 || + !(rawGain.isInt()||rawGain.isDouble()) || + !(rawPan.isInt()||rawPan.isDouble())) + error="INVALID_NATIVE_BUS_MIX"; + else { + const auto gain=static_cast(rawGain); + const auto pan=static_cast(rawPan); + if(!std::isfinite(gain)||gain<0.||gain>4. || + !std::isfinite(pan)||pan< -1.||pan>1.) + error="INVALID_NATIVE_BUS_MIX"; + else { + applied=engine.setNativeBusMix( + requestedEpoch,nativeRev, + armix::mixer::ChannelId{target}, + static_cast(gain),static_cast(pan)); + if(!applied)error="NATIVE_BUS_MIX_REJECTED"; + } + } + } + else if(operation!="NATIVE_CREATE_GROUP_SELECTED" && + operation!="NATIVE_CREATE_FX_RETURN_SELECTED" && + operation!="NATIVE_REMOVE_BUS") + error="UNSUPPORTED_NATIVE_BUS_OPERATION"; + else { + using namespace armix::mixer; + std::vector selected; + ChannelId remove{}; + auto role=ChannelRole::group; + juce::String name; + float gain=.25f; + if(operation=="NATIVE_REMOVE_BUS") { + std::uint64_t id=0; + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),id) || + id==0)error="INVALID_NATIVE_BUS_ID"; + else remove={id}; + } else { + role=operation=="NATIVE_CREATE_GROUP_SELECTED" + ?ChannelRole::group:ChannelRole::fxReturn; + name=payload.getProperty("name","").toString(); + const auto raw=payload.getProperty("selectedChannelIds",juce::var()); + const auto* ids=raw.getArray(); + const auto g=payload.getProperty("sendGain",juce::var(.25)); + const double value=static_cast(g); + if(name.isEmpty()||name.length()>64 || + !ids||ids->isEmpty()||ids->size()>64 || + !(g.isDouble()||g.isInt()) || + !std::isfinite(value)||value<0.||value>4.) { + error="INVALID_NATIVE_BUS_SELECTION"; + } else { + gain=static_cast(value); + selected.reserve(static_cast(ids->size())); + for(const auto& item:*ids) { + std::uint64_t id=0; + if(!decodeDecimal(item,id)||id==0) { + error="INVALID_NATIVE_BUS_SOURCE_ID";break; + } + selected.push_back({id}); + } + } + } + if(error.isEmpty()) { + auto result=engine.editNativeBus( + requestedEpoch,nativeRev,rosterRev,role, + std::span(selected),name.toStdString(), + gain,remove); + applied=result.accepted; + if(!applied)error=result.error; + else { + created=result.created; + nativeRev=result.pcmRevision; + rosterRev=result.rosterRevision; + } + } + } + } + // Preserve universal revision 0. Provide native namespace revision + // and created stable ID ONLY after the actual hardware PCM ACK. + PuzzleV8Ack ack; + ack.requestId=key; + ack.status=applied?"ACCEPTED":"REJECTED"; + ack.deviceEpoch=epoch.toStdString(); + ack.graphRevision=graph.getProperty("revision","0").toString().toStdString(); + ack.rosterRevision=graph.getProperty("rosterRevision","0").toString().toStdString(); + ack.errorCode=error.toStdString(); + const auto json=PuzzleV8Wire::ack(ack); + auto wire=juce::JSON::parse(juce::String::fromUTF8(json.c_str())); + if(applied)if(auto* object=wire.getDynamicObject()) { + object->setProperty("nativeGraphRevision", + juce::String(std::to_string(nativeRev))); + object->setProperty("nativeRosterRevision", + juce::String(std::to_string(rosterRev))); + object->setProperty("createdChannelId", + juce::String(std::to_string(created.value))); + } + return wire; + } + static bool parsePortId(const juce::String& wire,const char* prefix,int& physical) { if(!wire.startsWith(prefix))return false; const auto text=wire.substring(static_cast(std::char_traits::length(prefix))); diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 07f8d1928..5160f1f87 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -723,6 +723,10 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback { // All checks precede staging: a rejected edit must not alter the // currently audible graph or any accepted route revision. + // An extra native GROUP/FX RETURN has no equivalent M4 fallback. + // Do not silently reroute its sources during an original CH1 + // structural FX edit; remove native BUSes or replace the patch first. + if(dryRoutingLab_.nativeBusTopologyLive())return false; if(!next || !attached_ || !device || independent_.active() || !directFence_.permitted() || handoff_.busy() || fxMovePhase_.load(std::memory_order_acquire)!=0 || @@ -1243,6 +1247,42 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback } std::uint64_t dryRoutingLabEpoch() const noexcept {return dryRoutingLab_.epoch();} std::uint64_t dryRoutingLabRevision() const noexcept {return dryRoutingLab_.revision();} + // One native ChannelId bus transaction on the installed DIRECT device. + // The GUI only obtains accepted state after successful native publisher + // commit; no speculative UI role or second audio engine. + LiveDryRoutingLab::NativeBusResult editNativeBus( + std::uint64_t epoch,std::uint64_t pcmRevision, + std::uint64_t rosterRevision, + armix::mixer::ChannelRole role, + std::span selected, + const std::string& name,float gain, + armix::mixer::ChannelId remove={}) { + LiveDryRoutingLab::NativeBusResult rejected; + rejected.error="HARDWARE_NOT_DISARMED"; + if(independent_.active() || !attached_ || + !directFence_.permitted() || + routeReconfiguring_.load(std::memory_order_acquire) || + diagnosticRoute_.load(std::memory_order_acquire)!= + armix::diagnostics::Route::normal || + !allOutputsDisarmed() || handoff_.busy() || + fxMovePhase_.load(std::memory_order_acquire)!=0) + return rejected; + return dryRoutingLab_.editNativeBus( + epoch,pcmRevision,rosterRevision,role,selected, + name,gain,remove,true); + } + bool nativeBusTopologyLive() const noexcept { + return dryRoutingLab_.nativeBusTopologyLive(); + } + bool setNativeBusMix(std::uint64_t epoch, + std::uint64_t revision, + armix::mixer::ChannelId id,float gain,float pan) noexcept { + if(independent_.active()||!directFence_.permitted()|| + routeReconfiguring_.load(std::memory_order_acquire) || + diagnosticRoute_.load(std::memory_order_acquire)!= + armix::diagnostics::Route::normal)return false; + return dryRoutingLab_.setNativeBusMix(epoch,revision,id,gain,pan); + } bool dryRoutingLabActive() const noexcept {return dryRoutingLab_.active();} void pollDryRoutingLab() noexcept {dryRoutingLab_.poll();} diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index e47634a40..4146dd2da 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -505,8 +505,19 @@ class LiveDryRoutingLab final { if(!nativePublisher_.setPhysicalSource( expectedEpoch,nativeAccepted_.pcmRevision,id, callbackLeft,mode=="STEREO"?callbackRight:-1, - mode=="STEREO")) - channelIdPcmEpoch_.store(0,std::memory_order_release); + mode=="STEREO"))rejectedNativeMirror(); + else { + // Physical SOURCE changes are LIVE atomic controls. Persist + // the actual callback ordinals for the NEXT Group/FX Return + // structural compile rather than reusing stale APPLY pins. + auto& patches=nativeAccepted_.graph.request.sources; + const auto found=std::find_if(patches.begin(),patches.end(), + [id](const auto& patch){return patch.id==id;}); + if(found!=patches.end()) { + found->inputL=callbackLeft; + found->inputR=mode=="STEREO"?callbackRight:-1; + } + } } if(auto* object=row.getDynamicObject()){ object->setProperty("left",physicalLeft); @@ -752,8 +763,15 @@ class LiveDryRoutingLab final { :nativePublisher_.setChannelMix( expectedEpoch,nativeAccepted_.pcmRevision, id,updated.linear,updated.pan); - if(!mirrored) - channelIdPcmEpoch_.store(0,std::memory_order_release); + if(!mirrored)rejectedNativeMirror(); + else { + const auto id=nativeAccepted_.graph.ids.inputs[strip]; + if(name=="mute"||name=="solo") + nativeAccepted_.graph.roster.rememberLiveMuteSolo( + id,updated.mute,updated.solo); + else nativeAccepted_.graph.roster.rememberLiveMix( + id,updated.linear,updated.pan); + } } return true; } @@ -789,13 +807,16 @@ class LiveDryRoutingLab final { return fx.setAuxSendGain(source,bus,tap,gain); }))return false; accepted->getDynamicObject()->setProperty("gain",static_cast(gain)); - if(channelIdPhysicalPcmActive() && - !nativePublisher_.setParallelSendGain( - expectedEpoch,nativeAccepted_.pcmRevision, - nativeAccepted_.graph.ids.inputs[source], - nativeAccepted_.graph.ids.aux[bus], - tap==armix::mixer::SendTap::preFader,gain)) - channelIdPcmEpoch_.store(0,std::memory_order_release); + if(channelIdPhysicalPcmActive()) { + const auto id=nativeAccepted_.graph.ids.inputs[source]; + const auto target=nativeAccepted_.graph.ids.aux[bus]; + const bool pre=tap==armix::mixer::SendTap::preFader; + if(!nativePublisher_.setParallelSendGain( + expectedEpoch,nativeAccepted_.pcmRevision, + id,target,pre,gain))rejectedNativeMirror(); + else nativeAccepted_.graph.roster.rememberLiveParallelSend( + id,target,pre,gain); + } return true; } @@ -816,11 +837,13 @@ class LiveDryRoutingLab final { return false; if(auto* obj=(*arr)[bus].getDynamicObject()) obj->setProperty("gain",static_cast(gain)); - if(channelIdPhysicalPcmActive() && - !nativePublisher_.setChannelMix( - expectedEpoch,nativeAccepted_.pcmRevision, - nativeAccepted_.graph.ids.aux[bus],gain,0.f)) - channelIdPcmEpoch_.store(0,std::memory_order_release); + if(channelIdPhysicalPcmActive()) { + const auto id=nativeAccepted_.graph.ids.aux[bus]; + if(!nativePublisher_.setChannelMix( + expectedEpoch,nativeAccepted_.pcmRevision, + id,gain,0.f))rejectedNativeMirror(); + else nativeAccepted_.graph.roster.rememberLiveMix(id,gain,0.f); + } return true; } @@ -843,13 +866,16 @@ class LiveDryRoutingLab final { return fx.setMonitorSendGain(source,gain); }))return false; array->set(source,static_cast(gain)); // same accepted topology - if(channelIdPhysicalPcmActive() && - !nativePublisher_.setParallelSendGain( - expectedEpoch,nativeAccepted_.pcmRevision, - source0)!=externalCh1.populated() || @@ -1050,16 +1077,196 @@ class LiveDryRoutingLab final { return false; } } + // E3: structural native GROUP/FX RETURN transaction on the SAME + // accepted physical ChannelId publisher. This is the CONTROL writer, + // not a second graph/audio callback or a simulated Console mutation. + // An error leaves the last accepted roster, plugin leases and PCM intact. + struct NativeBusResult final { + bool accepted=false; + armix::mixer::ChannelId created{}; + std::uint64_t pcmRevision=0,rosterRevision=0; + const char* error="NATIVE_GRAPH_NOT_READY"; + }; + NativeBusResult editNativeBus(std::uint64_t expectedEpoch, + std::uint64_t expectedPcmRevision, + std::uint64_t expectedRosterRevision, + armix::mixer::ChannelRole role, + std::span selection, + const std::string& name,float sendGain, + armix::mixer::ChannelId remove={}, + bool outputsDisarmed=false) { + using namespace armix::mixer; + NativeBusResult reply{}; + reply.pcmRevision=nativeAccepted_.pcmRevision; + reply.rosterRevision=nativeAccepted_.graph.roster.revision(); + if(!channelIdPhysicalPcmActive() || !ready() || + expectedEpoch!=epoch() || nativeAccepted_.deviceEpoch!=expectedEpoch || + !nativeAccepted_.fxOwners || + expectedPcmRevision!=nativeAccepted_.pcmRevision || + expectedRosterRevision!=nativeAccepted_.graph.roster.revision()) + return reply; + if(!outputsDisarmed) { + reply.error="OUTPUT_MUST_BE_DISARMED";return reply; + } + try { + auto next=nativeAccepted_.graph.roster; // CONTROL only + ChannelEditResult changed; + if(remove.value) { + changed=next.removeBusAndRestoreSources( + expectedRosterRevision,remove); + } else if(selection.empty()) { + changed=next.createStandaloneBus( + expectedRosterRevision,name,role); + } else { + changed=next.createBusForSelected( + expectedRosterRevision,selection,name,role,sendGain); + } + if(!changed.ok()) { + reply.error="INVALID_NATIVE_BUS_EDIT";return reply; + } + // The bank is a revision-bound immutable map of actual VST3 + // owners. Reuse every current instance incl. original CH1 + // without duplicating, releasing or instantiating a processor. + DynamicChannelFxLeaseBank bank; + if(DynamicChannelFxLeaseBank::reuseRevision( + expectedEpoch,expectedPcmRevision+1, + *nativeAccepted_.fxOwners,bank)!= + DynamicChannelFxLeaseBank::Fault::none) { + reply.error="NATIVE_FX_LEASE_REJECTED";return reply; + } + auto owner=std::make_shared( + std::move(bank)); + DynamicNativeSessionPublisher::FxPlan fx; + fx.owner=std::static_pointer_cast(owner); + fx.context=owner.get(); + fx.render=+[](void* ctx,ChannelId id,float* l,float* r,int n) noexcept { + (*static_cast(ctx))(id,l,r,n); + }; + fx.deviceEpoch=expectedEpoch; + fx.graphRevision=expectedPcmRevision+1; + const auto published=nativePublisher_.commit( + next,nativeAccepted_.graph.request,expectedPcmRevision, + expectedEpoch,epoch(),true,std::move(fx)); + if(!published.ok()) { + reply.error="NATIVE_PCM_COMMIT_REJECTED";return reply; + } + nativeAccepted_.graph.roster=std::move(next); + nativeAccepted_.fxOwners=std::move(owner); + nativeAccepted_.pcmRevision=published.revision; + // From now on original fixed M4 cannot express the extra BUS. + // The native publisher remains the authoritative PCM, and a + // failed scalar mirror MUST fault silent rather than reselect + // an incompatible legacy route. + nativeStructureLive_=nativeAccepted_.graph.roster.size()> + static_cast(fxSlots+1+ + (nativeAccepted_.hardware.monitorEnabled?1:0)); + reply.accepted=true;reply.error=""; + reply.pcmRevision=published.revision; + reply.rosterRevision=nativeAccepted_.graph.roster.revision(); + if(!changed.createdIds.empty())reply.created=changed.createdIds[0]; + return reply; + } catch(...) { + reply.error="NATIVE_BUS_PREPARE_FAILED";return reply; + } + } + bool nativeBusTopologyLive() const noexcept { + return nativeStructureLive_ && channelIdPhysicalPcmActive(); + } + // Live bus controls update only verified ChannelIds and their canonical + // roster values. Group/FX RETURN faders are actual post-insert PCM, + // not a browser-only knob or duplicated legacy M4 strip. + bool setNativeBusMix(std::uint64_t epochAtEdit, + std::uint64_t expectedPcmRevision, + armix::mixer::ChannelId id,float gain,float pan) noexcept { + if(!channelIdPhysicalPcmActive() || epochAtEdit!=epoch() || + expectedPcmRevision!=nativeAccepted_.pcmRevision)return false; + const auto* channel=nativeAccepted_.graph.roster.find(id); + if(!channel || (channel->role!=armix::mixer::ChannelRole::group && + channel->role!=armix::mixer::ChannelRole::fxReturn)) + return false; + if(!nativePublisher_.setChannelMix( + epochAtEdit,expectedPcmRevision,id,gain,pan))return false; + return nativeAccepted_.graph.roster.rememberLiveMix(id,gain,pan); + } + + // CONTROL snapshot: genuine stable ChannelIds from the SAME publisher + // as physical PCM. No guessed IDs, synthetic UI routes or JS DSP. + juce::var nativeBusStatus() const { + if(!channelIdPhysicalPcmActive() || !nativeAccepted_.fxOwners)return {}; + const auto* routing=nativePublisher_.acceptedRouting( + epoch(),nativeAccepted_.pcmRevision); + if(!routing)return {}; + auto state=std::make_unique(); + state->setProperty("graphRevision",juce::String( + std::to_string(nativeAccepted_.pcmRevision))); + state->setProperty("rosterRevision",juce::String( + std::to_string(routing->rosterRevision))); + state->setProperty("structural",nativeStructureLive_); + juce::Array allowed; + for(const char* op: {"NATIVE_CREATE_GROUP_SELECTED", + "NATIVE_CREATE_FX_RETURN_SELECTED", + "NATIVE_REMOVE_BUS","NATIVE_SET_BUS_MIX"}) + allowed.add(juce::var(juce::String(op))); + state->setProperty("supportedOps",juce::var(allowed)); + juce::Array rows; + for(const auto& ch:routing->channels) { + auto row=std::make_unique(); + row->setProperty("id",juce::String(std::to_string(ch.id.value))); + const char* role=ch.role==armix::mixer::ChannelRole::input?"INPUT": + ch.role==armix::mixer::ChannelRole::group?"GROUP": + ch.role==armix::mixer::ChannelRole::fxReturn?"FX_RETURN": + ch.role==armix::mixer::ChannelRole::main?"MAIN":"MONITOR"; + row->setProperty("role",role); + row->setProperty("name",juce::String(ch.name)); + row->setProperty("format",ch.format==armix::mixer::ProcessingFormat::stereo + ?"STEREO":"MONO"); + if(const auto* accepted=nativeAccepted_.graph.roster.find(ch.id)) { + row->setProperty("fader",static_cast(accepted->faderLinear)); + row->setProperty("pan",static_cast(accepted->pan)); + row->setProperty("mute",accepted->mute); + row->setProperty("solo",accepted->solo); + } + row->setProperty("primaryOutput", + juce::String(std::to_string(ch.primaryOutput.value))); + juce::Array sends; + for(const auto& send:ch.parallelSends) { + auto edge=std::make_unique(); + edge->setProperty("target",juce::String( + std::to_string(send.destination.value))); + edge->setProperty("preFader",send.preFader); + edge->setProperty("gain",static_cast(send.gain)); + edge->setProperty("pan",static_cast(send.pan)); + sends.add(juce::var(edge.release())); + } + row->setProperty("parallelSends",juce::var(sends)); + rows.add(juce::var(row.release())); + } + state->setProperty("channels",juce::var(rows)); + return juce::var(state.release()); + } + + void revokeChannelIdPcm() noexcept { channelIdPcmEpoch_.store(0,std::memory_order_release); + // A live Group/FX RETURN cannot be represented by the old M4 + // schedule. Do not silently send its sources straight to MAIN. + if(nativeStructureLive_) + topologyFault_.store(true,std::memory_order_release); + } + void rejectedNativeMirror() noexcept { + if(nativeStructureLive_) + topologyFault_.store(true,std::memory_order_release); + else channelIdPcmEpoch_.store(0,std::memory_order_release); } bool channelIdPhysicalPcmActive() const noexcept { const auto active=channelIdPcmEpoch_.load(std::memory_order_acquire); - return active!=0 && active==epoch() && ready(); + return active!=0 && active==epoch() && ready() && + !topologyFault_.load(std::memory_order_acquire); } void disable() noexcept { channelIdPcmEpoch_.store(0,std::memory_order_release); + nativeStructureLive_=false; nativePublisher_.unpublish(); // CONTROL-only; audio lease retires safely nativeAccepted_=armix::mixer::UnifiedLegacyAccepted{}; userPatched_.store(false,std::memory_order_release); @@ -1351,6 +1558,7 @@ class LiveDryRoutingLab final { out->setProperty("hasAcceptedRoute",hasExplicitRoute()); const bool nativePcm=channelIdPhysicalPcmActive(); out->setProperty("nativeChannelIdPcmActive",nativePcm); + if(nativePcm)out->setProperty("nativeBus",nativeBusStatus()); // This exact original vendor Graph owner is retained by the native // accepted snapshot, NOT merely a catalog name or M4 CH1 label. // Message-thread diagnostic only; no false universal capabilities. @@ -1481,6 +1689,7 @@ class LiveDryRoutingLab final { armix::mixer::DynamicNativeSessionPublisher nativePublisher_; armix::mixer::UnifiedLegacyAccepted nativeAccepted_; std::atomic channelIdPcmEpoch_{0}; + bool nativeStructureLive_=false; // CONTROL only; never read by callback std::atomic monitorPeakL_{0.f},monitorPeakR_{0.f}; armix::dsp::MasterOutputMonoPolicy masterMonoPolicy_; // audio thread only std::array channelEdits_{}; // JUCE message thread only diff --git a/src/Main.cpp b/src/Main.cpp index faccc68d2..1ef063311 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -234,7 +234,13 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr // GROUP/FX_RETURN remain rejected until one ChannelId // callback really owns them. const auto snapshot=armix::console::LiveConsoleBridgeV6::snapshot(engine_.status()); - const auto ack=consoleBridge_.processProductionIntent( + const auto op=args.getProperty("operation","").toString(); + juce::var ack; + if(op.startsWith("NATIVE_")) + ack=consoleBridge_.processNativeBusIntent( + args,snapshot,engine_, + nativeShowBusy_||studioBackupBusy_); + else ack=consoleBridge_.processProductionIntent( args,snapshot,engine_, [this](int lane,int slot,std::uint64_t epoch, std::uint64_t revision,const juce::String& token) diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index c251048d2..3a0297b36 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -88,6 +88,29 @@ test('occupied CH1 Orbit uses one strong Graph lease through native renderer and assert.equal(count(engine,/void audioDeviceIOCallbackWithContext\s*\(/g),1); }); +test('E3 stable ChannelId GROUP/FX RETURN is a real guarded physical PCM transaction',()=>{ + assert.match(physical,/NativeBusResult editNativeBus\(/); + assert.match(physical,/next\.createBusForSelected\(/); + assert.match(physical,/next\.removeBusAndRestoreSources\(/); + assert.match(physical,/DynamicChannelFxLeaseBank::reuseRevision\(/); + assert.match(physical,/nativePublisher_\.commit\(/); + assert.match(physical,/nativeAccepted_\.graph\.roster=std::move\(next\)/); + assert.match(physical,/if\(!published\.ok\(\)\)/); + assert.match(physical,/nativeStructureLive_=true/); + assert.match(physical,/topologyFault_\.store\(true,std::memory_order_release\)/); + assert.match(engine,/LiveDryRoutingLab::NativeBusResult editNativeBus\(/); + assert.match(engine,/if\(dryRoutingLab_\.nativeBusTopologyLive\(\)\)return false/); + assert.match(bridge,/juce::var processNativeBusIntent\(/); + assert.match(bridge,/nativeGraphRevision/); + assert.match(bridge,/NATIVE_CREATE_GROUP_SELECTED/); + assert.match(bridge,/NATIVE_CREATE_FX_RETURN_SELECTED/); + assert.match(bridge,/NATIVE_REMOVE_BUS/); + assert.match(host,/consoleBridge_\.processNativeBusIntent\(/); + assert.match(bridge,/w\.productionCallbackLive=false/); + assert.match(wire,/callbackOwnsChannelIds/); + assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); +}); + test('shipping application does not compile a second test-only native mixer',()=>{ const app=cmake.split(/\r?\n/).find(l=>l.startsWith('target_sources(ARMixConsole PRIVATE')); assert.ok(app,'native JUCE application source list missing'); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index d9af5997a..202512f2c 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -605,6 +605,81 @@ static void verifyOccupiedExternalCh1Owner() { 32,false,fallback)); assert(newL[31]==0.f&&newR[31]==0.f); assert(publisher.acceptedRevision()==1); + + // E3: the same physical publisher and original external VST owner + // survive a true serial GROUP then a parallel wet FX_RETURN. There is + // NO additional JUCE callback, source alias or vendor re-instantiation. + // A bounded prefix meter must not reject a graph > fixed 10CH+4AUX. + const auto publishBus=[&](ChannelRole role,const char* name, + float gain) { + auto candidate=accepted.graph.roster; + const ChannelId selected[]{accepted.graph.ids.inputs[0]}; + auto edit=candidate.createBusForSelected( + candidate.revision(),selected,name,role,gain); + assert(edit.ok()&&edit.createdIds.size()==1); + DynamicChannelFxLeaseBank nextBank; + const auto nextRevision=accepted.pcmRevision+1; + assert(DynamicChannelFxLeaseBank::reuseRevision( + epoch,nextRevision,*accepted.fxOwners,nextBank)== + DynamicChannelFxLeaseBank::Fault::none); + auto owner=std::make_shared( + std::move(nextBank)); + DynamicNativeSessionPublisher::FxPlan plan; + plan.owner=std::static_pointer_cast(owner); + plan.context=owner.get(); + plan.render=+[](void* ctx,ChannelId id,float* l,float* r,int n) noexcept { + (*static_cast(ctx))(id,l,r,n); + }; + plan.deviceEpoch=epoch;plan.graphRevision=nextRevision; + auto committed=publisher.commit( + candidate,accepted.graph.request,accepted.pcmRevision, + epoch,epoch,true,std::move(plan)); + assert(committed.ok()); + accepted.graph.roster=std::move(candidate); + accepted.fxOwners=std::move(owner); + accepted.pcmRevision=committed.revision; + publisher.pollRetirement(); // old VST Graph reclaimed on CONTROL + return edit.createdIds[0]; + }; + const auto group=publishBus(ChannelRole::group,"SERIAL GROUP",1.f); + const auto* groupView=publisher.acceptedRouting(epoch,2); + assert(groupView&&groupView->find(accepted.graph.ids.inputs[0]) + ->primaryOutput==group); + assert(groupView->find(group)->primaryOutput==accepted.graph.ids.main); + std::array meterL{},meterR{}; // fewer than total PCM lanes + const auto beforeGroup=heapCalls.load(std::memory_order_relaxed); + assert(publisher.render(epoch,pins,2,newL.data(),newR.data(),32, + false,fallback,nullptr,nullptr,meterL,meterR)); + assert(heapCalls.load(std::memory_order_relaxed)==beforeGroup); + assert(raw->calls==3); + for(int i=0;i<32;++i){ + assert(near(newL[i],oldL[i]));assert(near(newR[i],oldR[i])); + } + // Operator GROUP fader changes the LIVE ChannelId bus. Preserve its + // accepted target before the next graph publication (FX Return). + assert(publisher.setChannelMix(epoch,2,group,2.f,0.f)); + assert(accepted.graph.roster.rememberLiveMix(group,2.f,0.f)); + assert(!publisher.setChannelMix(epoch,1,group,.5f,0.f)); + const auto wet=publishBus(ChannelRole::fxReturn,"PARALLEL WET",.25f); + const auto* wetView=publisher.acceptedRouting(epoch,3); + assert(wetView&&wetView->find(wet)); + assert(wetView->find(accepted.graph.ids.inputs[0])->primaryOutput==group); + assert(wetView->find(accepted.graph.ids.inputs[0])->parallelSends.size()==1); + assert(wetView->find(accepted.graph.ids.inputs[0]) + ->parallelSends[0].destination==wet); + const auto beforeWet=heapCalls.load(std::memory_order_relaxed); + assert(publisher.render(epoch,pins,2,newL.data(),newR.data(),32, + false,fallback,nullptr,nullptr,meterL,meterR)); + assert(heapCalls.load(std::memory_order_relaxed)==beforeWet); + assert(raw->calls==4); // ONE original vendor process per graph pass + assert(std::abs(newL[31])>std::abs(oldL[31])); + assert(std::abs(newR[31])>std::abs(oldR[31])); + assert(publisher.acceptedRevision()==3); + // Stale or incompatible native topology must not advance the accepted + // graph; the existing audible GROUP + FX return remains intact. + const auto stale=publisher.commit(accepted.graph.roster, + accepted.graph.request,1,epoch,epoch,true); + assert(!stale.ok()&&publisher.acceptedRevision()==3); // Once no callback may hold the accepted PCM snapshot, there is no // hidden second FX owner. All vendor/plugin cleanup is off realtime. publisher.unpublish(); @@ -687,6 +762,19 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { route->setProperty("active",true); route->setProperty("ready",true); route->setProperty("hasAcceptedRoute",true); + // Exact native accepted publisher data, not an imagined v8 graph. + auto nativeBus=std::make_unique(); + nativeBus->setProperty("graphRevision","3"); + nativeBus->setProperty("rosterRevision","4"); + nativeBus->setProperty("structural",true); + juce::Array realBuses; + auto groupRow=std::make_unique(); + groupRow->setProperty("id","18"); + groupRow->setProperty("role","GROUP"); + groupRow->setProperty("primaryOutput","15"); + realBuses.add(juce::var(groupRow.release())); + nativeBus->setProperty("channels",juce::var(realBuses)); + route->setProperty("nativeBus",juce::var(nativeBus.release())); // These booleans are device-loop truth, NOT permission to promote // universal CH11, GROUP or WIRE operations in the GUI. route->setProperty("nativeChannelIdPcmActive",true); @@ -771,6 +859,13 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(diagnostic.getProperty("controlPlane","").toString()=="LEGACY_M4_ORDINAL"); assert(diagnostic.getProperty("pcmRenderer","").toString()=="CHANNEL_ID_10CH4AUX"); assert(static_cast(diagnostic.getProperty("originalCh1GraphLeased",false))); + const auto deliveredBus=diagnostic.getProperty("nativeBus",{}); + assert(deliveredBus.isObject()); + assert(deliveredBus.getProperty("graphRevision","").toString()=="3"); + assert(deliveredBus.getProperty("rosterRevision","").toString()=="4"); + const auto* deliveredChannels=deliveredBus.getProperty("channels",{}).getArray(); + assert(deliveredChannels&&deliveredChannels->size()==1); + assert(deliveredChannels->getReference(0).getProperty("id","").toString()=="18"); // A revoked native PCM mode must immediately report M4 fallback without // inventing any universal ChannelId capabilities or stale FX identity. auto pcmRouteReadback=live.getProperty("dryRoutingLab",{}); @@ -780,6 +875,7 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(fallbackM4.getProperty("pcmRenderer","").toString()=="M4_COMPAT"); assert(!static_cast(fallbackM4.getProperty("originalCh1GraphLeased",true))); assert(!static_cast(fallbackSnap.getProperty("productionCallbackLive",true))); + assert(fallbackM4.getProperty("nativeBus",{}).isVoid()); pcmRouteReadback.getDynamicObject()->setProperty("nativeChannelIdPcmActive",true); const auto legacyRows=diagnostic.getProperty("acceptedChannels",{}); assert(legacyRows.getArray()&& @@ -827,6 +923,85 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(!Bridge::decodeDecimal(juce::var("18446744073709551616"),decoded)); assert(!Bridge::decodeDecimal(juce::var("01"),decoded)); assert(!Bridge::decodeDecimal(juce::var(9007199254740993.0),decoded)); + // This adapter receives an actual operator WebView intent and returns + // a post-publication stable ChannelId+revisions, never graph revision 0 + // masquerading as the native PCM version. No device is required here: + // the transport test uses an injected native CONTROL writer; golden + // vendor PCM and lifetime were verified separately above. + struct BusControl { + struct Report { + bool accepted=false; + ChannelId created{}; + std::uint64_t pcmRevision=0,rosterRevision=0; + const char* error="NOT_ADMITTED"; + }; + int commits=0; + int liveMixes=0; + bool setNativeBusMix(std::uint64_t ep,std::uint64_t rev, + ChannelId id,float gain,float pan) { + assert(ep==9007199254740993ULL&&rev==3); + assert(id.value==18&&near(gain,.5f)&&near(pan,0.f)); + ++liveMixes;return true; + } + Report editNativeBus(std::uint64_t ep,std::uint64_t pcm, + std::uint64_t roster,ChannelRole role, + std::span selected, + const std::string& name,float gain,ChannelId remove) { + assert(ep==9007199254740993ULL); + assert(pcm==3 && roster==4); + assert(role==ChannelRole::group && remove.value==0); + assert(selected.size()==1 && selected[0].value==1); + assert(name=="VOCALS"&&near(gain,.25f)); + ++commits; + return {true,{19},4,5,""}; + } + } busControl; + const auto makeBusIntent=[&](const juce::String& req) { + auto command=std::make_unique(); + command->setProperty("requestId",req); + command->setProperty("deviceEpoch","9007199254740993"); + command->setProperty("legacyRoutingRevision","77"); + command->setProperty("nativeGraphRevision","3"); + command->setProperty("nativeRosterRevision","4"); + command->setProperty("operation","NATIVE_CREATE_GROUP_SELECTED"); + auto payload=std::make_unique(); + payload->setProperty("name","VOCALS"); + payload->setProperty("sendGain",.25); + juce::Array selection;selection.add("1"); + payload->setProperty("selectedChannelIds",juce::var(selection)); + command->setProperty("payload",juce::var(payload.release())); + return juce::var(command.release()); + }; + auto nativeAck=bridge.processNativeBusIntent( + makeBusIntent("native:bus:1"),snap,busControl); + assert(nativeAck.getProperty("status","").toString()=="ACCEPTED"); + assert(nativeAck.getProperty("graphRevision","").toString()=="0"); + assert(nativeAck.getProperty("nativeGraphRevision","").toString()=="4"); + assert(nativeAck.getProperty("nativeRosterRevision","").toString()=="5"); + assert(nativeAck.getProperty("createdChannelId","").toString()=="19"); + assert(busControl.commits==1); + nativeAck=bridge.processNativeBusIntent( + makeBusIntent("native:bus:1"),snap,busControl); + assert(nativeAck.getProperty("errorCode","").toString()=="DUPLICATE_REQUEST_ID"); + assert(busControl.commits==1); + auto staleBus=makeBusIntent("native:bus:2"); + staleBus.getDynamicObject()->setProperty("nativeGraphRevision","2"); + nativeAck=bridge.processNativeBusIntent(staleBus,snap,busControl); + assert(nativeAck.getProperty("status","").toString()=="REJECTED"); + assert(busControl.commits==1); + auto liveMixIntent=makeBusIntent("native:mix:1"); + liveMixIntent.getDynamicObject()->setProperty( + "operation","NATIVE_SET_BUS_MIX"); + liveMixIntent.getDynamicObject()->setProperty("targetChannelId","18"); + auto mixPayload=std::make_unique(); + mixPayload->setProperty("gain",.5); + mixPayload->setProperty("pan",0.0); + liveMixIntent.getDynamicObject()->setProperty( + "payload",juce::var(mixPayload.release())); + const auto mixAck=bridge.processNativeBusIntent( + liveMixIntent,snap,busControl); + assert(mixAck.getProperty("status","").toString()=="ACCEPTED"); + assert(busControl.liveMixes==1&&busControl.commits==1); // Fail-closed device fault: do not advertise a compatibility actuator // against a poisoned physical port topology or stale hardware session. auto liveRoute=live.getProperty("dryRoutingLab",{}); From 51e72d39b6757c8382362c9847a743780a6fb271 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Tue, 3 Nov 2026 20:32:57 +0700 Subject: [PATCH 086/155] fix(engine E3): reject legacy Show save/recall if real native BUS topology cannot be serialized Persist a control-only nativeBusStructural readback even through silent native DSP faults. Refuse both ShowV2 save and recall before file/vendor/route mutation whenever accepted ChannelId GROUP/FX RETURN buses exceed fixed 10CH+4AUX schema. Preserve prior snapshot on reject and add native Show regression. Correct E3 architecture gate to assert derived structural ownership instead of an obsolete hardcoded true flag. No fake disk persistence or universal UI capability. --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 4 ++++ src/LiveDryRoutingLab.h | 4 ++++ src/NativeDryShowRecall.h | 5 +++++ src/NativeLiveShowCapture.h | 5 +++++ tests/engine_runtime_reconciliation_test.mjs | 8 +++++++- tests/native_live_show_capture_test.cpp | 15 +++++++++++++++ 6 files changed, 40 insertions(+), 1 deletion(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index 7ee9854d8..a1ab5e212 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -123,3 +123,7 @@ Each bus commit creates a CONTROL-owned, revision-bound `DynamicChannelFxLeaseBa **Actual WebView intent seam (no fake universal promotion)**: `arMixConsoleIntent` dispatches `NATIVE_CREATE_GROUP_SELECTED`, `NATIVE_CREATE_FX_RETURN_SELECTED`, `NATIVE_REMOVE_BUS` and `NATIVE_SET_BUS_MIX` on the accepted `legacyM4.nativeBus` namespace, with decimal-string `deviceEpoch`, `legacyRoutingRevision`, `nativeGraphRevision`, `nativeRosterRevision` and an opaque `requestId`. Creation takes `payload.name`, `payload.selectedChannelIds` (native decimal-string ChannelIds from `legacyM4.nativeBus.channels`), and optional `payload.sendGain` default 0.25; removal takes `targetChannelId`; live bus gain takes `targetChannelId` and `payload.gain`/`payload.pan`. This channel routing readback and `supportedOps` is emitted **only** when the actual physical native PCM is admitted. The reply has `nativeGraphRevision`, `nativeRosterRevision` and `createdChannelId` only after a successful native transaction. The global schema v6 `productionCallbackLive=false` and universal `graph.capabilities.supportedOps=[]` are intentionally unchanged: full CH11/input creation, generic INSERT ownership, native disk Show roundtrip and polished approved GUI WIRE controls are still NOT supported. **Regression:** original JUCE vendor CH1 process is called once per render, with golden serial GROUP output equal to direct MAIN, then increased parallel FX Return output without losing GROUP primary OUT; no callback heap with a short 10+4 meter span despite extra lanes; stale revision NACK; stable VST instance retained until retirement; native v6 intent accepted + duplicate/stale rejects. All code builds and test results must be attached to the exact HEAD SHA. Physical ASIO/WASAPI 0FX/1FX FAT and crackle #15 remain NOT TESTED; this is not a stable release. + +### E3 ShowV2 graph-loss gate (source-level regression) + +ShowV2 has no extra GROUP/FX_RETURN ChannelId roles. The actual device readback now always includes `dryRoutingLab.nativeBusStructural`, including if the renderer has faulted silent, and both `NativeLiveShowCapture::captureDry` and `NativeDryShowRecall::prepare` reject before any vendor/file/device mutation when this is true. Source coverage and native Show regression assert no prior snapshot is modified by that rejection. **This is a release safety guard**, not a claim that persistent dynamic BUS Show save/restore is completed. The future Show schema upgrade must preserve arbitrary stable ChannelIds, source OUT and parallel sends as well as all vendor binary states before this gate can be lifted. diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 4146dd2da..cc733eb81 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1558,6 +1558,10 @@ class LiveDryRoutingLab final { out->setProperty("hasAcceptedRoute",hasExplicitRoute()); const bool nativePcm=channelIdPhysicalPcmActive(); out->setProperty("nativeChannelIdPcmActive",nativePcm); + // ShowV2 and the legacy M4 route cannot serialize extra ChannelId + // GROUP/FX RETURN buses. This stays visible even after DSP faults + // silent so SAVE/RECALL cannot silently discard audible topology. + out->setProperty("nativeBusStructural",nativeStructureLive_); if(nativePcm)out->setProperty("nativeBus",nativeBusStatus()); // This exact original vendor Graph owner is retained by the native // accepted snapshot, NOT merely a catalog name or M4 CH1 label. diff --git a/src/NativeDryShowRecall.h b/src/NativeDryShowRecall.h index ef26a631c..49f6339d6 100644 --- a/src/NativeDryShowRecall.h +++ b/src/NativeDryShowRecall.h @@ -41,6 +41,11 @@ class NativeDryShowRecall final { if(!borrowed.isInt() || static_cast(borrowed)!=0) return "Remove CH1 vendor FX before restoring a DRY-only Show"; const auto lab=status.getProperty("dryRoutingLab",{}); + // ShowV2 cannot represent a live extra ChannelId GROUP/FX RETURN. + // This check protects the saved state and currently accepted PCM + // before any hardware port or VST3 restore side effect. + if(static_cast(lab.getProperty("nativeBusStructural",false))) + return "Remove extra native GROUP/FX RETURN buses before Show RECALL"; if(!lab.isObject() || !lab.getProperty("ready",{}).isBool() || !static_cast(lab.getProperty("ready",{})) || diff --git a/src/NativeLiveShowCapture.h b/src/NativeLiveShowCapture.h index 40bc855be..2d766f817 100644 --- a/src/NativeLiveShowCapture.h +++ b/src/NativeLiveShowCapture.h @@ -49,6 +49,11 @@ class NativeLiveShowCapture final { return "CH1 FX Rack has VST3 state: cannot SAVE as a DRY-only Show"; const auto lab=nativeStatus.getProperty("dryRoutingLab",{}); if(!lab.isObject())return "Native Routing LAB has no published session"; + // The accepted ShowV2 contains only 10 fixed CH/4 AUX. Saving a + // live native GROUP/FX RETURN would discard real serial/parallel PCM. + // Reject even if topologyFault subsequently forced silent fallback. + if(static_cast(lab.getProperty("nativeBusStructural",false))) + return "Remove extra native GROUP/FX RETURN buses before Show SAVE"; bool active=false,ready=false; if(!flag(lab.getProperty("active",{}),active) || !flag(lab.getProperty("ready",{}),ready) || !active || !ready) diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index 3a0297b36..3f50e9761 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -16,6 +16,8 @@ const bridge=read('src/ConsoleLiveBridgeV6.h'); const wire=read('engine/core/ConsolePuzzleV8Wire.h'); const schema=JSON.parse(read('contracts/console-puzzle-v8.json')); const worker=read('src/NativeShowSaveWorker.h'); +const showCapture=read('src/NativeLiveShowCapture.h'); +const showRecall=read('src/NativeDryShowRecall.h'); const physical=read('src/LiveDryRoutingLab.h'); const dynamic=read('engine/core/DynamicNativeSessionPublisher.h'); const realtimePermit=read('engine/core/RealtimeRenderPermit.h'); @@ -96,7 +98,8 @@ test('E3 stable ChannelId GROUP/FX RETURN is a real guarded physical PCM transac assert.match(physical,/nativePublisher_\.commit\(/); assert.match(physical,/nativeAccepted_\.graph\.roster=std::move\(next\)/); assert.match(physical,/if\(!published\.ok\(\)\)/); - assert.match(physical,/nativeStructureLive_=true/); + assert.match(physical,/nativeStructureLive_=nativeAccepted_\.graph\.roster\.size\(\)/); + assert.match(physical,/nativeAccepted_\.hardware\.monitorEnabled/); assert.match(physical,/topologyFault_\.store\(true,std::memory_order_release\)/); assert.match(engine,/LiveDryRoutingLab::NativeBusResult editNativeBus\(/); assert.match(engine,/if\(dryRoutingLab_\.nativeBusTopologyLive\(\)\)return false/); @@ -108,6 +111,9 @@ test('E3 stable ChannelId GROUP/FX RETURN is a real guarded physical PCM transac assert.match(host,/consoleBridge_\.processNativeBusIntent\(/); assert.match(bridge,/w\.productionCallbackLive=false/); assert.match(wire,/callbackOwnsChannelIds/); + assert.match(physical,/nativeBusStructural/); + assert.match(showCapture,/nativeBusStructural/); + assert.match(showRecall,/nativeBusStructural/); assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); }); diff --git a/tests/native_live_show_capture_test.cpp b/tests/native_live_show_capture_test.cpp index 734e7f625..7e2a250f4 100644 --- a/tests/native_live_show_capture_test.cpp +++ b/tests/native_live_show_capture_test.cpp @@ -104,6 +104,21 @@ int main() { // Never let untrusted or stale UI state replace an accepted capture. const auto prior=Codec::encode(captured); + // Dynamic native GROUP/FX RETURN exists in actual PCM but ShowV2 has + // no such role. Refuse both SAVE and RECALL before mutating either + // accepted routing, file generation or vendor plugin state. + auto withNativeBus=setup(); + auto nativeLab=withNativeBus.getProperty("dryRoutingLab",{}); + set(nativeLab,"nativeBusStructural",true); + const auto busSave=NativeLiveShowCapture::captureDry( + withNativeBus,"Native Bus Show",captured,true); + assert(busSave.contains("GROUP/FX RETURN")); + assert(Codec::encode(captured)==prior); + juce::var rejectedBusRecall; + const auto busRecall=NativeDryShowRecall::prepare( + decoded,withNativeBus,rejectedBusRecall,true); + assert(busRecall.contains("GROUP/FX RETURN")); + assert(rejectedBusRecall.isVoid()); auto armed=setup();set(armed,"monitor",true); assert(NativeLiveShowCapture::captureDry(armed,"Dry Routing Test",captured).isNotEmpty()); assert(Codec::encode(captured)==prior); From 7a6a8a433e280b8b6c5ca17d9d129e61a531bf31 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 01:02:41 +0700 Subject: [PATCH 087/155] feat(engine E4): wire real ChannelId GROUP and wet FX RETURN controls into native ROUTING UI Use existing AUX/BUSSING panel and installed JUCE arMixConsoleSnapshot/Intent/Ack protocol. Display admitted stable INPUT and BUS ChannelIds only from verified legacyM4.nativeBus PCM readback, never a fabricated universal graph. Create real serial GROUP / parallel wet FX RETURN, remove BUS, and update real BUS gain/PAN. Gate on hardware device epoch, native graph/roster revision, accepted native operation and all physical/secondary output safety controls. Keep one pending control transaction until exact matching ACK and strictly later authoritative PCM snapshot. Reject stale rollback, invalid IDs, missing capability and concurrent routing drafts; no WebAudio DSP or CSS restyle. Add architecture verification and handoff. --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 8 + tests/engine_runtime_reconciliation_test.mjs | 33 +++ web/monitor.js | 256 +++++++++++++++++- 3 files changed, 295 insertions(+), 2 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index a1ab5e212..253d330a4 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -127,3 +127,11 @@ Each bus commit creates a CONTROL-owned, revision-bound `DynamicChannelFxLeaseBa ### E3 ShowV2 graph-loss gate (source-level regression) ShowV2 has no extra GROUP/FX_RETURN ChannelId roles. The actual device readback now always includes `dryRoutingLab.nativeBusStructural`, including if the renderer has faulted silent, and both `NativeLiveShowCapture::captureDry` and `NativeDryShowRecall::prepare` reject before any vendor/file/device mutation when this is true. Source coverage and native Show regression assert no prior snapshot is modified by that rejection. **This is a release safety guard**, not a claim that persistent dynamic BUS Show save/restore is completed. The future Show schema upgrade must preserve arbitrary stable ChannelIds, source OUT and parallel sends as well as all vendor binary states before this gate can be lifted. + +## E4 operator-first integration — LIVE GROUP / FX RETURN inside existing ROUTING workspace + +The existing `web/monitor.js` ROUTING → AUX/BUSSING panel now contains an **actual native ChannelId bus operator**, not an M4 ten-strip simulation and not universal v8 capability promotion. It subscribes to the same installed JUCE WebView `arMixConsoleSnapshot` producer already used by the v6 bridge, and only becomes editable if the **true `legacyM4.nativeBus`** has a canonical string device epoch, routing revision, native graph/roster revision, original PCM renderer `CHANNEL_ID_10CH4AUX`, `LEGACY_M4_ORDINAL` authority and valid unique stable ChannelIds. It does not forge `graph.channels` or `productionCallbackLive=true`. Actual INPUT ChannelIds are selectable in the integrated ROUTING tab, with **+ GROUP** serial primary routing and **+ FX RETURN** parallel wet send, no 10CH limitation. Accepted GROUP/FX RETURN rows provide scoped actual gain/pan and safe removal. + +The operator uses the E3 native `arMixConsoleIntent` contract: unique nonce-bearing requestId; decimal-string `deviceEpoch`, `legacyRoutingRevision`, `nativeGraphRevision`, `nativeRosterRevision`; canonical `targetChannelId` or exact selected ChannelIds; bounded 1–64 sources, source role `INPUT`, name ≤64, gain 0..4, pan -1..1. These controls are **fail closed** while any M4 draft/pending APPLY exists, physical/secondary output is armed, native graph is not accepted, an intent is already pending or the requested native supported operation is absent. No JS PCM is run. Every native ACK is matched to the exact pending opaque request and device epoch; an ACCEPTED intent remains pending until a strictly subsequent native PCM snapshot verifies nondecreasing returned native graph/roster revision. Device changes invalidate pending and selection; same-device stale graph snapshot regression is rejected. UI code is only DOM presentation in the existing UI/monitor controller and uses existing CSS primitives; no extra stylesheet or visual restyle. + +**Acceptance:** JS architecture tests enforce real accepted native provenance, safety gates, exact requested/returned stable ChannelIds, native ACK/newer snapshot requirements, scoped ops, no manufactured universal capability. Windows exact-SHA native 54-suite CTest + Chromium smoke must pass before promotion. Actual physical ASIO 0FX/1FX, native bus audible verification and durable native Show V2 GROUP/CH1 storage remain not tested/unsupported; E4 is not stable release certification. diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index 3f50e9761..2bfd36dbf 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -117,6 +117,39 @@ test('E3 stable ChannelId GROUP/FX RETURN is a real guarded physical PCM transac assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); }); + +test('E4 installed PATCH operator uses native ChannelId BUS ACK and real PCM snapshot, never ten-strip draft',()=>{ + const ui=read('web/monitor.js'); + const binding=ui.slice(ui.indexOf('// E4: The EXISTING routing workspace controls'), + ui.indexOf('// Processing channel width is independent')); + assert.ok(binding.length>3000,'real native Group/FX operator binding absent'); + assert.match(binding,/const nativeBusAccepted=\(\)=>/); + assert.match(binding,/legacy\?\.controlPlane!=='LEGACY_M4_ORDINAL'/); + assert.match(binding,/legacy\?\.pcmRenderer!=='CHANNEL_ID_10CH4AUX'/); + assert.match(binding,/busWireDecimal\(c\.id\)===null/); + assert.match(binding,/bus\.supportedOps\.includes\(op\)/); + assert.match(binding,/state\.secondaryOutputArmed/); + assert.match(binding,/state\.monitor/); + assert.match(binding,/!mixerDraftActive/); + assert.match(binding,/targetChannelId:targetChannelId\|\|null,payload/); + assert.match(binding,/selectedChannelIds:ids,sendGain:gain/); + assert.match(binding,/api\.emitEvent\('arMixConsoleIntent',command\)/); + assert.match(binding,/api\.addEventListener\('arMixConsoleAck'/); + assert.match(binding,/api\.addEventListener\('arMixConsoleSnapshot'/); + assert.match(binding,/busSnapshotSerial>busPending\.ackSnapshotSerial/); + assert.match(binding,/BigInt\(info\.bus\.graphRevision\)>=BigInt\(ack\.nativeGraphRevision\)/); + assert.match(binding,/BigInt\(info\.bus\.rosterRevision\)>=BigInt\(ack\.nativeRosterRevision\)/); + assert.match(binding,/NATIVE_CREATE_GROUP_SELECTED/); + assert.match(binding,/NATIVE_CREATE_FX_RETURN_SELECTED/); + assert.match(binding,/NATIVE_REMOVE_BUS/); + assert.match(binding,/NATIVE_SET_BUS_MIX/); + assert.doesNotMatch(binding,/productionCallbackLive\s*=\s*true|createAudioContext|AudioContext\(/, + 'operator MUST NOT fabricate universal capabilities or DSP'); + assert.match(ui,/busRequest\(\);renderNativeBus\(true\)/); + assert.match(bridge,/processNativeBusIntent/); + assert.match(physical,/nativeBusStatus\(\)/); +}); + test('shipping application does not compile a second test-only native mixer',()=>{ const app=cmake.split(/\r?\n/).find(l=>l.startsWith('target_sources(ARMixConsole PRIVATE')); assert.ok(app,'native JUCE application source list missing'); diff --git a/web/monitor.js b/web/monitor.js index 1831c53d7..25aa17ed5 100644 --- a/web/monitor.js +++ b/web/monitor.js @@ -267,6 +267,254 @@ '' + '
Select actual input ports, then APPLY while output is muted.
'; document.body.appendChild(routeOverlay); + // E4: The EXISTING routing workspace controls the actual E3 ChannelId + // publisher. No simulated audio, no duplicate GUI graph, and no universal + // v8 promotion. This panel reads ONLY legacyM4.nativeBus accepted PCM. + const realBusPanel=document.createElement('section'); + realBusPanel.id='arNativeBusOperator'; + realBusPanel.setAttribute('aria-label','Accepted native Group and FX Return'); + const nativeBusHeading=document.createElement('div'); + nativeBusHeading.className='arPatchHeading'; + const nativeBusTitle=document.createElement('strong'); + nativeBusTitle.textContent='NATIVE GROUP / FX RETURN · ACTUAL PCM'; + const nativeBusHelp=document.createElement('small'); + nativeBusHelp.textContent='Select real ChannelIds. GROUP = serial routing; FX RETURN = parallel wet send. Output must be disarmed for topology edits.'; + nativeBusHeading.append(nativeBusTitle,nativeBusHelp); + const nativeBusState=document.createElement('p'); + nativeBusState.id='arNativeBusState'; + nativeBusState.setAttribute('role','status'); + nativeBusState.textContent='READING ACCEPTED NATIVE BUS GRAPH'; + const nativeBusSources=document.createElement('div'); + nativeBusSources.id='arNativeBusSources'; + nativeBusSources.setAttribute('role','group'); + nativeBusSources.setAttribute('aria-label','Real source channels for native BUS'); + const nativeBusActions=document.createElement('div'); + nativeBusActions.className='arBusActions'; + const nativeBusName=document.createElement('input'); + nativeBusName.type='text';nativeBusName.maxLength=64; + nativeBusName.placeholder='Bus name';nativeBusName.setAttribute('aria-label','Native BUS name'); + const nativeBusGain=document.createElement('input'); + nativeBusGain.type='number';nativeBusGain.min='0';nativeBusGain.max='4'; + nativeBusGain.step='.05';nativeBusGain.value='.25'; + nativeBusGain.setAttribute('aria-label','FX wet send gain (linear)'); + const groupCreate=document.createElement('button'); + groupCreate.type='button';groupCreate.className='btn-180';groupCreate.textContent='+ GROUP'; + const fxReturnCreate=document.createElement('button'); + fxReturnCreate.type='button';fxReturnCreate.className='btn-180'; + fxReturnCreate.textContent='+ FX RETURN'; + nativeBusActions.append(nativeBusName,nativeBusGain,groupCreate,fxReturnCreate); + const nativeBusRows=document.createElement('div');nativeBusRows.id='arNativeBusRows'; + realBusPanel.append(nativeBusHeading,nativeBusState,nativeBusSources, + nativeBusActions,nativeBusRows); + document.getElementById('arBusCapability')?.insertAdjacentElement('afterend',realBusPanel); + + const busWireDecimal=s=>typeof s==='string'&&/^[1-9][0-9]*$/.test(s)&& + BigInt(s)<=18446744073709551615n?s:null; + const busSelection=new Set(); + let busSnapshot=null,busPending=null,busSignature='',busSession='',busSequence=0; + let busSnapshotSerial=0; + const busInstance=(()=>{ + const data=new Uint8Array(12); + try{window.crypto.getRandomValues(data); + return 'native-bus-'+Array.from(data,x=>x.toString(16).padStart(2,'0')).join(''); + }catch{return 'native-bus-'+Date.now().toString(36)+'-'+Math.random().toString(36).slice(2);} + })(); + const nativeBusAccepted=()=>{ + const snap=busSnapshot,legacy=snap?.legacyM4,bus=legacy?.nativeBus; + if(!snap||snap.schemaVersion!==6||snap.productionCallbackLive!==false|| + legacy?.controlPlane!=='LEGACY_M4_ORDINAL'|| + legacy?.pcmRenderer!=='CHANNEL_ID_10CH4AUX'|| + !bus||!Array.isArray(bus.channels)|| + !Array.isArray(bus.supportedOps)|| + busWireDecimal(snap.device?.epoch)===null|| + busWireDecimal(legacy.routingRevision)===null|| + busWireDecimal(bus.graphRevision)===null|| + busWireDecimal(bus.rosterRevision)===null)return null; + const ids=new Set(); + for(const c of bus.channels){ + if(!c||busWireDecimal(c.id)===null||ids.has(c.id)|| + !['INPUT','GROUP','FX_RETURN','MAIN','MONITOR'].includes(c.role)) + return null; + ids.add(c.id); + } + if(!bus.channels.some(c=>c.role==='MAIN'))return null; + return {snap,legacy,bus}; + }; + const busMayEdit=(op,structural=false)=>{ + const s=nativeBusAccepted(); + return !!s&&!busPending&&s.bus.supportedOps.includes(op)&& + (!structural||(!s.snap.device.outputArmed&&!state.monitor&& + !state.secondaryOutputArmed&&!patchPending&&!mixerDraftActive)); + }; + const busNotice=message=>{nativeBusState.textContent=message;}; + const busRequest=()=>{ + api.emitEvent('arMixConsoleSubscribe',{protocol:'v6',requester:busInstance}); + }; + function renderNativeBus(force=false){ + const accepted=nativeBusAccepted(),bus=accepted?.bus; + const signature=accepted?JSON.stringify([ + accepted.snap.device.epoch,accepted.legacy.routingRevision, + bus.graphRevision,bus.rosterRevision,bus.channels, + accepted.snap.device.outputArmed,state.monitor,state.secondaryOutputArmed, + !!busPending]):'UNREADY'; + if(!force&&signature===busSignature)return; + busSignature=signature; + const ready=!!accepted,structural=busMayEdit('NATIVE_CREATE_GROUP_SELECTED',true); + groupCreate.disabled=!structural; + fxReturnCreate.disabled=!busMayEdit('NATIVE_CREATE_FX_RETURN_SELECTED',true); + nativeBusName.disabled=!ready||!!busPending; + nativeBusGain.disabled=!ready||!!busPending; + const oldSelected=new Set(busSelection); + const sources=ready?bus.channels.filter(ch=>ch.role==='INPUT'):[]; + busSelection.clear();nativeBusSources.replaceChildren(); + for(const ch of sources){ + const label=document.createElement('label'); + const checkbox=document.createElement('input'); + checkbox.type='checkbox';checkbox.value=ch.id; + checkbox.checked=oldSelected.has(ch.id); + checkbox.disabled=!!busPending; + if(checkbox.checked)busSelection.add(ch.id); + checkbox.addEventListener('change',()=>{ + if(checkbox.checked)busSelection.add(ch.id); + else busSelection.delete(ch.id); + nativeBusState.textContent=busSelection.size+' SOURCE SELECTED · accepted ChannelIds only'; + }); + label.append(checkbox,document.createTextNode(' '+String(ch.name||ch.id))); + nativeBusSources.append(label); + } + nativeBusRows.replaceChildren(); + for(const ch of ready?bus.channels.filter(x=>x.role==='GROUP'||x.role==='FX_RETURN'):[]){ + const line=document.createElement('div'); + line.className='arBusActions'; + const name=document.createElement('span'); + name.textContent=ch.role.replace('_',' ')+' · '+String(ch.name||ch.id); + const gain=document.createElement('input'); + gain.type='number';gain.min='0';gain.max='4';gain.step='.05'; + gain.value=String(ch.fader); + gain.setAttribute('aria-label',String(ch.name||ch.id)+' native linear gain'); + const pan=document.createElement('input'); + pan.type='number';pan.min='-1';pan.max='1';pan.step='.05'; + pan.value=String(ch.pan); + pan.setAttribute('aria-label',String(ch.name||ch.id)+' native pan'); + const remove=document.createElement('button'); + remove.type='button';remove.className='btn-180';remove.textContent='REMOVE'; + const mixReady=busMayEdit('NATIVE_SET_BUS_MIX'); + gain.disabled=!mixReady;pan.disabled=!mixReady; + remove.disabled=!busMayEdit('NATIVE_REMOVE_BUS',true); + const submitMix=()=>{ + const g=Number(gain.value),p=Number(pan.value); + if(!Number.isFinite(g)||g<0||g>4||!Number.isFinite(p)||p< -1||p>1){ + busNotice('REJECTED · Gain 0–4, pan -1–1');return; + } + sendNativeBus('NATIVE_SET_BUS_MIX',ch.id,{gain:g,pan:p}); + }; + gain.addEventListener('change',submitMix); + pan.addEventListener('change',submitMix); + remove.addEventListener('click',()=>{ + sendNativeBus('NATIVE_REMOVE_BUS',ch.id,{}); + }); + line.append(name,gain,pan,remove);nativeBusRows.append(line); + } + if(!ready)busNotice('UNAVAILABLE · Native ChannelId PCM has not admitted a verified BUS graph'); + else if(!busPending)busNotice( + 'NATIVE PCM ACCEPTED · '+bus.graphRevision+ + ' · '+(state.monitor||state.secondaryOutputArmed||accepted.snap.device.outputArmed + ?'DISARM OUTPUT TO EDIT STRUCTURE':'READY FOR STRUCTURAL EDIT')); + } + function sendNativeBus(operation,targetChannelId,payload){ + const structural=operation!=='NATIVE_SET_BUS_MIX'; + if(!busMayEdit(operation,structural)){busNotice('REJECTED · Native authority or output safety gate');return false;} + const admitted=nativeBusAccepted(); + if(!admitted)return false; + const requestId=busInstance+':'+(++busSequence); + const command={ + requestId,operation, + deviceEpoch:admitted.snap.device.epoch, + legacyRoutingRevision:admitted.legacy.routingRevision, + nativeGraphRevision:admitted.bus.graphRevision, + nativeRosterRevision:admitted.bus.rosterRevision, + targetChannelId:targetChannelId||null,payload + }; + busPending={requestId,operation,epoch:command.deviceEpoch, + graphRevision:command.nativeGraphRevision, + rosterRevision:command.nativeRosterRevision,ack:null}; + busNotice('PENDING · '+operation+' · awaiting native accepted ACK'); + renderNativeBus(true); + api.emitEvent('arMixConsoleIntent',command); + return true; + } + function createNativeBus(kind){ + if(!busMayEdit(kind,true))return; + const name=nativeBusName.value.trim(),ids=[...busSelection]; + const gain=Number(nativeBusGain.value); + if(!name||name.length>64||!ids.length||ids.length>64|| + !Number.isFinite(gain)||gain<0||gain>4){ + busNotice('REJECTED · Select 1–64 actual input channels, a name and gain 0–4');return; + } + if(sendNativeBus(kind,null,{name,selectedChannelIds:ids,sendGain:gain})) + nativeBusName.value=''; + } + groupCreate.addEventListener('click',()=>createNativeBus('NATIVE_CREATE_GROUP_SELECTED')); + fxReturnCreate.addEventListener('click',()=>createNativeBus('NATIVE_CREATE_FX_RETURN_SELECTED')); + api.addEventListener('arMixConsoleSnapshot',message=>{ + const snap=message?.snapshot||message; + if(!snap||snap.schemaVersion!==6)return; + const nextEpoch=busWireDecimal(snap.device?.epoch); + if(nextEpoch===null)return; + if(busSession&&busSession!==nextEpoch){ + busPending=null;busSelection.clear();busSignature=''; + } + // Ignore stale same-device native BUS snapshots. Revision is the real + // publisher revision, not the universal graph's intentionally gated 0. + const previous=nativeBusAccepted(); + const incoming=snap?.legacyM4?.nativeBus; + if(previous&&busSession===nextEpoch&&incoming&& + busWireDecimal(incoming.graphRevision)!==null&& + BigInt(incoming.graphRevision)busPending.ackSnapshotSerial&& + info.snap.device.epoch===busPending.epoch&& + BigInt(info.bus.graphRevision)>=BigInt(ack.nativeGraphRevision)&& + BigInt(info.bus.rosterRevision)>=BigInt(ack.nativeRosterRevision)){ + const operation=busPending.operation||'NATIVE BUS'; + busPending=null;busSignature=''; + busNotice('ACCEPTED · '+operation+' · exact native graph + roster confirmed'); + } + } + if(routeOverlay.classList.contains('open'))renderNativeBus(); + }); + api.addEventListener('arMixConsoleAck',message=>{ + const ack=message?.ack||message; + if(!busPending||ack?.requestId!==busPending.requestId)return; + if(ack.deviceEpoch!==busPending.epoch|| + !['ACCEPTED','REJECTED'].includes(ack.status)){ + busPending=null;busSignature=''; + busNotice('INVALID NATIVE ACK · previous accepted route preserved'); + renderNativeBus(true);return; + } + if(ack.status==='REJECTED'){ + busPending=null;busSignature=''; + busNotice('REJECTED · '+String(ack.errorCode||'Native BUS unchanged')); + renderNativeBus(true);busRequest();return; + } + if(busWireDecimal(ack.nativeGraphRevision)===null|| + busWireDecimal(ack.nativeRosterRevision)===null|| + BigInt(ack.nativeGraphRevision){if(!busSnapshot)busRequest();}); // Processing channel width is independent of the hardware source mode. // The native graph is still the sole audio source of truth; these are DRAFTS. const legacyFormat=mode=>mode==="STEREO"||mode==="BUS"?"STEREO":"MONO"; @@ -632,8 +880,12 @@ .classList.toggle("arPatchHidden",section!==tab); } if(tab==="input")renderPatchMatrix(); - else if(tab==="internal")drawRoutes(); - else renderPatchOutput(); + else if(tab==="internal"){ + drawRoutes(); + // Refresh authoritative native bus graph on every BUS tab visit; + // never infer one from a ten-strip draft or an unready fixture. + busRequest();renderNativeBus(true); + }else renderPatchOutput(); } function patchFeedback(message){ document.getElementById("arRouteFeedback").textContent=message; From 45b92899110e45312565f393b5444e7d0efdb9ad Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 01:05:46 +0700 Subject: [PATCH 088/155] test(engine E4): execute real ROUTING native BUS UI under fake JUCE event backend Exercise actual operator control source in isolated DOM with native ChannelId snapshot fixtures: GROUP selected source wire, coherent device/native graph/roster revisions, nonoptimistic ACK and strictly newer accepted snapshot, duplicate pending prevention, FX RETURN create and native rejection recovery, illegal M4 PCM fallback and armed output fail-close. No production code or visual CSS change. --- tests/engine_runtime_reconciliation_test.mjs | 104 +++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index 2bfd36dbf..e5d7caa72 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -4,6 +4,7 @@ // When ChannelId cutover is actually approved, this gate MUST change in // the same exact-SHA integration commit as the JUCE callback and native ACK. import test from 'node:test'; +import vm from 'node:vm'; import assert from 'node:assert/strict'; import {readFileSync} from 'node:fs'; @@ -150,6 +151,109 @@ test('E4 installed PATCH operator uses native ChannelId BUS ACK and real PCM sna assert.match(physical,/nativeBusStatus\(\)/); }); + +test('E4 operator native Group+FX Return controls run through real ACK then newer accepted PCM snapshot',()=>{ + const ui=read('web/monitor.js'); + const start=ui.indexOf('// E4: The EXISTING routing workspace controls'); + const end=ui.indexOf('// Processing channel width is independent',start); + assert.ok(start>0&&end>start,'E4 actual route controller must exist'); + class Node { + constructor(tag){this.tag=tag;this.children=[];this.listeners={}; + this.value='';this.disabled=false;this.checked=false;this.textContent=''; + this.className='';this.id='';this.attrs={};} + setAttribute(name,value){this.attrs[name]=value;} + append(...children){this.children.push(...children);} + replaceChildren(...children){this.children=[...children];} + addEventListener(name,fn){this.listeners[name]=fn;} + insertAdjacentElement(_,child){this.children.push(child);} + } + const root=new Node('section'),sent=[],events={}; + const doc={createElement:tag=>new Node(tag), + createTextNode:text=>({textContent:text}), + getElementById:id=>id==='arBusCapability'?root:null}; + const api={emitEvent:(name,payload)=>sent.push({name,payload}), + addEventListener:(name,fn)=>events[name]=fn}; + const ctx=vm.createContext({ + document:doc,api,window:{crypto:{getRandomValues:n=>n.fill(7)}}, + routeOverlay:{classList:{contains:()=>true}}, + state:{monitor:false,secondaryOutputArmed:false}, + patchPending:false,mixerDraftActive:false + }); + vm.runInContext(ui.slice(start,end),ctx,{timeout:1000}); + const snap=(revision='10',roster='3',epoch='12',armed=false)=>({ + schemaVersion:6,productionCallbackLive:false, + device:{epoch,outputArmed:armed}, + legacyM4:{controlPlane:'LEGACY_M4_ORDINAL', + pcmRenderer:'CHANNEL_ID_10CH4AUX',routingRevision:'7', + nativeBus:{graphRevision:revision,rosterRevision:roster, + supportedOps:['NATIVE_CREATE_GROUP_SELECTED', + 'NATIVE_CREATE_FX_RETURN_SELECTED','NATIVE_SET_BUS_MIX', + 'NATIVE_REMOVE_BUS'], + channels:[{id:'1',role:'INPUT',name:'Microphone'}, + {id:'2',role:'INPUT',name:'Music'}, + {id:'3',role:'MAIN',name:'MAIN'}]}} + }); + events.arMixConsoleSnapshot(snap()); + const probe=code=>vm.runInContext(code,ctx,{timeout:1000}); + assert.equal(probe('groupCreate.disabled'),false); + assert.equal(probe('nativeBusSources.children.length'),2); + probe("nativeBusSources.children[0].children[0].checked=true"); + probe("nativeBusSources.children[0].children[0].listeners.change()"); + probe("nativeBusName.value='Vocal Group';nativeBusGain.value='.6';groupCreate.listeners.click()"); + const commands=()=>sent.filter(x=>x.name==='arMixConsoleIntent'); + assert.equal(commands().length,1); + const one=commands()[0].payload; + assert.equal(one.operation,'NATIVE_CREATE_GROUP_SELECTED'); + assert.deepEqual(Array.from(one.payload.selectedChannelIds),['1']); + assert.equal(one.deviceEpoch,'12'); + assert.equal(one.legacyRoutingRevision,'7'); + assert.equal(one.nativeGraphRevision,'10'); + assert.equal(one.nativeRosterRevision,'3'); + assert.equal(one.payload.sendGain,.6); + assert.equal(probe('groupCreate.disabled'),true); + probe('groupCreate.listeners.click()'); + assert.equal(commands().length,1,'pending request must block duplicate AUDIO graph commit'); + // Engine ACK only proves acceptance. The UI stays locked until a + // strictly newer accepted PCM publisher snapshot supplies real revisions. + events.arMixConsoleAck({ + requestId:one.requestId,status:'ACCEPTED',deviceEpoch:'12', + nativeGraphRevision:'11',nativeRosterRevision:'4',errorCode:'' + }); + assert.equal(probe('groupCreate.disabled'),true); + events.arMixConsoleSnapshot(snap('10','3')); + assert.equal(probe('groupCreate.disabled'),true); + const updated=snap('11','4'); + updated.legacyM4.nativeBus.channels.splice(2,0,{ + id:'20',role:'GROUP',name:'Vocal Group',fader:1,pan:0}); + events.arMixConsoleSnapshot(updated); + assert.equal(probe('groupCreate.disabled'),false); + assert.equal(probe('nativeBusRows.children.length'),1); + // Browser cannot forge a BUS by sending the universal graph capability: + // authoritative namespace must be ChannelId PCM actually installed. + const bogus=snap('12','5');bogus.legacyM4.pcmRenderer='M4_COMPAT'; + events.arMixConsoleSnapshot(bogus); + assert.equal(probe('groupCreate.disabled'),true); + probe("fxReturnCreate.listeners.click()"); + assert.equal(commands().length,1,'no synthetic native BUS without production PCM'); + events.arMixConsoleSnapshot(updated); + probe("nativeBusSources.children[0].children[0].checked=true"); + probe("nativeBusSources.children[0].children[0].listeners.change()"); + probe("nativeBusName.value='Vocal Wet';fxReturnCreate.listeners.click()"); + assert.equal(commands().length,2); + assert.equal(commands()[1].payload.operation,'NATIVE_CREATE_FX_RETURN_SELECTED'); + events.arMixConsoleAck({ + requestId:commands()[1].payload.requestId,status:'REJECTED', + deviceEpoch:'12',errorCode:'NATIVE_REJECTED' + }); + assert.equal(probe('groupCreate.disabled'),false, + 'rejected native intent should unlock controls while keeping old PCM unchanged'); + const armed=snap('11','4','12',true); + events.arMixConsoleSnapshot(armed); + assert.equal(probe('groupCreate.disabled'),true,'output armed structural edits fail closed'); + probe("groupCreate.listeners.click()"); + assert.equal(commands().length,2); +}); + test('shipping application does not compile a second test-only native mixer',()=>{ const app=cmake.split(/\r?\n/).find(l=>l.startsWith('target_sources(ARMixConsole PRIVATE')); assert.ok(app,'native JUCE application source list missing'); From f8f69e02e4b7edad4dc031e2dc31e16291a0e3ca Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 01:11:38 +0700 Subject: [PATCH 089/155] fix(engine E4): correct live BUS capability honesty, stale device epoch and rejected ACK visibility ROUTING now reports real native GROUP/FXReturn accepted PCM instead of claiming AUDIO GROUP is always unsupported. DCA/MATRIX/CUE remain gated. Bound native uint64 input strings before BigInt, ignore late stale device generation snapshots, and preserve original error NACK through control redraw. Strengthen actual JS operator execution test for source status, native revision and stale-epoch protection; keep one native callback and approved CSS untouched. --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 4 +++ tests/engine_runtime_reconciliation_test.mjs | 9 +++++-- web/monitor.js | 26 ++++++++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index 253d330a4..88981843b 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -135,3 +135,7 @@ The existing `web/monitor.js` ROUTING → AUX/BUSSING panel now contains an **ac The operator uses the E3 native `arMixConsoleIntent` contract: unique nonce-bearing requestId; decimal-string `deviceEpoch`, `legacyRoutingRevision`, `nativeGraphRevision`, `nativeRosterRevision`; canonical `targetChannelId` or exact selected ChannelIds; bounded 1–64 sources, source role `INPUT`, name ≤64, gain 0..4, pan -1..1. These controls are **fail closed** while any M4 draft/pending APPLY exists, physical/secondary output is armed, native graph is not accepted, an intent is already pending or the requested native supported operation is absent. No JS PCM is run. Every native ACK is matched to the exact pending opaque request and device epoch; an ACCEPTED intent remains pending until a strictly subsequent native PCM snapshot verifies nondecreasing returned native graph/roster revision. Device changes invalidate pending and selection; same-device stale graph snapshot regression is rejected. UI code is only DOM presentation in the existing UI/monitor controller and uses existing CSS primitives; no extra stylesheet or visual restyle. **Acceptance:** JS architecture tests enforce real accepted native provenance, safety gates, exact requested/returned stable ChannelIds, native ACK/newer snapshot requirements, scoped ops, no manufactured universal capability. Windows exact-SHA native 54-suite CTest + Chromium smoke must pass before promotion. Actual physical ASIO 0FX/1FX, native bus audible verification and durable native Show V2 GROUP/CH1 storage remain not tested/unsupported; E4 is not stable release certification. + +### E4 release-grade operator safety/readback follow-up + +The existing `data-bus-cap=missing` label no longer permanently claims AUDIO GROUP is unimplemented after a real E3 native GROUP has been admitted. It now distinguishes verified ChannelId PCM GROUP/FX_RETURN from DCA/MATRIX/CUE, which still are not supported. Canonical ChannelId uint64 parsing rejects strings longer than 20 digits before BigInt conversion; a late older **device epoch** snapshot cannot rewind control authority or clear the newer pending bus intent. Invalid/stale/rejected engine ACK feedback remains visible after the panel unlock redraw, while an accepted BUS never becomes visible without a strictly subsequent native PCM graph/roster snapshot. The source-executing Node vm test now asserts these user-visible safety conditions. No new stylesheet, host callback, fake universal capability or M4 DSP path is introduced. diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index e5d7caa72..c755491f3 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -167,7 +167,7 @@ test('E4 operator native Group+FX Return controls run through real ACK then newe addEventListener(name,fn){this.listeners[name]=fn;} insertAdjacentElement(_,child){this.children.push(child);} } - const root=new Node('section'),sent=[],events={}; + const root=new Node('section'),nativeCap=new Node('span'),sent=[],events={}; const doc={createElement:tag=>new Node(tag), createTextNode:text=>({textContent:text}), getElementById:id=>id==='arBusCapability'?root:null}; @@ -175,7 +175,8 @@ test('E4 operator native Group+FX Return controls run through real ACK then newe addEventListener:(name,fn)=>events[name]=fn}; const ctx=vm.createContext({ document:doc,api,window:{crypto:{getRandomValues:n=>n.fill(7)}}, - routeOverlay:{classList:{contains:()=>true}}, + routeOverlay:{classList:{contains:()=>true}, + querySelector:selector=>selector==='[data-bus-cap="missing"]'?nativeCap:null}, state:{monitor:false,secondaryOutputArmed:false}, patchPending:false,mixerDraftActive:false }); @@ -197,6 +198,7 @@ test('E4 operator native Group+FX Return controls run through real ACK then newe const probe=code=>vm.runInContext(code,ctx,{timeout:1000}); assert.equal(probe('groupCreate.disabled'),false); assert.equal(probe('nativeBusSources.children.length'),2); + assert.match(nativeCap.textContent,/NATIVE PCM ACTIVE/); probe("nativeBusSources.children[0].children[0].checked=true"); probe("nativeBusSources.children[0].children[0].listeners.change()"); probe("nativeBusName.value='Vocal Group';nativeBusGain.value='.6';groupCreate.listeners.click()"); @@ -247,6 +249,9 @@ test('E4 operator native Group+FX Return controls run through real ACK then newe }); assert.equal(probe('groupCreate.disabled'),false, 'rejected native intent should unlock controls while keeping old PCM unchanged'); + assert.match(probe('nativeBusState.textContent'),/REJECTED.*NATIVE_REJECTED/); + events.arMixConsoleSnapshot(snap('11','4','11')); + assert.equal(probe('busSession'),'12','old device generation must not replace live native BUS'); const armed=snap('11','4','12',true); events.arMixConsoleSnapshot(armed); assert.equal(probe('groupCreate.disabled'),true,'output armed structural edits fail closed'); diff --git a/web/monitor.js b/web/monitor.js index 25aa17ed5..a1ea448fa 100644 --- a/web/monitor.js +++ b/web/monitor.js @@ -308,8 +308,10 @@ nativeBusActions,nativeBusRows); document.getElementById('arBusCapability')?.insertAdjacentElement('afterend',realBusPanel); - const busWireDecimal=s=>typeof s==='string'&&/^[1-9][0-9]*$/.test(s)&& - BigInt(s)<=18446744073709551615n?s:null; + // Fast bounded uint64 validation: never BigInt-parse arbitrarily long + // untrusted WebView values before checking canonical length and format. + const busWireDecimal=s=>typeof s==='string'&&s.length<=20&& + /^[1-9][0-9]*$/.test(s)&&BigInt(s)<=18446744073709551615n?s:null; const busSelection=new Set(); let busSnapshot=null,busPending=null,busSignature='',busSession='',busSequence=0; let busSnapshotSerial=0; @@ -360,6 +362,13 @@ if(!force&&signature===busSignature)return; busSignature=signature; const ready=!!accepted,structural=busMayEdit('NATIVE_CREATE_GROUP_SELECTED',true); + // The old M4 caption said GROUP was not implemented. E3 can now own + // an actual GROUP/FX RETURN while universal v8/DCA/MATRIX remain gated. + // State the CURRENT PCM truth, not a permanent obsolete capability. + const legacyCaption=routeOverlay.querySelector('[data-bus-cap="missing"]'); + if(legacyCaption)legacyCaption.textContent=ready + ?'CHANNELID GROUP / FX RETURN · NATIVE PCM ACTIVE · DCA / MATRIX / CUE NOT AVAILABLE' + :'GROUP / FX RETURN REQUIRES VERIFIED NATIVE PCM · DCA / MATRIX / CUE NOT AVAILABLE'; groupCreate.disabled=!structural; fxReturnCreate.disabled=!busMayEdit('NATIVE_CREATE_FX_RETURN_SELECTED',true); nativeBusName.disabled=!ready||!!busPending; @@ -461,6 +470,9 @@ if(!snap||snap.schemaVersion!==6)return; const nextEpoch=busWireDecimal(snap.device?.epoch); if(nextEpoch===null)return; + // An old async snapshot must never roll UI authority back to an + // earlier device generation, even if its previous graph was accepted. + if(busSession&&BigInt(nextEpoch) Date: Wed, 4 Nov 2026 01:19:20 +0700 Subject: [PATCH 090/155] fix(engine E4): guard original M4 AUX1-4 ownership against native BUS REMOVE/mix The generic native roster may delete any FX_RETURN, but the original four M4 AUX returns must retain stable IDs for legacy AUX send/Show and scalar DSP state. Reject original accepted AUX ChannelIds on native BUS removal and native BUS mix at the installed control owner; no graph mutation or false ACK. Publish per-channel nativeManaged from canonical imported AUX identity to distinguish real E3-created buses from four original FX returns. ROUTING GUI only offers dynamic Bus REMOVE/gain/PAN for verified nativeManaged rows; test mixed original AUX plus truly created native Group and identity guard. Preserve one RT callback and existing CSS ownership. --- .../ENGINE_SINGLE_OWNER_HANDOFF_20261103.md | 6 +++++ src/LiveDryRoutingLab.h | 22 ++++++++++++++-- tests/engine_runtime_reconciliation_test.mjs | 25 +++++++++++++++++-- web/monitor.js | 6 ++++- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md index 88981843b..6b0aebe2b 100644 --- a/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md +++ b/docs/workstreams/ENGINE_SINGLE_OWNER_HANDOFF_20261103.md @@ -139,3 +139,9 @@ The operator uses the E3 native `arMixConsoleIntent` contract: unique nonce-bear ### E4 release-grade operator safety/readback follow-up The existing `data-bus-cap=missing` label no longer permanently claims AUDIO GROUP is unimplemented after a real E3 native GROUP has been admitted. It now distinguishes verified ChannelId PCM GROUP/FX_RETURN from DCA/MATRIX/CUE, which still are not supported. Canonical ChannelId uint64 parsing rejects strings longer than 20 digits before BigInt conversion; a late older **device epoch** snapshot cannot rewind control authority or clear the newer pending bus intent. Invalid/stale/rejected engine ACK feedback remains visible after the panel unlock redraw, while an accepted BUS never becomes visible without a strictly subsequent native PCM graph/roster snapshot. The source-executing Node vm test now asserts these user-visible safety conditions. No new stylesheet, host callback, fake universal capability or M4 DSP path is introduced. + +### E4 audio-integrity ownership hardening: original AUX1–4 are **NOT** native dynamic BUSes + +Root cause from source inspection: the underlying generic `DynamicChannelRoster::removeBusAndRestoreSources()` correctly accepts any `FX_RETURN` role, but the installed 10CH+4AUX M4 compatibility graph contains four **original fixed AUX/FX_RETURN** ChannelIds that must remain present and owned by the original M4 AUX/send/Show controls. Exposing generic native `REMOVE` on those original IDs could delete a live compatibility FX return and desynchronize original AUX sends/PCM/Show. The installed `LiveDryRoutingLab` now tests **actual `nativeAccepted_.graph.ids.aux` stable IDs** before any graph mutation: original AUX deletion returns `FIXED_M4_AUX_NOT_REMOVABLE` without publishing a different graph; original AUX dynamic MIX edits also NACK to prevent dual control owners. `nativeBusStatus().channels[].nativeManaged` is derived from that same canonical native owner map, not GUI ordinal or role alone. The existing ROUTING operator displays REMOVE and native BUS gain/pan **only** for `nativeManaged=true` GROUP / FX_RETURN rows; fixed original M4 AUX1–4 remain on the original four AUX controls. Node vm execution test now includes a mixed accepted roster with a read-only original AUX and a separately editable newly created native Group. + +This preserves the 10CH/4AUX contract while allowing new native FX returns/serial Groups; it does not change the single JUCE callback, plugin owner leases, external hardware gate or GUI style. Exact-head Windows native build/CTest and Chromium regression remain required. diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index cc733eb81..c38ceda47 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1077,6 +1077,14 @@ class LiveDryRoutingLab final { return false; } } + // The accepted original four AUX/FX RETURNS are fixed M4-owned lanes. + // Generic roster.removeBus() accepts any FX_RETURN; this physical host + // must protect their actual stable IDs, not rely on role/display order. + bool originalM4Aux(armix::mixer::ChannelId id) const noexcept { + for(const auto aux:nativeAccepted_.graph.ids.aux) + if(aux.value && aux==id)return true; + return false; + } // E3: structural native GROUP/FX RETURN transaction on the SAME // accepted physical ChannelId publisher. This is the CONTROL writer, // not a second graph/audio callback or a simulated Console mutation. @@ -1108,6 +1116,9 @@ class LiveDryRoutingLab final { if(!outputsDisarmed) { reply.error="OUTPUT_MUST_BE_DISARMED";return reply; } + if(remove.value && originalM4Aux(remove)) { + reply.error="FIXED_M4_AUX_NOT_REMOVABLE";return reply; + } try { auto next=nativeAccepted_.graph.roster; // CONTROL only ChannelEditResult changed; @@ -1182,8 +1193,9 @@ class LiveDryRoutingLab final { expectedPcmRevision!=nativeAccepted_.pcmRevision)return false; const auto* channel=nativeAccepted_.graph.roster.find(id); if(!channel || (channel->role!=armix::mixer::ChannelRole::group && - channel->role!=armix::mixer::ChannelRole::fxReturn)) - return false; + channel->role!=armix::mixer::ChannelRole::fxReturn) || + originalM4Aux(id)) + return false; // original AUX 1–4 belong to M4 control state if(!nativePublisher_.setChannelMix( epochAtEdit,expectedPcmRevision,id,gain,pan))return false; return nativeAccepted_.graph.roster.rememberLiveMix(id,gain,pan); @@ -1217,6 +1229,12 @@ class LiveDryRoutingLab final { ch.role==armix::mixer::ChannelRole::fxReturn?"FX_RETURN": ch.role==armix::mixer::ChannelRole::main?"MAIN":"MONITOR"; row->setProperty("role",role); + // Only E3-created BUSes can be edited here. The original AUX + // 1–4 have FX_RETURN roles too, but are still M4-owned lanes. + row->setProperty("nativeManaged", + (ch.role==armix::mixer::ChannelRole::group || + ch.role==armix::mixer::ChannelRole::fxReturn) && + !originalM4Aux(ch.id)); row->setProperty("name",juce::String(ch.name)); row->setProperty("format",ch.format==armix::mixer::ProcessingFormat::stereo ?"STEREO":"MONO"); diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index c755491f3..cde95b024 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -192,12 +192,18 @@ test('E4 operator native Group+FX Return controls run through real ACK then newe 'NATIVE_REMOVE_BUS'], channels:[{id:'1',role:'INPUT',name:'Microphone'}, {id:'2',role:'INPUT',name:'Music'}, - {id:'3',role:'MAIN',name:'MAIN'}]}} + {id:'3',role:'MAIN',name:'MAIN'}, + // Accepted original M4 AUX1 has FX_RETURN role but its owner is + // NOT the dynamic E3 BUS edit transport: must stay read-only here. + {id:'4',role:'FX_RETURN',name:'AUX 1',nativeManaged:false, + fader:1,pan:0}]}} }); events.arMixConsoleSnapshot(snap()); const probe=code=>vm.runInContext(code,ctx,{timeout:1000}); assert.equal(probe('groupCreate.disabled'),false); assert.equal(probe('nativeBusSources.children.length'),2); + assert.equal(probe('nativeBusRows.children.length'),0, + 'original M4 AUX receiver must never expose native REMOVE/mix controls'); assert.match(nativeCap.textContent,/NATIVE PCM ACTIVE/); probe("nativeBusSources.children[0].children[0].checked=true"); probe("nativeBusSources.children[0].children[0].listeners.change()"); @@ -226,7 +232,7 @@ test('E4 operator native Group+FX Return controls run through real ACK then newe assert.equal(probe('groupCreate.disabled'),true); const updated=snap('11','4'); updated.legacyM4.nativeBus.channels.splice(2,0,{ - id:'20',role:'GROUP',name:'Vocal Group',fader:1,pan:0}); + id:'20',role:'GROUP',name:'Vocal Group',nativeManaged:true,fader:1,pan:0}); events.arMixConsoleSnapshot(updated); assert.equal(probe('groupCreate.disabled'),false); assert.equal(probe('nativeBusRows.children.length'),1); @@ -259,6 +265,21 @@ test('E4 operator native Group+FX Return controls run through real ACK then newe assert.equal(commands().length,2); }); +test('E4 original 4 M4 AUX return IDs are immutable under dynamic native BUS edits',()=>{ + const physical=read('src/LiveDryRoutingLab.h'); + const ui=read('web/monitor.js'); + assert.match(physical,/bool originalM4Aux\(armix::mixer::ChannelId id\) const noexcept/); + assert.match(physical,/for\(const auto aux:nativeAccepted_\.graph\.ids\.aux\)/); + assert.match(physical,/if\(remove\.value && originalM4Aux\(remove\)\)/); + assert.match(physical,/FIXED_M4_AUX_NOT_REMOVABLE/); + assert.match(physical,/originalM4Aux\(id\)/); + assert.match(physical,/row->setProperty\("nativeManaged",/); + assert.match(ui,/x\.nativeManaged===true/); + assert.doesNotMatch(ui.slice(ui.indexOf('// E4: The EXISTING routing workspace controls'), + ui.indexOf('// Processing channel width is independent')),/M4_AUX_REMOVE|legacyAUXIdByIndex/, + 'Do not invent legacy AUX identities in the browser'); +}); + test('shipping application does not compile a second test-only native mixer',()=>{ const app=cmake.split(/\r?\n/).find(l=>l.startsWith('target_sources(ARMixConsole PRIVATE')); assert.ok(app,'native JUCE application source list missing'); diff --git a/web/monitor.js b/web/monitor.js index a1ea448fa..b1b030789 100644 --- a/web/monitor.js +++ b/web/monitor.js @@ -392,7 +392,11 @@ nativeBusSources.append(label); } nativeBusRows.replaceChildren(); - for(const ch of ready?bus.channels.filter(x=>x.role==='GROUP'||x.role==='FX_RETURN'):[]){ + // Native E3 owns only dynamically created BUS identities. Original + // AUX1–4 share FX_RETURN role but are controlled by the M4 strip/AUX + // panel. They must never expose REMOVE or a second fader writer here. + for(const ch of ready?bus.channels.filter(x=> + (x.role==='GROUP'||x.role==='FX_RETURN')&&x.nativeManaged===true):[]){ const line=document.createElement('div'); line.className='arBusActions'; const name=document.createElement('span'); From 81a80e808e09f5c2215ab35103bcf4c7f2b4552e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 01:33:52 +0700 Subject: [PATCH 091/155] fix(engine): preserve ChannelId BUS topology across rejected legacy route edits --- src/LiveAudioEngine.h | 2 ++ src/LiveDryRoutingLab.h | 17 +++++++++++++---- tests/engine_runtime_reconciliation_test.mjs | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 5160f1f87..35ae67c7f 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1060,6 +1060,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback const juce::var& command, const LiveDryRoutingLab::FxSelections& fx, const LiveDryRoutingLab::FxRestores* restored=nullptr) { + if (dryRoutingLab_.nativeBusTopologyLive()) + return "REMOVE native GROUP/FX RETURN buses before applying an M4 route"; if (!allOutputsDisarmed()) return "MUTE hardware output and DISARM STREAM before APPLY routing"; if (handoff_.busy()) return "A VST3 graph handoff is in progress"; if (routeReconfiguring_.load(std::memory_order_acquire)) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index c38ceda47..259ab6ff9 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -175,6 +175,12 @@ class LiveDryRoutingLab final { juce::AudioPluginFormatManager& formats, double sampleRate,int deviceFrames,bool explicitSelection=true, const FxRestores* restores=nullptr) { + // E5: the M4 compiler cannot encode an admitted native GROUP/FX RETURN. + // An M4 APPLY, Show recall or structural SOURCE/AUX edit must not + // erase native BUS PCM while its ChannelId graph owns the callback. + // After real device reopen a new epoch can start with a clean roster. + if(nativeStructureLive_ && nativeAccepted_.deviceEpoch==epoch()) + return "REMOVE native GROUP/FX RETURN buses before replacing the M4 route"; // Called by the native message thread only. Not callable from RT. if(!directPermitted || independentClock) return "Dry Routing LAB requires one verified DIRECT audio device"; @@ -1005,10 +1011,12 @@ class LiveDryRoutingLab final { bool admitChannelIdFromAcceptedM4(int occupiedExternalCh1Fx, int deviceFrames,bool outputsDisarmed, armix::mixer::DynamicChannelFxLeaseBank::ExternalLease externalCh1={}) { - channelIdPcmEpoch_.store(0,std::memory_order_release); - nativeStructureLive_=false; // M4 re-admission replaces all extra buses + // A rejected admission must preserve native BUS PCM and its original + // CH1/Orbit lease. Demote neither selected renderer nor BUS owner + // before the replacement snapshot is actually committed. try { - if(!outputsDisarmed || occupiedExternalCh1Fx<0 || + if((nativeStructureLive_ && nativeAccepted_.deviceEpoch==epoch()) || + !outputsDisarmed || occupiedExternalCh1Fx<0 || (occupiedExternalCh1Fx>0)!=externalCh1.populated() || !hasExplicitRoute()||!ready() || topologyFault_.load(std::memory_order_acquire)) @@ -1068,7 +1076,8 @@ class LiveDryRoutingLab final { nativePublisher_.acceptedRevision(),generation,epoch(), true,nativePublisher_,nativeAccepted_,std::move(externalCh1)); if(!applied.ok() || generation!=epoch() || m4Revision!=revision()) - return false; // unchanged M4 PCM is the safe rollback + return false; // keep last selected native renderer on rejection + nativeStructureLive_=false; // committed fixed M4 roster has no extra BUS channelIdPcmEpoch_.store(generation,std::memory_order_release); return true; } catch(...) { diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index cde95b024..2a21d437e 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -119,6 +119,25 @@ test('E3 stable ChannelId GROUP/FX RETURN is a real guarded physical PCM transac }); + +test('E5 rejected M4 structural edit and failed re-admission preserve native BUS PCM',()=>{ + const apply=physical.slice(physical.indexOf('juce::String apply ('),physical.indexOf('juce::String repatchPhysicalSource(')); + assert.match(apply,/nativeStructureLive_ && nativeAccepted_\.deviceEpoch==epoch\(\)/, + 'same-epoch native BUS blocks legacy M4 compilation before graph publication'); + assert.match(apply,/REMOVE native GROUP\/FX RETURN buses before replacing the M4 route/); + const admission=physical.slice(physical.indexOf('bool admitChannelIdFromAcceptedM4('), + physical.indexOf('bool originalM4Aux(')); + const commit=admission.indexOf('UnifiedLegacyProductionAdmission::compileAndCommit('); + assert.ok(commit>0,'native re-admission must commit genuine PCM'); + assert.doesNotMatch(admission.slice(0,commit),/channelIdPcmEpoch_\.store\(0|nativeStructureLive_=false/, + 'failed re-admission cannot demote renderer or discard BUS'); + assert.match(admission,/\(nativeStructureLive_ && nativeAccepted_\.deviceEpoch==epoch\(\)\)/); + assert.ok(admission.indexOf('nativeStructureLive_=false;',commit)>commit); + assert.ok(admission.indexOf('channelIdPcmEpoch_.store(generation',commit)>commit); + assert.match(engine,/if \(dryRoutingLab_\.nativeBusTopologyLive\(\)\)\s*return "REMOVE native GROUP\/FX RETURN buses/); + assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); +}); + test('E4 installed PATCH operator uses native ChannelId BUS ACK and real PCM snapshot, never ten-strip draft',()=>{ const ui=read('web/monitor.js'); const binding=ui.slice(ui.indexOf('// E4: The EXISTING routing workspace controls'), From 93ba8c86794a0f9aea0328e0421de8469186d44d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 01:36:27 +0700 Subject: [PATCH 092/155] fix(engine): retain matching M4 fallback when fixed ChannelId admission rejects --- src/LiveDryRoutingLab.h | 18 +++++++++++------- tests/engine_runtime_reconciliation_test.mjs | 9 +++++---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 259ab6ff9..c38d9e319 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1011,12 +1011,17 @@ class LiveDryRoutingLab final { bool admitChannelIdFromAcceptedM4(int occupiedExternalCh1Fx, int deviceFrames,bool outputsDisarmed, armix::mixer::DynamicChannelFxLeaseBank::ExternalLease externalCh1={}) { - // A rejected admission must preserve native BUS PCM and its original - // CH1/Orbit lease. Demote neither selected renderer nor BUS owner - // before the replacement snapshot is actually committed. + // E5: a native BUS uses topology that M4 cannot represent. Never + // demote its renderer on an unsupported legacy re-admission. + if(nativeStructureLive_ && nativeAccepted_.deviceEpoch==epoch()) + return false; + // Otherwise the last ACCEPTED M4 graph is the safe physical fallback + // if migration rejects. This also handles a successfully replaced M4 + // route whose new ChannelId candidate cannot be prepared. + channelIdPcmEpoch_.store(0,std::memory_order_release); + nativeStructureLive_=false; try { - if((nativeStructureLive_ && nativeAccepted_.deviceEpoch==epoch()) || - !outputsDisarmed || occupiedExternalCh1Fx<0 || + if(!outputsDisarmed || occupiedExternalCh1Fx<0 || (occupiedExternalCh1Fx>0)!=externalCh1.populated() || !hasExplicitRoute()||!ready() || topologyFault_.load(std::memory_order_acquire)) @@ -1076,8 +1081,7 @@ class LiveDryRoutingLab final { nativePublisher_.acceptedRevision(),generation,epoch(), true,nativePublisher_,nativeAccepted_,std::move(externalCh1)); if(!applied.ok() || generation!=epoch() || m4Revision!=revision()) - return false; // keep last selected native renderer on rejection - nativeStructureLive_=false; // committed fixed M4 roster has no extra BUS + return false; // selected M4 PCM owns the safe fallback channelIdPcmEpoch_.store(generation,std::memory_order_release); return true; } catch(...) { diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index 2a21d437e..be3820928 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -129,10 +129,11 @@ test('E5 rejected M4 structural edit and failed re-admission preserve native BUS physical.indexOf('bool originalM4Aux(')); const commit=admission.indexOf('UnifiedLegacyProductionAdmission::compileAndCommit('); assert.ok(commit>0,'native re-admission must commit genuine PCM'); - assert.doesNotMatch(admission.slice(0,commit),/channelIdPcmEpoch_\.store\(0|nativeStructureLive_=false/, - 'failed re-admission cannot demote renderer or discard BUS'); - assert.match(admission,/\(nativeStructureLive_ && nativeAccepted_\.deviceEpoch==epoch\(\)\)/); - assert.ok(admission.indexOf('nativeStructureLive_=false;',commit)>commit); + const dynamicFence=admission.indexOf('if(nativeStructureLive_ && nativeAccepted_.deviceEpoch==epoch())'); + const fixedFallback=admission.indexOf('channelIdPcmEpoch_.store(0,std::memory_order_release)'); + assert.ok(dynamicFence>=0 && fixedFallback>dynamicFence, + 'dynamic BUS cannot be demoted, but rejected fixed M4 migration must select matching M4 PCM'); + assert.match(admission,/nativeStructureLive_=false;/); assert.ok(admission.indexOf('channelIdPcmEpoch_.store(generation',commit)>commit); assert.match(engine,/if \(dryRoutingLab_\.nativeBusTopologyLive\(\)\)\s*return "REMOVE native GROUP\/FX RETURN buses/); assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); From 3f016b9bea7de932d280a725c62d50698e9bc95b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 01:39:40 +0700 Subject: [PATCH 093/155] fix(audio): block dry-only dynamic FX returns until real VST3 lease exists --- src/LiveDryRoutingLab.h | 13 ++++++++++++- tests/engine_runtime_reconciliation_test.mjs | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index c38d9e319..5b3a3c559 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1129,6 +1129,15 @@ class LiveDryRoutingLab final { if(!outputsDisarmed) { reply.error="OUTPUT_MUST_BE_DISARMED";return reply; } + // A new FX_RETURN has no attached native VST3 owner yet. Reusing + // the old lease bank cannot create an insert for the new ChannelId: + // its parallel input would be routed back as extra DRY PCM. Until + // INSERT/REMOVE FX is transactional for dynamic BUSes, reject + // creation instead of offering a falsely wet, louder return. + // Original M4 AUX 1-4 remain true processed FX return paths. + if(!remove.value && role==ChannelRole::fxReturn) { + reply.error="FX_RETURN_REQUIRES_NATIVE_VST3_OWNER";return reply; + } if(remove.value && originalM4Aux(remove)) { reply.error="FIXED_M4_AUX_NOT_REMOVABLE";return reply; } @@ -1228,8 +1237,10 @@ class LiveDryRoutingLab final { std::to_string(routing->rosterRevision))); state->setProperty("structural",nativeStructureLive_); juce::Array allowed; + // Only expose operations backed by a real DSP lease. Dynamic + // FX_RETURN insertion is not available until a native VST3 owner + // can be prepared for its new ChannelId; do not advertise it. for(const char* op: {"NATIVE_CREATE_GROUP_SELECTED", - "NATIVE_CREATE_FX_RETURN_SELECTED", "NATIVE_REMOVE_BUS","NATIVE_SET_BUS_MIX"}) allowed.add(juce::var(juce::String(op))); state->setProperty("supportedOps",juce::var(allowed)); diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index be3820928..ff8855c95 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -139,6 +139,21 @@ test('E5 rejected M4 structural edit and failed re-admission preserve native BUS assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); }); + +test('E5 native FX return cannot advertise a no-VST dry-doubling physical bus',()=>{ + const structural=physical.slice(physical.indexOf('NativeBusResult editNativeBus('), + physical.indexOf('bool nativeBusTopologyLive()')); + assert.match(structural,/role==ChannelRole::fxReturn/); + assert.match(structural,/FX_RETURN_REQUIRES_NATIVE_VST3_OWNER/); + assert.match(structural,/DynamicChannelFxLeaseBank::reuseRevision/); + const advertised=physical.slice(physical.indexOf('juce::var nativeBusStatus() const'), + physical.indexOf('void disable() noexcept')); + assert.match(advertised,/"NATIVE_CREATE_GROUP_SELECTED"/); + assert.match(advertised,/"NATIVE_REMOVE_BUS"/); + assert.doesNotMatch(advertised,/"NATIVE_CREATE_FX_RETURN_SELECTED"/, + 'physical operator cannot create a parallel return without a real native insert'); +}); + test('E4 installed PATCH operator uses native ChannelId BUS ACK and real PCM snapshot, never ten-strip draft',()=>{ const ui=read('web/monitor.js'); const binding=ui.slice(ui.indexOf('// E4: The EXISTING routing workspace controls'), From 8a9422727ed051dbb692937fed0f3b2e26a8a1a3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 02:09:33 +0700 Subject: [PATCH 094/155] fix(release): prevent abandoned 10-channel GUI from shipping as ArSonMix Source-exact JUCE asset checks were green even though the embedded WebView2 was the obsolete static-ten UI. Require approved single-Console source plus real native ChannelId CREATE_CHANNEL on joined product release. Keep ENGINE CI native builds/tests but forbid shipping ENGINE-only stale-GUI artifacts for hardware FAT/UAT; make main release preflight mandatory. --- .github/workflows/p1-windows.yml | 14 ++++----- scripts/check_console_puzzle.mjs | 25 +++++++++++++++- ...ative_artifact_packaging_contract_test.mjs | 30 +++++++++---------- 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 159e3f6e2..73b0cfc4a 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -75,7 +75,7 @@ jobs: node --test tests/engine_runtime_reconciliation_test.mjs node scripts/check_console_puzzle.mjs - name: Stop incomplete integrated product promotion before JUCE checkout - if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-') }} + if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') }} run: node scripts/check_console_puzzle.mjs --release - name: Fast offline FactoryFX release and integrity contract tests shell: pwsh @@ -151,14 +151,12 @@ jobs: run: | & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - # PRs compile/CTest/package but never silently publish a stable build. - # Sole ENGINE #266 may upload an EXACT-SHA, CI/PE-verified - # UNQUALIFIED 10CH+4AUX engineering FAT ZIP; NOT universal live. - # Retired M4-only branches cannot publish competing ENGINE builds. + # Stop-ship: ENGINE-only CI is still built with abandoned 10-strip GUI. + # Never upload it as a user-testable mixer. Only exact-SHA joined product + # integration may upload after mandatory approved-Console release gating. - uses: actions/upload-artifact@v4 - if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m5-universal-channelid-vst3-lease-migration-20261101' }} + if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-') }} with: - name: ${{ github.event_name == 'pull_request' && 'ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64' || 'ArSonMix-GUI10CH-P012-Verified-Hardware-FAT-Windows-x64' }} + name: ArSonMix-INTEGRATED-UNIVERSAL-CONSOLE-EXPERIMENTAL-NOT-HARDWARE-QUALIFIED-Windows-x64 path: dist/ if-no-files-found: error - retention-days: 14 diff --git a/scripts/check_console_puzzle.mjs b/scripts/check_console_puzzle.mjs index 8f137ffd4..ddadd4952 100644 --- a/scripts/check_console_puzzle.mjs +++ b/scripts/check_console_puzzle.mjs @@ -11,7 +11,10 @@ const files={ gui:'web/mixer-layout.js', guiTest:'tests/operator_console_v6_smoke.py', fat:'scripts/console_v6_fat_gate.mjs', - fatTest:'tests/console_v6_fat_gate_test.mjs' + fatTest:'tests/console_v6_fat_gate_test.mjs', + operatorHtml:'web/index.html', + operatorApp:'web/app.js', + cmake:'CMakeLists.txt' }; const release=process.argv.includes('--release'); const read=path=>{try{return readFileSync(resolve(path),'utf8')}catch{return ''}}; @@ -25,6 +28,26 @@ const checks=[ ['GUI fixture from one canonical source',/console-v6\/fixtures\.json/.test(data.guiTest),'GUI #271: use shared fixture file, remove standalone MAIN/BUS-FX fake ids'], ['FAT checks native device endpoints and pin masks',/enabledInputs/.test(data.fat)&&/enabledOutputs/.test(data.fat),'FAT #270: validate native producer enabled pins, not hand-authored fantasy fields'], ['FAT fixture from one canonical source',/console-v6\/fixtures\.json/.test(data.fatTest),'FAT #270: use the SAME shared fixture as GUI tests, not duplicate schema'], + // The legacy app shipped a source-exact, but WRONG, fixed-ten GUI. + // The approved operator Console must own the embedded WebView assets. + ['GUI retired ten-strip demo removed', + !/\bconst\s+raw\s*=\s*\[/.test(data.operatorApp) && + !/\bconst\s+channels\s*=\s*raw\.map\s*\(/.test(data.operatorApp), + 'GUI #271: replace hard-coded 10-channel demo array with native accepted ChannelId roster'], + ['GUI approved single Console is packaged, not retired multi-workspace shell', + !/data-view=["']FX RACK["']/.test(data.operatorHtml) && + !/data-view=["']SIGNAL FLOW["']/.test(data.operatorHtml) && + !/Live FX Host GUI Preview/.test(data.operatorHtml), + 'GUI #271: remove abandoned MIX / FX RACK / SIGNAL FLOW shell; follow approved one-Console workflow'], + ['GUI direct universal channel operation originates from native accepted state', + /arMixConsoleSnapshot/.test(data.gui) && + /CREATE_CHANNEL/.test(data.gui) && + (data.gui.includes('graph.channels') || data.gui.includes('graph?.channels')), + 'ENGINE #266 + GUI #271: CREATE_CHANNEL native ACK then accepted graph.channels renders CH11+, no browser-created strips'], + ['JUCE BinaryData embeds release-gated operator HTML and JS', + /web\/index\.html\s+web\/styles\.css/.test(data.cmake) && + /web\/app\.js/.test(data.cmake), + 'FAT #270: CMake BinaryData must embed audited Console HTML/JS'], ]; execFileSync(process.execPath,['--test','tests/console_v6_puzzle_seam_test.mjs'],{stdio:'inherit'}); const blockers=checks.filter(x=>!x[1]); diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index 030c0f3d7..0d23dc4c7 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -135,21 +135,21 @@ test('FAT ZIP uses current single-APPLY physical first-sound guide',()=>{ assert.ok(quick.includes(entry),entry); }); -test('sole ENGINE #266 may upload an unqualified, exact-SHA physical FAT ZIP',()=>{ - const upload=workflow.split('uses: actions/upload-artifact@v4')[1]||''; - assert.ok(upload.includes('milestone/m5-universal-channelid-vst3-lease-migration-20261101')); - assert.ok(!upload.includes('milestone/m4-unified-native-multichannel-fx-20261101')); - assert.ok(upload.includes('ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64')); - assert.match(upload,/if-no-files-found: error/); - assert.ok(workflow.indexOf('ctest --test-dir build -C Release --output-on-failure')< - workflow.indexOf('uses: actions/upload-artifact@v4')); - assert.ok(workflow.indexOf('scripts/verify_native_windows_artifact.ps1')< - workflow.indexOf('uses: actions/upload-artifact@v4')); - const guide=read('docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md'); - assert.match(guide,/single canonical ENGINE #266 branch/); - assert.match(guide,/10CH \+ 4AUX/); - assert.match(guide,/sourceCommit/); - assert.match(guide,/exeSha256/); +test('retired 10CH UI cannot upload until a joined approved native Console exists',()=>{ + const gate=read('scripts/check_console_puzzle.mjs'); + assert.match(gate,/GUI retired ten-strip demo removed/); + assert.match(gate,/GUI approved single Console is packaged/); + assert.match(gate,/GUI direct universal channel operation/); + assert.match(gate,/data\.operatorHtml/); + assert.match(gate,/CREATE_CHANNEL/); + assert.match(workflow,/github\.event_name != 'pull_request' \|\| startsWith\(github\.head_ref, 'integration\/product-'\)/); + const upload=workflow.split('uses: actions/upload-artifact@v4')[1]||''; + assert.ok(upload.includes("github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')")); + assert.ok(!upload.includes('milestone/m5-universal-channelid-vst3-lease-migration-20261101')); + assert.ok(!upload.includes('ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64')); + assert.match(upload,/if-no-files-found: error/); + assert.ok(workflow.indexOf('ctest --test-dir build -C Release --output-on-failure'){ From 2d29a9dc67fa257317e98a5631793a424b9c4866 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 02:11:41 +0700 Subject: [PATCH 095/155] test(ci): align Windows upload assertions with mandatory integrated GUI gate The retired ENGINE-only artifact whitelist contradicted the new product stop-ship. Require product integration branch and unqualified label while preserving native CTest and exact SHA checks. --- tests/ci_workflow_efficiency_test.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/ci_workflow_efficiency_test.mjs b/tests/ci_workflow_efficiency_test.mjs index 78a11f104..48867dd77 100644 --- a/tests/ci_workflow_efficiency_test.mjs +++ b/tests/ci_workflow_efficiency_test.mjs @@ -6,7 +6,7 @@ const read=file=>readFileSync(file,'utf8'); const windows=read('.github/workflows/p1-windows.yml'); const ui=read('.github/workflows/ui-smoke.yml'); const pages=read('.github/workflows/pages-publish.yml'); -test('only main and explicitly selected branch can produce a Windows FAT artifact',()=>{ +test('only an integrated product branch may upload a Windows mixer candidate',()=>{ assert.match(windows,/branches: \[main\]/); assert.doesNotMatch(windows,/branches: \[ main, feature\//); assert.match(windows,/pull_request:\s+paths:/); @@ -15,8 +15,9 @@ test('only main and explicitly selected branch can produce a Windows FAT artifac assert.match(windows,/'web\/\*\*'/); assert.match(windows,/workflow_dispatch:/); assert.match(windows,/cancel-in-progress: true/); - assert.match(windows,/if: \$\{\{ github\.event_name != 'pull_request' \|\| github\.head_ref == 'milestone\/m5-universal-channelid-vst3-lease-migration-20261101' \}\}/); - assert.match(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64/); + assert.match(windows,/github\\.event_name == 'pull_request' && startsWith\\(github\\.head_ref, 'integration\\/product-'\\)/); + assert.match(windows,/ArSonMix-INTEGRATED-UNIVERSAL-CONSOLE-EXPERIMENTAL-NOT-HARDWARE-QUALIFIED/); + assert.doesNotMatch(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT/); assert.ok(!windows.includes("github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101'")); assert.ok(windows.indexOf('scripts/verify_native_windows_artifact.ps1') < windows.indexOf('uses: actions/upload-artifact@v4')); @@ -46,8 +47,9 @@ test('retain current native audio and dearVR CTests during CI optimization',()=> } assert.match(windows,/ctest --test-dir build -C Release --output-on-failure/); assert.match(windows,/'scripts\/build_ui_css\.py'/); - assert.match(windows,/if: \$\{\{ github\.event_name != 'pull_request' \|\| github\.head_ref == 'milestone\/m5-universal-channelid-vst3-lease-migration-20261101' \}\}/); - assert.match(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64/); + assert.match(windows,/github\\.event_name == 'pull_request' && startsWith\\(github\\.head_ref, 'integration\\/product-'\\)/); + assert.match(windows,/ArSonMix-INTEGRATED-UNIVERSAL-CONSOLE-EXPERIMENTAL-NOT-HARDWARE-QUALIFIED/); + assert.doesNotMatch(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT/); }); test('native FAT compiles the exact ENGINE PR HEAD and rejects transient merge refs',()=>{ From 45823b353f0a263a7b8a34e8da7c48ce05981f2c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 03:04:31 +0700 Subject: [PATCH 096/155] feat(console): embed approved single-console design in native JUCE host Replace runtime WebView2 root with source-owned approved Console geometry and lightweight native-only presenter. Eliminate the retired fixed-ten demo from production entry point; render accepted ChannelIds or actual admitted M4 rows, consume physical device inventory and real PCM peaks, dispatch real ConsoleIntent and ACK with revision fence. Keep unimplemented dynamic/FX operations visibly disabled, never fake audio or claim product readiness. Preserve previous UI assets for migration and tests. --- CMakeLists.txt | 2 +- src/Main.cpp | 6 +- web/console-native.css | 3814 +++++++++++++++++++++++++++++++++++++++ web/console-native.html | 97 + web/console-native.js | 205 +++ 5 files changed, 4122 insertions(+), 2 deletions(-) create mode 100644 web/console-native.css create mode 100644 web/console-native.html create mode 100644 web/console-native.js diff --git a/CMakeLists.txt b/CMakeLists.txt index 34aa9b7bd..1686c2623 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ juce_add_gui_app(ARMixConsole NEEDS_CURL FALSE) juce_add_binary_data(ARMixAssets SOURCES - web/index.html web/styles.css web/plugin-ui.css web/app.js web/plugin-ui.js web/bridge.js web/monitor.js web/mixer-io.js web/mixer-io.css web/mixer-layout.js web/mixer-layout.css web/assets/audio-interface.svg) + web/index.html web/console-native.html web/console-native.css web/console-native.js web/styles.css web/plugin-ui.css web/app.js web/plugin-ui.js web/bridge.js web/monitor.js web/mixer-io.js web/mixer-io.css web/mixer-layout.js web/mixer-layout.css web/assets/audio-interface.svg) target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h src/VstOrbitController.h engine/core/MixerRoutingPlan.h engine/core/ChannelRoutingContract.h engine/core/ChannelSendPlan.h engine/core/AuxBusPlan.h engine/core/PreparedMixerBlock.h engine/core/MasterOutputMonoPolicy.h engine/core/LiveChannelFxGraph.h engine/core/NativeDryRouteCommand.h engine/core/RealtimeRoutePublisher.h engine/device/LiveInputPortRegistry.h src/LiveDryRoutingLab.h engine/core/OrbitPhase.h engine/core/OrbitControlPolicy.h engine/core/OrbitMotion.h engine/core/OrbitDistanceMapping.h engine/core/DearVrPolarPolicy.h src/PluginCatalog.h src/FactoryFxRegistry.h src/PluginVault.h src/PortableWorkspace.h src/StudioBackup.h src/DiagnosticsRecorder.h src/StereoPan.h src/NativePresetArchive.h src/NativeShowSchema.h src/NativeDryShowRecall.h src/VstBusLayout.h src/LiveGraphHandoff.h src/DiagnosticTone.h engine/core/RealtimeHealthHistogram.h engine/core/CallbackCadenceEvidence.h engine/diagnostics/CrackleEvidenceWindow.h engine/device/AdaptiveClockBridge.h engine/device/AudioProfilePolicy.h engine/device/PeriodCapabilityEvidence.h engine/device/SessionLifecycle.h engine/device/WasapiCapabilityProbe.h engine/device/JuceIndependentClockDevice.h engine/device/LiveSecondaryOutputDevice.h engine/core/LiveOutputRouteGate.h engine/core/NativeRenderAuthority.h engine/device/ClockBridgeSizing.h engine/device/IndependentStreamFormatFence.h engine/device/DirectRestoreBackoff.h engine/device/IndependentStreamWatchdog.h engine/device/BridgeContinuityGate.h engine/device/EndpointIdentityPolicy.h engine/device/WasapiEndpointIdentityGuard.h engine/device/AsioStartupPolicy.h engine/device/AsioPriorityDeviceManager.h engine/device/JuceActivePortSnapshot.h engine/device/AsioRegistrationPolicy.h engine/device/AsioRegistryIdentityProbe.h engine/device/DirectRouteFence.h) target_compile_definitions(ARMixConsole PRIVATE diff --git a/src/Main.cpp b/src/Main.cpp index 1ef063311..0c18647f5 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -49,7 +49,11 @@ std::optional assetFor (const juce::String& int size = 0; juce::String mime; if (path == "/" || path == "/index.html") - { data = BinaryData::index_html; size = BinaryData::index_htmlSize; mime = "text/html"; } + { data = BinaryData::consolenative_html; size = BinaryData::consolenative_htmlSize; mime = "text/html"; } + else if (path == "/console-native.css") + { data = BinaryData::consolenative_css; size = BinaryData::consolenative_cssSize; mime = "text/css"; } + else if (path == "/console-native.js") + { data = BinaryData::consolenative_js; size = BinaryData::consolenative_jsSize; mime = "text/javascript"; } else if (path == "/styles.css") { data = BinaryData::styles_css; size = BinaryData::styles_cssSize; mime = "text/css"; } else if (path == "/app.js") diff --git a/web/console-native.css b/web/console-native.css new file mode 100644 index 000000000..01f842030 --- /dev/null +++ b/web/console-native.css @@ -0,0 +1,3814 @@ + +:root{ + color-scheme:dark;--bg:#242424;--panel:#222325;--panel2:#292a2c; + --rule:#131415;--line:#424446;--ink:#c7c8c8;--dim:#8d9092;--blue:#49a5c8; + font:11px/1.32 "Segoe UI",Arial,sans-serif; +} +*{box-sizing:border-box} +html,body{width:100%;height:100%;min-width:760px;min-height:540px;margin:0;overflow:hidden;background:#202123;color:var(--ink)} +button,input,select{font:inherit;color:inherit} +button{cursor:pointer} +button:focus-visible,input:focus-visible,select:focus-visible{outline:1px solid #8cc5da;outline-offset:-1px} +button:disabled{opacity:.45;cursor:not-allowed} +.app{height:100%;display:flex;flex-direction:column} +.window-title{height:29px;flex:none;background:#303133;display:flex;align-items:center;padding:0 11px;border-bottom:1px solid #171819;gap:14px;white-space:nowrap} +.logo{color:#72bbce;font-size:12px;font-weight:600;letter-spacing:.03em} +.window-title .file-name{color:#bcc0c2;font-size:11px} +.window-title .study{margin-left:auto;font-size:10px;color:#a4a6a6;letter-spacing:.06em} +.command-bar{height:38px;flex:none;display:flex;align-items:center;gap:7px;padding:0 11px;border-bottom:1px solid #111;background:linear-gradient(#303133,#2a2b2c);overflow:visible;position:relative;z-index:12;white-space:nowrap} +.tool{padding:4px 9px;background:linear-gradient(#414244,#343537);border:1px solid #1b1d1e;border-radius:2px;box-shadow:inset 0 1px #545658;font-size:11px;white-space:nowrap} +.tool:hover{background:#4a4b4d} +.toolbar-label{color:#a0a5a6;font-size:10px} +.toolbar-select{height:23px;min-width:62px;max-width:108px;border:1px solid #161819;border-radius:2px;background:#343638;color:#c7cdcf;font-size:10px} +@media(max-width:1350px){.command-bar{gap:4px;padding:0 5px}.toolbar-label,.short-help{display:none}.tool{padding:4px 6px}.toolbar-select{min-width:57px;max-width:89px}} +.tool.active{color:#cbecf7;border-color:#4d8295;background:#2f4751} +.tool.primary{color:#c1e2ea} +.sep{height:18px;width:1px;background:#171819;margin:0 3px} +.short-help{margin-left:auto;color:#848a8d;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:10px} +.console-pane{flex:1;min-height:0;display:flex;flex-direction:column;background:#202122;position:relative} +.mixer-title{height:24px;display:flex;align-items:center;padding:0 9px;flex:none;border-bottom:1px solid #0f1010;background:#292a2b;gap:9px} +.mixer-title .accent{height:12px;width:3px;background:#55afcb} +.mixer-title .panel-name{font-weight:600} +.mixer-title .panel-sub{color:#8f9295} +.mixer-title .right{margin-left:auto;color:#808488;font-size:10px} +.console-body{flex:1;min-height:0;display:flex;overflow:hidden;--route-h:59px;--fx-h:119px;--send-h:84px;--eq-h:49px;--pan-h:35px;--trim-h:23px;--switch-h:31px;--footer-h:53px} +.section-rail{flex:0 0 33px;width:33px;display:flex;flex-direction:column;border-right:1px solid #060707;background:#262729;box-shadow:inset -1px 0 #343537;text-align:center} +.rail-cell{position:relative;width:100%;min-width:0;border:0;background:transparent;cursor:default;display:flex;align-items:center;justify-content:center;border-bottom:1px solid #111;color:#a0a3a5;flex:none;font-size:15px} +.rail-cell small{font-size:9px;color:#8d9294} +.rail-cell[data-section]{cursor:pointer} +.rail-cell[data-section]:hover{color:#d7e9ee;background:#34383a} +.rail-cell[data-section].collapsed{color:#75b8c9} +.console-body.collapsed-route{--route-h:23px} +.console-body.collapsed-fx{--fx-h:23px} +.console-body.collapsed-send{--send-h:23px} +.console-body.collapsed-eq{--eq-h:23px} +.console-body.collapsed-route .route-section .route-select{display:none} +.console-body.collapsed-send .send-section .send-select,.console-body.collapsed-send .send-section .sendlevel{display:none} +.console-body.collapsed-eq .eq-section .eq-line{display:none} +.rail-cell.route{height:var(--route-h)} +.rail-cell.fx{height:var(--fx-h);font-family:Georgia,serif;font-style:italic} +.rail-cell.send{height:var(--send-h)} +.rail-cell.eq{height:var(--eq-h)} +.rail-cell.pan{height:var(--pan-h)} +.rail-cell.trim{height:var(--trim-h)} +.rail-cell.switch{height:var(--switch-h)} +.rail-cell.fader{flex:1;min-height:80px;flex-direction:column;gap:7px;font-size:10px} +.rail-cell.footer{height:var(--footer-h)} +.tracks-viewport{flex:1;min-width:0;overflow:auto hidden;background:#1d1e1f;scrollbar-color:#585a5a #292a2b;scrollbar-width:thin} +.tracks{display:flex;align-items:stretch;width:max-content;min-width:100%;height:100%} +.strip{width:102px;flex:0 0 102px;min-width:102px;min-height:0;height:100%;display:flex;flex-direction:column;background:#232425;border-right:2px solid #111213;box-shadow:inset 1px 0 #37383a} +.strip:nth-child(even){background:#252627} +.strip.selected{background:#2d3032;box-shadow:inset 2px 0 #63acc1} +.console-body.narrow{--fx-h:23px;--send-h:23px;--eq-h:23px} +.console-body.narrow .strip:not(.master){width:78px;flex-basis:78px;min-width:78px} +.console-body.narrow .route-select{font-size:9px} +.console-body.narrow .send-section .send-select,.console-body.narrow .sendlevel,.console-body.narrow .eq-line{display:none} +.console-body.narrow .fader-scale{font-size:8px;width:14px;min-width:14px} +.console-body.narrow .pan-section{height:var(--pan-h);flex:0 0 var(--pan-h);display:grid;grid-template-columns:15px minmax(0,1fr) 17px;align-items:center;gap:3px;padding:0 3px;overflow:hidden} +.console-body.narrow .pan-control{max-width:43px} +.console-body.narrow .switch{min-width:15px;padding:0} +.console-body.narrow .switch-section{height:var(--switch-h);flex:0 0 var(--switch-h);display:flex;justify-content:center;align-items:flex-start;padding:3px 3px 0;gap:2px} +.console-body.narrow .strip .footer-label .name{font-size:9px} +#master{flex:0 0 111px;width:111px;min-width:111px;overflow:hidden} +.strip.master{width:111px;flex:0 0 111px;background:#26282a;border-left:2px solid #111213;border-right:0;box-shadow:inset 1px 0 #44484b} +.strip.bus{background:#2a292b} +.strip.fx{background:#29252d} +.section{border-bottom:1px solid #111;box-shadow:inset 0 -1px #383a3c;flex:none;min-width:0;min-height:0;box-sizing:border-box;overflow:hidden;padding:0 3px} +.route-section{height:var(--route-h);flex:0 0 var(--route-h);display:flex;flex-direction:column;padding:3px 3px 2px} +.route-top{height:14px;min-height:14px;flex:0 0 14px;display:flex;align-items:center;justify-content:space-between;gap:2px;white-space:nowrap;overflow:hidden;color:#85898c;font-size:10px;padding:0 1px} +.route-indicator{color:#8c9193;font-size:11px} +.group-indicator{font-size:9px;color:#a4d0dc;background:#334e59;padding:0 3px;border:1px solid #406f7d;border-radius:2px} +.safe-marker{color:#e1bd87;font-size:7px;font-weight:600;letter-spacing:0;border:1px solid #8b744a;padding:0 1px} +.format-badge{font-size:9px;color:#8fc2cf;min-width:15px;width:auto;padding:0 1px} +.meter-box.mono .meter-lane{max-width:13px;margin:0 auto} +.console-body.sends-mode .strip.audio .footer-label{background:#2b4048} +.console-body.sends-mode .strip.audio .db-value{color:#8ddae6} +.bank-arrow{min-width:20px;padding:4px!important;font-size:15px;line-height:14px} +.route-select{width:100%;height:17px;padding:0 12px 0 3px;color:#d1d3d4;background:#2a2b2c;border:0;border-bottom:1px solid #363739;outline:none;font-size:10px;appearance:none;white-space:nowrap;text-overflow:ellipsis;background-image:linear-gradient(45deg,transparent 50%,#b6babd 50%),linear-gradient(135deg,#b6babd 50%,transparent 50%);background-position:calc(100% - 7px) 7px,calc(100% - 4px) 7px;background-size:3px 3px;background-repeat:no-repeat} +.route-select:hover{background-color:#3a3b3e} +.subhead{height:22px;flex:0 0 22px;min-height:22px;display:flex;align-items:center;gap:3px;padding:0 2px;border-bottom:1px solid #141516;white-space:nowrap;overflow:hidden} +.subhead .sym{font-size:13px;font-style:italic;font-family:Georgia,serif;color:#b4b8b9;flex:0 0 auto} +.subhead .hint{font-size:9px;color:#94999c;flex:1 1 0;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis} +.subhead .push{margin-left:auto;min-width:0} +.mini{width:17px;height:17px;flex:0 0 17px;min-width:0;border:0;border-radius:1px;color:#979b9e;background:transparent;padding:0;line-height:17px;text-align:center} +.mini:hover{background:#434749} +.mini.power.on{color:#55bb86} +.mini.phase.on{background:#994c4b;color:#fff} +.mini.pre.on{color:#aed7e8} +.fx-section{height:var(--fx-h);flex:0 0 var(--fx-h);min-height:0;display:flex;flex-direction:column;padding:0 3px 1px} +.fxslot-row{display:flex;align-items:center;height:20px;border-bottom:1px solid #303234;gap:2px} +.fxslot-row:last-child{border-bottom:0} +.fxslot-row.dragged{opacity:.38} +.fxslot-row.drop-target{outline:1px solid #8ec6d9;outline-offset:-1px} +.fxslot-row .grip{font-size:10px;color:#737779;cursor:grab;user-select:none;flex:0 0 9px;line-height:16px;overflow:hidden} +.send-section{height:var(--send-h);flex:0 0 var(--send-h);display:flex;flex-direction:column;padding:0 3px} +.send-header{height:21px;flex:0 0 21px;min-height:21px;display:flex;align-items:center;gap:2px;min-width:0;white-space:nowrap;overflow:hidden;border-bottom:1px solid #151617} +.send-header .sym{display:none} +.send-header .sendtag{font-size:9px;color:#999b9e} +.send-slot{width:37px;min-width:0;height:18px;flex:0 0 37px;padding:0;border:0;color:#b1bac0;background:#303234;font-size:9px} +.send-header .push{margin-left:auto;min-width:0;flex:1} +.send-select{width:100%;height:21px;flex:0 0 21px;min-width:0;max-width:100%;border:0;background:#303234;color:#c5c7c8;appearance:none;overflow:hidden;text-overflow:ellipsis;padding-left:4px;font-size:10px} +.send-select:hover{background:#3b3c3e} +.sendlevel{display:grid;grid-template-columns:10px minmax(0,1fr) 28px;align-items:center;height:18px;min-height:18px;flex:0 0 18px;min-width:0;gap:2px;overflow:hidden} +.sendlevel label{font-size:9px;color:#8f9498} +.sendlevel input{width:100%;min-width:0;height:9px;margin:0;accent-color:#8eaab3} +.sendlevel output{font-size:9px;color:#a7aaad;text-align:right;white-space:nowrap;overflow:hidden;margin:0} +.send-pan label{color:#7eb1c0} + +.eq-section{height:var(--eq-h);flex:0 0 var(--eq-h);display:flex;flex-direction:column;padding:0 3px 2px} +.eq-header{height:20px;min-height:20px;flex:0 0 20px;display:flex;align-items:center;gap:4px;white-space:nowrap;overflow:hidden} +.eq-header .sym{font-size:13px;color:#a1a3a4} +.eq-header .push{margin-left:auto} +.eq-line{height:24px;width:100%;border:1px solid #36383a;background:linear-gradient(0deg,transparent 49%,#44494b 50%,transparent 51%),#25282a;display:flex;align-items:center;justify-content:center} +.eq-line svg{width:87%;height:20px;stroke:#758d96;fill:none;stroke-width:1.1} +.eq-section.off .eq-line svg{stroke:#575b5e} +.pan-section{height:var(--pan-h);display:flex;align-items:center;gap:4px;padding:0 6px} +.pan-section input{min-width:0;max-width:100%;accent-color:#9ba7aa} +.pan-section .pan-icon{font-size:15px;color:#9a9fa1} +.pan-section output{font-size:9px;min-width:0;text-align:right;color:#6bafc2;white-space:nowrap;overflow:hidden} +.trim-section{height:var(--trim-h);flex:0 0 var(--trim-h);padding:1px 3px;display:flex;align-items:center;gap:3px;min-width:0;overflow:hidden} +.trim-label{font-size:8px;color:#9aa0a5;flex:none} +.trim-control{min-width:0;flex:1;width:42px;height:8px;accent-color:#8aafb9} +.trim-value{font-size:9px;color:#a2d1df;min-width:23px;text-align:right} +.pan-control{height:17px;flex:1;min-width:0;position:relative;display:flex;align-items:center;isolation:isolate} +.pan-control:after{content:"";pointer-events:none;position:absolute;top:1px;bottom:0;left:50%;border-left:1px solid #91c1cb;opacity:.95} +.center-pan{width:100%!important;flex:1;min-width:0;height:18px!important;appearance:none;-webkit-appearance:none;background:transparent;cursor:ew-resize;margin:0;position:relative;z-index:2} +.center-pan::-webkit-slider-runnable-track{height:5px;border-radius:1px;border:1px solid #485052;background:linear-gradient(to right,#292f32 0,#292f32 var(--pan-start),#60b5cf var(--pan-start),#60b5cf var(--pan-end),#292f32 var(--pan-end),#292f32 100%)} +.center-pan::-moz-range-track{height:5px;border-radius:1px;border:1px solid #485052;background:linear-gradient(to right,#292f32 0,#292f32 var(--pan-start),#60b5cf var(--pan-start),#60b5cf var(--pan-end),#292f32 var(--pan-end),#292f32 100%)} +.center-pan::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:9px;height:14px;margin-top:-5px;border-radius:2px;background:linear-gradient(#d4dadd,#879fa9);border:1px solid #151b1d} +.center-pan::-moz-range-thumb{width:9px;height:14px;border-radius:2px;background:#acc2cb;border:1px solid #151b1d} +.switch.on.cue{background:#5198b5;color:#101819} +.switch.cue{min-width:25px;font-size:9px} +.console-body.narrow .switch.cue{min-width:20px;font-size:7px} +.switch-section{height:var(--switch-h);display:flex;justify-content:center;align-items:flex-start;padding:3px 3px 0;gap:2px} +.switch{min-width:19px;height:20px;background:#2a2c2e;border:1px solid #1a1c1d;color:#8e9294;font-size:10px;padding:0 2px} +.switch:hover{background:#454849} +.switch.on.mute{background:#af9347;color:#111} +.switch.on.solo{background:#d8bb51;color:#151515} +.switch.on.mon{background:#4483a0;color:#fff} +.fader-section{flex:1;min-height:82px;display:flex;justify-content:center;padding:9px 4px 4px;gap:5px;overflow:hidden} +.fader-scale{width:18px;min-width:18px;display:flex;flex-direction:column;justify-content:space-between;text-align:right;color:#979da0;font-size:9px;line-height:1;padding:0 0 8px} +.fader-box{width:30px;height:100%;position:relative;display:flex;justify-content:center} +.fader-box:before{content:"";position:absolute;top:5px;bottom:12px;width:5px;background:#101112;border:1px solid #4d5052;left:12px} +.fader{height:calc(100% - 17px);width:27px;margin-top:5px;writing-mode:vertical-lr;direction:rtl;appearance:none;-webkit-appearance:none;background:transparent;position:relative;z-index:1;cursor:ns-resize;touch-action:none} +.fader::-webkit-slider-runnable-track{background:transparent;border:0} +.fader::-moz-range-track{background:transparent;border:0} +.fader::-webkit-slider-thumb{-webkit-appearance:none;width:22px;height:15px;border-radius:2px;border:1px solid #0c1619;background:linear-gradient(#d4d8d6 0%,#989fa1 30%,#6f8288 47%,#d8ddde 55%,#78898f 60%,#a1a8aa 100%);box-shadow:0 1px 2px #090909;cursor:ns-resize} +.fader::-moz-range-thumb{width:22px;height:15px;border-radius:2px;border:1px solid #0c1619;background:#acb6ba;box-shadow:0 1px 2px #090909} +.master .fader::-webkit-slider-thumb{background:linear-gradient(#b9c7ce,#5986a5 48%,#bad0d7 53%,#5a819b)} +.meter-box{height:calc(100% - 17px);display:flex;gap:2px;width:19px;min-width:19px;margin-top:5px;position:relative} +.meter-lane{position:relative;flex:1;border:1px solid #0c0e0f;background:#0b0d0e;box-shadow:inset 0 0 0 1px #303334;overflow:hidden} +.meter-fill{position:absolute;inset:0 1px;height:100%;background:linear-gradient(to top,#42966d 0%,#6bb98b 60%,#d5b95e 81%,#d9554b 100%);clip-path:inset(calc(100% - var(--lit,0%)) 0 0);transition:clip-path 95ms linear} +.meter-lane:before{content:"";position:absolute;inset:0;z-index:2;background:repeating-linear-gradient(to top,transparent 0,transparent 4px,rgba(0,0,0,.65) 4px,rgba(0,0,0,.65) 6px);pointer-events:none} +.peak{position:absolute;top:0;right:0;width:3px;height:3px;background:#7d3530;opacity:.3} +.peak.clipping{background:#ef6158;opacity:1} +.fader-meter-legend{position:absolute;bottom:0;right:0;left:0;text-align:center} +.bottom-section{height:var(--footer-h);flex:0 0 var(--footer-h);padding:0 3px 4px;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-end} +.db-value{height:17px;color:#54b0d0;text-align:center;font-size:11px;padding-top:1px} +.footer-label{height:29px;display:flex;flex-direction:column;justify-content:space-between;background:#2d2f31;border-top:1px solid #505153} +.footer-label .name{font-size:10px;color:#c2c3c5;padding:3px 4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:text;text-align:center} +.footer-label .name[contenteditable="true"]{outline:1px solid #69b6d0;background:#3b4549;user-select:text} +.footer-label .color-strip{height:5px;background:var(--track-color,#497e8b)} +.footer-label.bus-label{background:#313037} +.footer-label.master-label{background:#30353a} +.status-bar{height:25px;flex:none;display:flex;align-items:center;gap:13px;padding:0 11px;background:#292b2c;border-top:1px solid #111;font-size:10px;color:#9aa0a2} +.status-bar .state{color:#9ec8d0} +.status-bar .last-action{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} +.status-bar .warning{margin-left:auto;color:#d8b981;font-weight:600} +::-webkit-scrollbar{height:11px;width:9px} +::-webkit-scrollbar-track{background:#262728} +::-webkit-scrollbar-thumb{background:#55585b;border:2px solid #292a2b;border-radius:6px} +@media(max-height:750px){.console-body{--route-h:54px;--fx-h:105px;--send-h:82px;--eq-h:43px;--pan-h:32px;--trim-h:22px;--switch-h:29px;--footer-h:45px}.fxslot-row{height:18px;min-height:18px;flex-basis:18px}.fx-section .subhead{height:18px}.footer-label{height:26px}.db-value{height:14px}.eq-line{height:20px}} +@media(max-width:1000px){.short-help{display:none}.strip{width:98px;flex-basis:98px}} +@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition:none!important;animation:none!important}} +@media(max-height:610px){.console-body{--route-h:54px;--fx-h:80px;--send-h:60px;--eq-h:27px;--pan-h:28px;--trim-h:18px;--switch-h:25px;--footer-h:42px}.send-pan{display:none}.fxslot-row{height:15px}.fx-section .subhead,.send-header{height:16px}.eq-line{display:none}.eq-header{height:25px}} + +/* Single-window plugin browser: light solid overlay, no blur/animated shadows. */ +.plugin-browser[hidden]{display:none!important} +.plugin-browser{position:absolute;z-index:20;top:24px;bottom:0;right:111px;width:min(350px,calc(100% - 148px));display:flex;flex-direction:column;background:#282b2d;border-left:1px solid #55646a;border-top:1px solid #55646a;box-shadow:-4px 1px 8px #151617b8;color:#c9ccce;min-height:0} +.plugin-head{height:47px;flex:none;border-bottom:1px solid #16191a;display:flex;align-items:center;padding:7px 10px;background:#313638} +.plugin-head-title{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px;font-size:11px;letter-spacing:.035em} +.plugin-target{font-size:10px;color:#81b5c7;letter-spacing:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} +.plugin-close{background:transparent;border:0;color:#aeb7bc;font-size:23px;width:24px;height:26px;line-height:24px} +.plugin-close:hover{color:#fff;background:#4b5052} +.plugin-search-row{height:41px;display:flex;align-items:center;padding:5px 9px;flex:none} +.plugin-search-row input{min-width:0;width:100%;height:29px;border:1px solid #485156;border-radius:2px;padding:4px 8px;background:#171c1e;color:#e1e7e9;outline-offset:0} +.plugin-filters{height:34px;display:flex;gap:6px;padding:0 9px 6px;flex:none} +.plugin-filters select{min-width:0;flex:1;height:26px;background:#33383a;color:#cbd0d2;border:1px solid #505559;padding:0 4px;font-size:10px} +.plugin-headings{height:22px;flex:none;padding:4px 9px;display:flex;justify-content:space-between;color:#89989e;font-size:9px;border-bottom:1px solid #171a1c} +.plugin-results{flex:1;min-height:0;overflow-y:auto;background:#25282a} +.plugin-item{min-height:48px;padding:5px 7px;border-bottom:1px solid #1a1c1d;display:flex;gap:5px;align-items:center} +.plugin-item:hover{background:#30383b} +.plugin-choose{flex:1;min-width:0;background:transparent;border:0;padding:3px 1px;text-align:left;display:flex;flex-direction:column;gap:4px} +.plugin-name{font-size:11px;color:#e0e3e4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%} +.plugin-meta{font-size:9px;color:#899da6;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} +.plugin-labels{display:flex;flex-direction:column;align-items:flex-end;gap:4px;flex:none;font-size:9px;color:#87969c} +.plugin-pill{color:#a6b6bb;border:1px solid #495156;padding:1px 4px;border-radius:2px} +.plugin-pill.problem{color:#da9990;border-color:#85554f} +.plugin-flag{width:21px;height:22px;background:transparent;border:0;color:#777e82;font-size:15px;flex:none;padding:0} +.plugin-flag.starred{color:#d3b86b} +.plugin-flag:hover{background:#465055;color:#e6e9eb} +.plugin-item.disabled .plugin-choose{opacity:.5} +.plugin-empty{padding:20px 12px;text-align:center;color:#88979b;font-size:11px} +.plugin-footer{height:36px;flex:none;display:flex;align-items:center;padding:0 7px;gap:6px;border-top:1px solid #181a1b;font-size:10px} +.plugin-footer span{flex:1;color:#a0afb6} +.plugin-footer button{background:#393d40;border:1px solid #4f575b;color:#bcc6ca;border-radius:2px;padding:4px 6px;font-size:10px} +.plugin-footer button:disabled{color:#657175;opacity:1;cursor:not-allowed} +.plugin-disclaimer{padding:7px 9px;flex:none;color:#c2ac85;background:#35322d;font-size:9px;line-height:1.3} +.fxslot-list{height:auto;flex:1 1 0;min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#485052 #282b2d} +.fxslot-row{cursor:default} +.fx-pick{flex:1 1 0;min-width:0;max-width:100%;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;appearance:none;background:transparent;border:0;height:18px;padding:0 2px;color:#bdcad0;font-size:10px;cursor:pointer} +.fx-pick.empty{color:#7c8589} +.fx-pick:hover,.fx-pick:focus-visible{background:#3d4c52} +.fx-remove{height:17px;width:14px;flex:0 0 14px;padding:0;border:0;background:transparent;color:#657379;cursor:pointer} +.fx-remove:hover{background:#553a38;color:#f4c1b9} +@media(max-width:940px){.plugin-browser{right:111px;width:min(310px,calc(100% - 148px))}} + + +.more-tools{margin-left:auto;position:relative;flex:none} +.more-tools summary{list-style:none;cursor:pointer;white-space:nowrap;user-select:none} +.more-tools summary::-webkit-details-marker{display:none} +.more-tools[open] summary{color:#d7e8eb;background:#405159} +.more-tools-panel{position:absolute;z-index:35;right:0;top:calc(100% + 6px);width:278px;max-height:min(460px,calc(100vh - 138px));overflow:auto;background:#303436;border:1px solid #596167;box-shadow:0 4px 12px #111b;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;padding:9px} +.more-tools-panel .tool,.more-tools-panel .toolbar-select{width:100%;max-width:none;min-width:0;margin:0} +.more-tools-caption{grid-column:1 / -1;font-size:9px;color:#8fa1a8;letter-spacing:.08em;padding:5px 0 0;border-bottom:1px solid #434c50} +@media(max-width:900px){.command-bar{padding:0 5px;gap:4px}.command-bar .toolbar-label{display:none}.command-bar .tool{padding:4px 6px}.command-bar .toolbar-select{max-width:86px}.command-bar .sep{margin:0 1px}} + + +/* Shared mixer geometry: one row height per section across rail, tracks and Master. */ +.rail-cell[data-section]::after{content:"▾";position:absolute;right:2px;top:50%;transform:translateY(-50%);color:#778b94;font:8px/1 Arial,sans-serif} +.rail-cell[data-section].collapsed::after{content:"▸";color:#7eb5c5} +.rail-cell[data-section].collapsed{background:#303637} +.console-body.collapsed-fx .fxslot-list,.console-body.narrow .fxslot-list{display:none} +.console-body.collapsed-fx .fx-section,.console-body.collapsed-eq .eq-section{padding-bottom:0} +.console-body.collapsed-send .send-header .send-slot,.console-body.collapsed-send .send-header .pre{display:none} +.console-body.collapsed-route .route-top{height:17px;min-height:17px;flex-basis:17px} +.console-body.collapsed-fx .subhead,.console-body.collapsed-send .send-header,.console-body.collapsed-eq .eq-header{border-bottom:0} +.send-header .pre{width:23px;min-width:23px;flex:0 0 23px;font-size:9px} +.send-header .power{flex:0 0 17px} +.fx-section .subhead .power{flex:0 0 17px} +.fxslot-row .mini{flex:0 0 16px;width:16px} +.fxslot-row .fx-remove{flex:0 0 13px;width:13px} +@media(max-height:750px){ + .fx-section .subhead{height:20px;min-height:20px;flex-basis:20px} + .eq-header{height:19px;min-height:19px;flex-basis:19px} +} +@media(max-height:610px){ + .fx-section .subhead,.send-header{height:19px;min-height:19px;flex-basis:19px} + .eq-header{height:20px;min-height:20px;flex-basis:20px} + .fxslot-row{height:18px;min-height:18px;flex-basis:18px} +} + +.send-compact{display:none;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:9px;color:#b4c0c5} +.console-body.collapsed-send .send-compact{display:block;flex:1 1 0} +.console-body.collapsed-send .send-header .push{display:none} +.fxslot-list::-webkit-scrollbar{width:4px} +.fxslot-list::-webkit-scrollbar-thumb{background:#47545a;border-radius:2px} +.fxslot-list::-webkit-scrollbar-track{background:#27292b} +.console-body.narrow .rail-cell[data-section="fx"]::after, +.console-body.narrow .rail-cell[data-section="send"]::after, +.console-body.narrow .rail-cell[data-section="eq"]::after{content:"▸"} + +/* ArSonMix operator-first tactile Console v2. + Three density presets, lightweight composited CSS: no blur, canvas, external assets. + Keep shared height tokens identical across rail / tracks / pinned Master. */ +.console-body{ + --strip-w:150px;--master-w:152px; + --route-h:74px;--fx-h:112px;--send-h:80px;--eq-h:44px; + --pan-h:41px;--trim-h:30px;--switch-h:43px;--footer-h:54px; + --rail-w:32px; +} +.console-body[data-density="standard"]{--strip-w:125px;--master-w:132px;--switch-h:39px;--pan-h:36px;--trim-h:27px;--route-h:70px} +.console-body[data-density="compact"]{--strip-w:105px;--master-w:116px;--switch-h:32px;--route-h:58px;--pan-h:30px;--trim-h:23px} +.console-body .section-rail{width:var(--rail-w);min-width:var(--rail-w);flex:0 0 var(--rail-w)} +.console-body .strip,.console-body.narrow .strip:not(.master){ + width:var(--strip-w);min-width:var(--strip-w);flex:0 0 var(--strip-w); +} +.console-body #master{width:var(--master-w);min-width:var(--master-w);flex:0 0 var(--master-w);overflow:hidden} +.console-body #master .strip.master{ + width:var(--master-w);min-width:var(--master-w);flex:0 0 var(--master-w); +} +.console-pane{--master-w:152px} +.plugin-browser{right:var(--master-w)!important} +.console-body .strip{ + --surface:#24282c; + background:linear-gradient(90deg,#1a2024 0%,var(--surface) 7%,#2e3032 52%,#202428 100%); + border-right:2px solid #151a1d;box-shadow:inset 1px 0 rgba(231,245,255,.12); +} +.console-body .strip.audio{--surface:#22292d} +.console-body .strip.bus{--surface:#2d2633} +.console-body .strip.fx{--surface:#292633} +.console-body .strip.master{--surface:#2b3034} +.console-body .strip.selected{box-shadow:inset 3px 0 #91c8d8,inset 1px 0 #a2c1ca;background-color:#283a40} +.console-body .section{border-bottom:1px solid #14191b;box-shadow:inset 0 -1px rgba(184,198,203,.08)} +.density-select{background:#343e43;border:1px solid #59676b;color:#d6e3e7;border-radius:3px;font:11px "Segoe UI",Arial,sans-serif;height:28px;padding:0 5px;min-width:100px} +.density-select:focus-visible{outline:2px solid #8fc8dd;outline-offset:1px} +.command-bar{height:43px;gap:9px} +.tool{min-height:27px} +.mixer-title{background:linear-gradient(#30363a,#22272a);border-bottom:1px solid #0f1518} +.console-body .rail-cell{color:#b2bcc1;background:#23282b} +.console-body .rail-cell[data-section]{cursor:pointer;font-size:15px} +.console-body .rail-cell[data-section]:hover{background:#394448} +.console-body .rail-cell[data-section].collapsed{background:#314149;color:#aee0f0} +.console-body .rail-cell.fader{letter-spacing:1px;color:#7b939e} +.console-body .route-section{height:var(--route-h);flex:0 0 var(--route-h);padding:3px 6px 4px;gap:2px} +.console-body .route-top{height:18px;min-height:18px;flex-basis:18px;border-bottom:1px solid #3d484d} +.console-body .route-field{display:grid;grid-template-columns:25px minmax(0,1fr);gap:4px;align-items:center;min-height:21px;min-width:0} +.console-body .route-caption{font-size:10px;letter-spacing:.04em;color:#8eabb6;text-align:left} +.console-body .route-identity{display:block;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#bccad0;font-size:10px;background:#1c2529;border:1px solid #3e494e;border-radius:2px;padding:3px 5px} +.console-body .route-select{display:block;width:100%;min-width:0;max-width:100%;height:23px;flex:none;border:1px solid #455159;border-radius:2px;background-color:#1a2226;color:#e4ebed;padding:0 15px 0 5px;font-size:11px;text-overflow:ellipsis;white-space:nowrap} +.console-body .route-select:hover{background-color:#293943} +.console-body.collapsed-route .route-field{display:none} +.console-body.collapsed-route .route-section{padding:2px 6px} +.console-body.collapsed-route .route-top{height:18px;min-height:18px;flex-basis:18px;border:0} +.console-body.collapsed-route .route-select{display:none} +.console-body .format-badge{width:auto;min-width:26px;flex:0 0 auto;border-radius:2px;color:#d0ebf3;background:#263b44;font-size:10px;padding:0 3px} +.console-body .subhead,.console-body .send-header,.console-body .eq-header{color:#b8c9d0;white-space:nowrap} +.console-body .fxslot-row{padding:0 1px} +.console-body .fx-pick{font-size:10.5px;color:#ced9dd} +.console-body .fxslot-row:hover{background:#333d42} +.console-body .fxslot-row .power{color:#c4dce1} +.console-body .send-select{font-size:11px;background:#222e34;color:#d6e0e5} +.console-body .sendlevel input{accent-color:#8bbed0} +.console-body .send-compact{font-size:10px} +.console-body .eq-line{background:#202c31;border-radius:2px;border:1px solid #42555e} +.console-body .eq-header{height:21px;min-height:21px;flex-basis:21px} +.console-body .pan-section{height:var(--pan-h);flex:0 0 var(--pan-h);display:grid;grid-template-columns:17px minmax(0,1fr) 29px;gap:5px;padding:0 7px;background:linear-gradient(#292c2e,#25272a)} +.console-body .pan-section output{font-size:11px;text-align:right;color:#a0dff0} +.console-body .pan-icon{color:#c0d0d5} +.console-body .pan-control{height:23px;max-width:none} +.console-body .center-pan{height:23px!important;width:100%!important;min-width:0} +.console-body .center-pan::-webkit-slider-runnable-track{height:7px;border:1px solid #0c1317;border-radius:4px;box-shadow:inset 0 1px 2px #060a0d;background:linear-gradient(to right,#0d1519 0,#0d1519 var(--pan-start),#4fb2d1 var(--pan-start),#4fb2d1 var(--pan-end),#0d1519 var(--pan-end),#0d1519 100%)} +.console-body .center-pan::-webkit-slider-thumb{width:15px;height:19px;margin-top:-7px;border:1px solid #344b55;border-radius:3px;background:linear-gradient(#f0f5f7,#9bafba 47%,#556e7e 49%,#dce6e9 65%,#728f9f);box-shadow:0 1px 2px #111} +.console-body .center-pan::-moz-range-thumb{width:15px;height:19px;border-radius:3px;border:1px solid #344b55;background:linear-gradient(#f0f5f7,#9bafba 47%,#556e7e)} +.console-body .trim-section{height:var(--trim-h);flex:0 0 var(--trim-h);padding:1px 7px;gap:5px;background:#22282b} +.console-body .trim-label{font-size:10px;color:#9cb0b7} +.console-body .trim-control{height:16px;min-width:0;accent-color:#9abac5} +.console-body .trim-value{font-size:10px;color:#d3e3e8;min-width:32px} +.console-body .switch-section{height:var(--switch-h);flex:0 0 var(--switch-h);display:flex;align-items:center;justify-content:space-around;gap:3px;padding:4px 5px;background:linear-gradient(#36393b,#22282b)} +.console-body .switch{height:30px;min-height:30px;min-width:0;flex:1 1 auto;border:1px solid #13191d;border-radius:3px;font-size:11px;color:#e3e7e7;background:linear-gradient(#62676a 0%,#393f43 45%,#242b30 48%,#3c4347);box-shadow:inset 0 1px rgba(235,244,255,.25),0 2px #101517;padding:0 2px} +.console-body .switch-full{display:inline} +.console-body .switch-short{display:none} +.console-body .switch.on.mute{color:#fff;background:linear-gradient(#e85d5a,#aa252b 53%,#7b1d24);border-color:#b63d3f} +.console-body .switch.on.solo{color:#171919;background:linear-gradient(#f9e9a0,#c0a944 50%,#88751d);border-color:#ac9641} +.console-body .switch.on.cue{color:#092028;background:linear-gradient(#b5eaf1,#499ab3 58%,#22728d)} +.console-body .switch.on.mon{color:#fff;background:linear-gradient(#87b8cd,#387a95)} +.console-body .fader-section{ + flex:1 1 0;min-height:118px;display:flex;flex-direction:column; + gap:5px;padding:6px 7px 5px;overflow:hidden; + background:linear-gradient(90deg,#1c2226 0%,#283039 8%,#252b30 82%,#151b1f 100%); +} +.console-body .fader-head{ + height:37px;min-height:37px;display:flex;align-items:center;gap:4px; + padding:3px 4px;border:1px solid #10161a;border-radius:4px; + background:linear-gradient(#080f12,#172328 44%,#0d171d); + box-shadow:inset 0 1px 3px #030708,0 1px rgba(224,244,255,.12); +} +.console-body .fader-readout{ + min-width:0;flex:1;text-align:center;white-space:nowrap;overflow:hidden; + font-family:Consolas,"Segoe UI",monospace;font-size:16px;line-height:24px; + font-variant-numeric:tabular-nums;letter-spacing:-.025em; + color:#5fe5f0;text-shadow:0 0 5px rgba(76,200,221,.2); +} +.console-body .clip-indicator{ + flex:0 0 auto;font-size:8px;letter-spacing:.02em;border:1px solid #66332f; + color:#874841;background:#281a1a;border-radius:2px;padding:4px 2px; +} +.console-body .clip-indicator.clipping{background:#e8473a;border-color:#ff8c7b;color:#fff} +.console-body .fader-workspace{ + flex:1 1 0;min-height:0;min-width:0;display:grid; + grid-template-columns:23px minmax(56px,1fr) 24px; + gap:5px;align-items:stretch;overflow:hidden; +} +.console-body .fader-scale{ + width:auto;min-width:0;min-height:0;display:flex;flex-direction:column; + align-items:flex-end;justify-content:space-between;text-align:right;padding:11px 0 14px; + color:#a3afb3;font-size:10px;line-height:1;font-variant-numeric:tabular-nums; +} +.console-body .fader-box{ + position:relative;width:100%;min-width:0;height:100%;display:flex; + justify-content:center;align-items:center;overflow:hidden; + border:1px solid #10171c;border-radius:7px; + background:linear-gradient(90deg,#151d22 0%,#343b42 12%,#262b31 31%,#171c21 50%,#2c3238 69%,#343c43 88%,#11171b 100%); + box-shadow:inset 2px 0 4px #090f12,inset -2px 0 5px #080e11,0 1px rgba(234,246,255,.13); +} +.console-body .fader-box:before{ + content:"";position:absolute;z-index:0;top:14px;bottom:16px; + left:50%;width:10px;transform:translateX(-50%); + background:linear-gradient(90deg,#04080b,#151c20 35%,#050a0c 80%); + border:1px solid #090d10;border-radius:4px; + box-shadow:inset 1px 0 2px #000,1px 0 1px #566169; +} +.console-body .fader-box:after{ + content:"";position:absolute;left:50%;bottom:16px;z-index:1; + transform:translateX(-50%);width:3px;height:var(--fader-fill,0%); + max-height:calc(100% - 33px); + background:var(--track-color,#68b6d2); + box-shadow:0 0 4px var(--track-color,#68b6d2);pointer-events:none; +} +.console-body .fader{ + position:relative;z-index:3;display:block; + height:calc(100% - 31px);width:54px;max-width:100%;margin:0; + writing-mode:vertical-lr;direction:rtl;appearance:none;-webkit-appearance:none; + background:transparent;cursor:ns-resize;touch-action:none; +} +.console-body .fader::-webkit-slider-runnable-track{background:transparent;border:0} +.console-body .fader::-moz-range-track{background:transparent;border:0} +.console-body .fader::-webkit-slider-thumb{ + -webkit-appearance:none;appearance:none;width:48px;height:27px; + border:1px solid #11191d;border-radius:4px; + background: + repeating-linear-gradient(to bottom,transparent 0,transparent 5px,rgba(28,40,49,.55) 5px,rgba(28,40,49,.55) 6px,transparent 6px,transparent 9px), + linear-gradient(to bottom,#f2f5f6 0%,#d1dbe0 18%,#7d99a8 43%,#425766 49%,#f7f9f8 54%,#9eb1bb 75%,#576f7c 100%); + box-shadow:0 2px 4px #06090b,inset 0 1px #f9ffff;cursor:ns-resize; +} +.console-body .fader::-moz-range-thumb{ + width:48px;height:27px;border-radius:4px;border:1px solid #131a1d; + background:linear-gradient(#f4f7f8,#98adbb 45%,#425766 49%,#eaf2f4 55%,#647e8d); + box-shadow:0 2px 4px #090d10;cursor:ns-resize; +} +.console-body .strip.master .fader::-webkit-slider-thumb{ + background:linear-gradient(#fff1c5,#e2cb8c 35%,#8a7650 47%,#fef1c4 55%,#a99160); +} +.console-body .meter-box{ + width:24px;min-width:0;max-width:24px;height:100%;margin:0; + padding:15px 0 13px;display:flex;gap:2px;position:relative; + background:linear-gradient(90deg,#1a2328,#2b343a,#151b1f); + border:1px solid #0f161a;border-radius:4px; + box-shadow:inset 1px 1px 2px #060a0d; +} +.console-body .meter-lane{ + min-width:0;flex:1;height:100%;position:relative;overflow:hidden; + border:1px solid #0c1114;border-radius:1px; + background:#0a100f;box-shadow:inset 0 0 0 1px #273030; +} +.console-body .meter-fill{ + position:absolute;inset:0 1px;height:100%; + background:linear-gradient(to top,#2b995f 0%,#63c87c 65%,#e5d657 85%,#fa9b42 94%,#ec4a40 100%); + clip-path:inset(calc(100% - var(--lit,0%)) 0 0); +} +.console-body .meter-lane:before{ + content:"";position:absolute;inset:0;z-index:2; + background:repeating-linear-gradient(to top,transparent 0,transparent 6px,#080d0a 6px,#080d0a 8px); + pointer-events:none; +} +.console-body .meter-box.mono .meter-lane{max-width:none;margin:0 auto;width:11px;flex:0 0 11px} +.console-body .peak{position:absolute;left:3px;right:3px;top:3px;width:auto;height:7px;background:#481c19;opacity:1;border:1px solid #6e3029;border-radius:1px} +.console-body .peak.clipping{background:#ff493c;box-shadow:0 0 4px #ff493c;border-color:#ef968f} +.console-body .bottom-section{ + height:var(--footer-h);flex:0 0 var(--footer-h); + padding:0 4px 4px;background:linear-gradient(#22282b,#30373c); +} +.console-body .db-value{height:17px;min-height:17px;font-size:11px;color:#9dd8e7;font-variant-numeric:tabular-nums} +.console-body .footer-label{height:31px;background:#313a3f;border:1px solid #172127;border-radius:3px;overflow:hidden} +.console-body .footer-label .name{font-size:12px;line-height:18px;color:#f1f4f4;padding:3px 3px 1px;font-weight:500} +.console-body .footer-label .color-strip{height:5px;flex:0 0 5px;background:var(--track-color)} +.console-body .strip.bus .footer-label{background:#3c3141} +.console-body .strip.fx .footer-label{background:#383143} +.console-body .strip.master .footer-label{background:#4a3e2c} +.console-body .strip.master .fader-readout{color:#ffdc82} +.console-body .strip.master .clip-indicator{border-color:#96664c} +.console-body.collapsed-fx .fx-section,.console-body.collapsed-send .send-section,.console-body.collapsed-eq .eq-section{padding-bottom:0} +.console-body.collapsed-fx .fxslot-list,.console-body.narrow .fxslot-list{display:none} +.console-body.collapsed-send .send-section .send-select,.console-body.collapsed-send .send-section .sendlevel{display:none} +.console-body.collapsed-eq .eq-section .eq-line{display:none} +.console-body.narrow .send-section .send-select,.console-body.narrow .sendlevel,.console-body.narrow .eq-line{display:none} +.console-body.collapsed-fx .subhead,.console-body.collapsed-send .send-header,.console-body.collapsed-eq .eq-header{height:22px;min-height:22px;flex:0 0 22px;overflow:hidden} +.console-body[data-density="standard"] .fader-readout{font-size:14px} +.console-body[data-density="standard"] .fader-workspace{grid-template-columns:20px minmax(43px,1fr) 21px;gap:3px} +.console-body[data-density="standard"] .fader::-webkit-slider-thumb{width:40px;height:24px} +.console-body[data-density="standard"] .fader::-moz-range-thumb{width:40px;height:24px} +.console-body[data-density="standard"] .switch{font-size:10px} +.console-body[data-density="standard"] .switch-full{display:none} +.console-body[data-density="standard"] .switch-short{display:inline} +.console-body[data-density="compact"] .fader-readout{font-size:12px} +.console-body[data-density="compact"] .fader-workspace{grid-template-columns:16px minmax(35px,1fr) 19px;gap:2px} +.console-body[data-density="compact"] .fader::-webkit-slider-thumb{width:32px;height:19px} +.console-body[data-density="compact"] .fader::-moz-range-thumb{width:32px;height:19px} +.console-body[data-density="compact"] .switch{height:23px;min-height:23px;font-size:9px} +.console-body[data-density="compact"] .switch-full{display:none} +.console-body[data-density="compact"] .switch-short{display:inline} +.console-body[data-density="compact"] .pan-section{grid-template-columns:12px minmax(0,1fr) 18px;gap:1px;padding:0 3px} +.console-body[data-density="compact"] .trim-section{padding:0 3px;gap:1px} +.console-body[data-density="compact"] .route-section{padding:2px 3px} +.console-body[data-density="compact"] .route-field{grid-template-columns:19px minmax(0,1fr);gap:1px} +.console-body[data-density="compact"] .route-select{font-size:9px} +.console-body[data-density="compact"] .fader-section{padding:4px 2px;gap:3px} +@media(max-height:750px){ + .console-body{--route-h:68px;--fx-h:90px;--send-h:72px;--eq-h:38px;--pan-h:36px;--trim-h:27px;--switch-h:38px;--footer-h:48px} + .console-body .fader-head{height:31px;min-height:31px} + .console-body .fader-readout{font-size:13px} + .console-body .fader-workspace{grid-template-columns:20px minmax(38px,1fr) 21px;gap:3px} + .console-body .switch{height:26px;min-height:26px} +} +@media(max-height:610px){ + .console-body{--route-h:65px;--fx-h:65px;--send-h:54px;--eq-h:23px;--pan-h:30px;--trim-h:23px;--switch-h:33px;--footer-h:44px} + .console-body .fader-section{min-height:86px} + .console-body .fader-head{height:27px;min-height:27px} + .console-body .fader-readout{font-size:12px} + .console-body .fader-workspace{grid-template-columns:18px minmax(35px,1fr) 19px;gap:2px} + .console-body .fader::-webkit-slider-thumb{width:36px;height:22px} + .console-body .fader::-moz-range-thumb{width:36px;height:22px} +} + +/* Unified folding precedence — density presets never defeat collapsed sections. */ +.console-body.collapsed-route{--route-h:23px} +.console-body.collapsed-fx{--fx-h:23px} +.console-body.collapsed-send{--send-h:23px} +.console-body.collapsed-eq{--eq-h:23px} + +/* Fader readout is in the upper LCD: don't duplicate numbers at the footer. */ +.console-body .bottom-section .db-value{display:none} +.console-body .footer-label{height:calc(100% - 3px);min-height:0} +.console-body .footer-label .name{display:flex;flex:1;min-height:0;align-items:center;justify-content:center} + +/* Comfort hit-target and channel-role fader accents (iGPU-safe static paint). */ +.console-body[data-density="comfort"] .fxslot-row{height:24px;min-height:24px;flex-basis:24px;gap:3px} +.console-body[data-density="comfort"] .fxslot-row .mini{width:20px;height:20px;flex:0 0 20px;line-height:20px} +.console-body[data-density="comfort"] .fxslot-row .fx-remove{width:19px;height:20px;flex:0 0 19px;font-size:14px} +.console-body[data-density="comfort"] .fx-pick{font-size:11px;height:22px} +.console-body[data-density="comfort"] .eq-header .mini,.console-body[data-density="comfort"] .send-header .mini{height:21px;min-width:20px;line-height:21px} +.console-body .strip:not(.master) .fader::-webkit-slider-thumb{ + background: + repeating-linear-gradient(to bottom,transparent 0,transparent 5px,rgba(25,33,43,.45) 5px,rgba(25,33,43,.45) 6px,transparent 6px,transparent 9px), + linear-gradient(#f3f7f8 0%,#d2dbdf 21%,color-mix(in srgb,var(--track-color) 35%,#7897aa) 44%,#405763 48%,#f0f6f7 55%,color-mix(in srgb,var(--track-color) 45%,#94a6b1) 79%,#526a78 100%); +} +.console-body .strip:not(.master) .fader::-moz-range-thumb{ + background:linear-gradient(#f2f6f7,#bacad0 25%,color-mix(in srgb,var(--track-color) 40%,#718c9c) 45%,#415560 50%,#cddbe0 60%,#6c8491); +} +.console-body .fader:focus-visible{outline:2px solid #9ce1ee;outline-offset:-2px} +.console-body .switch:focus-visible,.console-body .route-select:focus-visible{outline:2px solid #7ecae3;outline-offset:0} +.console-body .rail-cell.fader{min-height:118px} +@media(max-height:610px){.console-body .rail-cell.fader{min-height:86px}} +:root{--ari-silver:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAABNCAYAAADO+8YKAAAOoElEQVR42qVazYsl13X/nXvPvVWvp7tHo+nuGc2MNLJkUCLFMlokRLEhZJGNF1kEkoUNWZrYiWwwXoWQP8AEQ0K0CMk6HwRCIMYkkGUggRDkIOKRZI00siVNT3fPTH++V1X343hxb329j54Z+UHx6r1Xr+rc8/k7v3Pp61//wzeLwnzDex9FRBERARARABCkFw3Oxy+R4c/Lr3n0i6IxTCGEv2WR+LqIUIyRiIiyJJRuL4/3oM8qR7eoSAAUEf0GG8OlUhpaC4hWaAAAUX++sD4AkrW07B79VfO/U/6zELOBSCxYKTXJS1x6q+ENznsYDe6w/Dpa8Rv19hBZYyKyMcaBeeZ9huZsQ49tMxlpTEYan78uHdFyCMHEKBCJC6t5tGae1FdWO1uMBCJiJlK2KHR3MRGBiAAiDMINIoI28obfLTczDd4J6Xb9PXtNCWIUAAIigohoVkoZZkYIkQCB9x7eewTvEQdCKqW6g0hBKYJSunt4axaR9BCRiBAjJEbEEBFjhEiEAFBKgTXDGANjDYiIlNKIUTQ71+jgHUgpAMDTW9vY3t7G5e0dXLx4EZO1NRRFCWMNmBlaaZBSUO2Kh94sAmm1GZMQIQZ47+GaBtWswnR6hsOHD7C3u4u9vT08uH8AEUFZFlhbW1dMSqlLl7eglcJLr7yK3/7KV2C1xju3foy93bu4f3CAuqrQ1DWca+CcRwgeMYS8ahmbLpt8qFGtGWwY1hYoygme+9zn8Tu/+3uofcA//+M/4K3/+S9sbD4FrZSi7/35993vf/Vr/E9//3cQABubm7h/cID7e/cACJh5ZJokQEzmzBpBFqo9YoyQKAgxIHiPpnGomxpN3cB7D82MGzefxzPXruPB/QO4psYb3/ku/v0H/1rTG9/6ltvZucLTs1OE4CECMKfVJDMKZOATrVZGAZAFjSHAhwDvHJzz8N7B+wAfPGKIXSSLCJqmhvch+yThl375ZXjnanbOyfTsFEQErbmLDOeapVlSKw2lFZTS6WZKgUAQifAhwDkHkEKIAvEeMTt1CPm8WxCBmTsfPD05hrWF8NbO1fjar76OD99/B01VgY2FUjTnqNLlY1IEorQqyquDAFEEsXVg5+CaBs57xOARo3SZvA38VstRIi6sb+CVL76Gd9/+kXBZTmRr5ypCCAghwBiTfSb9KYTkB963jhwQsx+l5J4yvIik72PIYZ9qo1Iamg2sNWBjs08qiKBbADPjypVruP3urcgiEoP3WN/YyFZRXTJrwzfE0AnWCh5DSM49yPJ9tFHnAmwYzCa/LwZIjBEEwHsPCUEYIgEAlOJRlk3nggiCajOrlnFEBQFR8odWI0mYHO6ss1DpPfmdHuQugVI6lXsiEoEwgJB/llaatrRKNkkb6iEkx02Z3A1yUczXIpeJlHtajeugoFSEiOocuhce3X+hEDn29aEvdG2uiSk6vHPwzqFxTT5v+vLSCZRrHbXm0mA2MLaALwrYooCxFswGWusu3EeFXES4aWo5OnzQ2b4TJDuy9zliXJMEcQ7eu5EfSXbimIWSNkcpBWYDay1sUaJYIZgIYAzDuyB8cnwo77z9FmxZ5nwiOV+EPqqyaWIbQYOS0R3I9Usk5Z2cc6JIThcKWut0MCef0hqKCDFGrK9fwPTsWLiuZvHBwR6MMYuQq4UZc2hK5vCN5DIS26jMkehzVKb3YVKUAVBLJ9evX0eIUVgEwjn3pEhZjgiXNxfSfW6dP4bQQZTWP2IUxJiitnWJoXaJCGwMYl2DlVJiNGenXgVRH4kFMwQVRKUQQxgX4q5ktFl+DOyUUjDMcI0TJlKDdmMIxJ9EMMqoD0BUECUDMEf9gR5JDq3RRptIFF4E6pT19GTaSg9J96HVelyAuWNcLa1AY2wLyeLQCqEGRXJZ5yF9jzHylYXOYQBj2lTMRCIxg6muog+y6DIzrmqs2whq03wc5aexUDSfjGO6jnvn6z2e2hogvQjjVE8YVJqRQFEEsSu6+YiLMLdVZXIf6tADY061C+0gDZo+SI6UYRIgYIl5UjkZI8xhnyutNJI/50czkGBCjBGhdcjByofdZ+vsgrZnG/pO1k5ufZb5zQhJZIgiIh0yICKw0gqTC+uQsxOQ91BKjSUYJL9lff/KZpQGMETrQaj3eAkQhBDBxmDtwgamZzOwMRaXLm8jBI+mrmCM7XEyxiZokeEosgZZWmV/CUp12Eczg6N0+m3hcVv7mrpCUU7w9NY2Dg8fJIG2r1zF6ckhYowo1y50lZiIuvo0n/JHLdDQB0edKxBj7DuUwUKD92hcAwGwdmEd21eewcc/vSOsjcGlp7fwiS1RVzXKcoJiMoG1BbTWA6iZHTUOerJBpYf0BbPF2XEO0vZmCqiqCrPpGeoqaejS5a2EoSZra3jm+g3cuf0egne4+NQlrG9sYnJhHdYWUFp1pEMrGOY0IoN6tpztoC4oQwho6gqnpyc4OnyIajbD5uYmnrl2A2tr6+D9e7vy4e338eknH+P4+BC1C1jfOMXa+jqKogRr3fX9i4yHYEQrjT7PnSOZzzuPqqpwenKMo6OH2N/fh3MeH35wG7u7u0LFZHKnMPam915EhJRq1asWyYQnLLkyf9ZRljH7ZurlSCkxxpJr6p+yr2sE7zv1U0exET6TFI8iQkmG8nV5w2cSg6/fuKF2rl7D4eEDeOcT5jUGWnOKNNXDhs+onrGjx4gYApx3cM6hrmZgNtja2cbe3V3ib77xbf7j734HP/yXH+D+wT6eff4FbG9fxaXLl7G+sQlbGGhNaLvredSwksEeMMoiQBQg+Ii6qnF8fISD/T3s3v0U7797C9tXruBrf/BV/PVfvslMSAWta1uMhSksrC1gLMMYglZIAi1REj2CppZBj+eVgohFMdeBGDapqJKAiQADgA3DWAtbFFkYC2YFVoCm861Fj2E9IQAaiEbB2F6ooihgDIMTcw4mAAqAMSb3TiWstakX10kz6hdkX4fIgTXBWANbFCjLEkU5gbEW1HKZ7dXMJgtTwBgLrdW5wtA535/3m1IAaw1jkpbKcgJrTVesO0xtjEFRTrJ2kiOfx0/LZxh7ZCwGpSk9ryhQTiYwxnaQpO1/skCAsTa1uPTZ0s/jmE+pxJ4Za1FOkhJaFXUaYjYoJEWa0gogID5GFOEJujkZXKuy2cpyAmN1x5R0AinN0Jl4iiHAOZ3p/vm8MgZssiQFLBv4tHBVIPA+VfykCO5QBQHgEAVTAZzzaJzD6ekxnGsyIal6rBNlgH0GHcZ8Ilw6TRqMF1qC1DlUdeK/IRaVAEGEuJrNcOfOXezdu4umqXF89BBaKYDUHP8cF2YcMo9tRwTXEC9hRJomeixpaXp2iqIs8eFHN9DUNfjo8CH973//J+7f30fwHlrpTKcN2A9ZfOi4VRyMFDLx2TIgIbQzjwHobwc7AELwMMYgBo/Tk2NwNZvSndvvZdJclnSki6agFU1iR/21hFfH4IaOWxpOk3pOgGC0Ql1VxDFGVc2mmT5Z0Y3L6iwj8wK1Q5cQRkeMiz3aUPHVbIoYI1gENJ1OMZlMQEqN52MtI9apPPYzMyyfRA9naokXikv7srYlaoWaTqewtiAmAjVNg6IooLNALfEUQpxbZa/24UOWHYtwlwa9XE8lS2qJ0TQNmA1xSOPxruvr1d63w11fhvFEkVbUluFUKGaY2lJ6/XnIpk33LXYslFLEMUTyedFxOF6aZyvyw9UA8A9HlvOCtNptmdxuUpm13REb+fAJRhMbw9oYk+nlfvgGJKKbSFYX2UHjPxYmpLFUhqmtMK0/MafxprU2IwuNoihBBGKldRYodZVKKUg3viR4jy4zt+l+We811MwqYYhSUW2BmbX9MMYYAwGIW8gz5AEFAtKESATd0bh6ZM7VeWjR7Mun2DQgHToXUByjkIiAFEFlnrBlKqAAMA8eqMa+NUfLDUnMRDZEaK077cYY0TRpLNE0DawtYK1JuNpYkAixc04rRVjvSaPuWQoqCaX1IGri/KpG9C4zOgaWmfvIapNldmznchtUM5RSpJTCZFKmTF3XdQ7ruS0WNJwijofArSbno6/ViAj3tN6AjBiOLhJZpRFjRF1V8N4Tb21v08u/8gXcuX0b3rvM97WTwZhWSxqaAd0mytgPdM9LikOttpOlGEImsnpTWmvx61/6Mvbv7RJv7+zg117/En720R2E6HHj5gt47vkXYYsCB3u7+OjD23h4sA/fuLSqGBHbyMnpfyyQ6oXqppHJly5vX8HnX3oZz1y/jmpW4f13b+En7/w/TFHgy7/5W/iPf/sh+P333sXfvPkXKIoCSmvUVYXnPvciXn7hGgjA3cMz/OSdW9i/dxfVbIamqVHXNVx2zhBiV5e6DQRag3UaaTIzbFli5+o1vPKFL+LG1iYA4P/e+wg/fvtHCMFj/94u/ur730NZlqA/+dM/Cy+/+pra3/0U9/fuoq4q2LLE1tY21jc2sHnxItY3NlGW5aAj0Xm0lLVBQ3o6jiZCzjk0dY3ZdIqjo0M8uH+Ahw8e4tNPPsbpyQnYGFx79iZeefU1fPDerVO+sL4Rn3/xJXX12rM4PTmGa2pUszNMz84wqyocHX2MxjV5ehhGDFoP1lb09YOgUKqfMD51eQfXb76IC+sbKNfWcPGpS1JO1uhndz6I9I1v/tHswvpGKUBmPBSMyRPAskRhC7A1iXfMmwh6513s3ebhh3SlxHXaqutZ2k/SNGmE6r0QQL6pD9k1tdvbPSnH+4R6um4USd10p30fF9h+HwhGOFxWFOt+T1HS4mQyCay1btbW1iAiA2qdzu2zVm9kmmPbiM6d/gy1qrQCRDwDcF2p6JqtweYKWr2D6nEetvw3Wthsp4gQBZ4BNN2qFzQjOGfbWKvPc1vb5WPT9r79DopUbqjmKDIzetW89Uk3x9EjrqUVCxNRShMgUyag0pohAiFaustwcTR0/qRztTZltRa1VqjrpmYAb4nIq+n7Zai8pb9+sS2oIo/aUSgiEt/6OcuuSWScro4cAAAAAElFTkSuQmCC);--ari-rose:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAABNCAYAAADO+8YKAAAPQElEQVR42q1aTYxk11X+zr3n3vequqfnt7vtGceTOFbsEMuWAlkEw8I7NtkhJJBQ+FlEUTbZIFiAQEIChFA2iBWQVYQiBQmxQWKDWIUFBBMZOxkz/ht77J6ev+6e7q567957Dot7309VV8+PoaRSvap6evfc8/ud71z6k9/8tb+qK/fNEKOoqiEiAqCqAKDILxpdL75Ux3+vvufRLxLvmGJKf8Oq8lVVJREhIqIiCeXH6+Mt9Gnl6DclBMAQ0c+zc1wbY2GtwtDJm6UsZmi4Xn4ZAEpZW6ueMWgZIFr6LduDmB2sSsXWmEnZ4spHjRd42GI0WozocQUaCQWFqk6ZiLyIQKEjDdCS/4xtQ4+0mRlpd9iEDj63wgqqgKp4jik5EYWqnNhN/42ezCfklGvV051NhEBEzIaM95XtbyYiEBFAhFG4QVXRRd74t5XGIRp9EvLjhmcOmlKIKAAFEUFVLRtjHDMjJSFAEWNEiBEpRshISGPM8CYDYwjG2H7xziyqeRFVQRSBikCSQEQgKlAA1hiwZXjn4LwDEZExFiJquQ2tjTHAmGz5C5c2sbm5iXOb21g/ew5+bQ2umoC9h3EMYxhkzLBjGplYtWQJhXbCSEQKEalt0M5mmB8d4vD+XdzZ+QS7u7u4e/cOVBV1XWFtum6YjDEXLl6CNQbPf+kVvPy1Xwazxc5//xf2PvkIB7d30c7nCM0cMbSIISKlCEkJIlJMqQsOd0KjlsGO4XwFX0+x/dwL+Llf+TpiiPjh330Xr//7v2Fj4xysMYZ+8Kd/FF779d/mf/3ed6EA1jc2cO/OHdzdvQVAwcwLpskCSDbnWCOjt4hARRElIcWIpg2Yty2apkWICcwWn716FU9fvoJ7d+8gtA1+9Xd+H//xjz9o6Dvf/I2wtbXNx0eHSClCFWBmeF+BjMl+UXwiifRaWQiAIqikhJgSYghoQ0SMATEmhBQhaYhkUUXTNohRYEx+xktf/CJiCA23Iejx0SGICNZyHxkhtKvCB9ZYGGtgjIUxJvsTKDtxSgghAGSQRHNwiECSIqaYHVuKdkFgtiVPEQ4fHMD7Snlz6yl56Suv4qPrb6Gdz8HOwxhaclTt8zEZAlF26t65Ne9aJOUoDQGhbRFihKQIEQX1SZkWUoaoYG39DL7wys/i3Tf+U7muJ7qxfRlPpwRJsQhkuxqDlBIkhpwGUoJKghQ/yrW3fKrmnUsqYa8gQtYkOzjvYZ0HM4OMzZlZcnqxzDj/1DPga28Kq6pIjJhubBSzmD6ZqSoggiQREhMkxixgitCUsnOPsvwQbdS7gHUMyz5/OgdaDhAREIAUIzQlZaimLAcvZNl8rRBQruYWMNoVHYOkCiQFUfaHTiNZmBLubGGsg3UWpmgmR+xQL9XYXO6JSBXKAFL5WztputKqmjFRpylJgpQiYoyQGKB9Lir5qNQ9IptzDwAiA00GsNKnh84CgyVK6TUQlqE+jKpvNkNO+wGpDUghIIQGMQSk0CB15aUIhK7WlQxurQWzA/saqarAsQb7BOscjOUcoUSLhVxVuW0bPbp/Z6jyWkKzOHKMAbFtSpZukUJAjKH4UiqCa+/U3W67KGR28N7DVTWqqoKrarD3sDwIpgqwY8SQlB8c7Om7b/wIvq5LPtGSL1IpD6kvE9JF0Khk9G/k30U1m3aUc3K6MLDW5jczrGUYa2GJkESwvr6G46MD5fl8Jvfu7MI5dxJydTBjCdXrEr7R4uxSoialhJRSToz9p46y/BgM5otnr1xGElFWhbJzMMaWSFmNCFc3F9p/75xfUir+YXr/EMlJM2OerL2xdokI7BykacDGGHWWi1OfBlEf2TcUCKoQYyApLRZi6YTosvwS5DUGjhmhDcpERocIGwPxJxGMCuoDIAZqtIceXQE2RD2cNURII2t00aYqyieBOhU9PZm2sjnyc+gx2rdVriGinUCL2BZaxKFThBoVyVXL6dBjDBhpCX8XDN1rrEvFTKQqokiShoo+yqKrzHhaY91FUJfmRbIgMnLgsZFpZMbuXh6cb/B46jKuDiIspnrCqNIsCJQFkL7i5wJ6EuZ2qjSlw+zQA2NJtSfawQEWgaAlUsZJgLD8jC66ughbbpcoP2m0aepTHgMZJogIUueQo52rLmyoPKrr2ca+U7RTuo0T4H8ZSRSIoqowhmA5wxK21mCytg49egCKMbdDYwlGyW8FosWpzSgNMMRa2y8+mD5rOCaBcw7TtTM4PpqBnfM4d3ETKUW0zRzO+QEnY9EEHTJciKxRljbFX5LpMHeuW0m0128Hj7va1zRz1PUE5y9tYm/vXhbo/PZlHD3Yg4ignq6B2cFaW5ytK6ay2IeNW6CxD4461ySAiAwdymijKUa0oYUCmK6t4/z2Fdy88b6ydQ5nLm7B33gXzbxBVU/gJxN4X8NYO4KaI4ykI7DVNQF97z8QXbIEaTszpZTQzOeYHR+hmc9R1ROsX9rKGGoyneLcM1cxvf4TpBhw5twFTM+chV8/A+crkLUD6VCcticcxpqCnvCnMcbuglJSQpzPcHx4gAd79zCfzbCxsYFzV65iOl0H3761o7vXf4qdmx/i4GAPTUhYO/MAk/UzGUxZCxg7WkVW+NCq70vXAFQEMUS08xmOHhxgf/8+dm/fRggRu+9cw87OjtJaXb0/Zb7apqSqSrZ0kgYmb2yp0NITYYClKx1wVirlKonAGNKKHTWhvcG53449fDAgYLmGfTpEcko60JF8Qz1rQ0JICfzi5W3z7PYWdvf3EUJEXXlUzoGNBVsLMshCfnr1FCZNAaWCjRKaGNGEiNl8DseMK5sXcGPnNvEffOsb/LXf+0P8+O+/j707u9j+3PM4u3kFa5e24DfOwdYexhp0DcJj03tjRrlEnEZBnM0w37+PB7uf4N7HH+GDa2/i4vY2fvG3voF//s6fMRMAC8BYhmUHdhVsXcFWNWzlYJ1BTt60Ukn0CJq6S4lGATEWkBpcT+CqGq6q4LyHY5+LKimYKFdYWwglrmqwr2F9BcMW1hAMPdxa9BjWUyLAKsQbWF/B1RO4uoavKrDjrBQiMHUX3oOrutB3FYxzMDlZ9zTvp33RmM6xBtZ72KqGryfwdV6vh7rd3ZYdfDUBV1k7xAaG6P8szLJgZADDDOsquGqCqp6CveuLdb8eOw83mRZy08FY8+nC/VGaIgJZgvUerq5RTbKGuju6/gfWObhas3Ys5xYd//+vrCWTteQ9/GQK531v0r7rsOzh1MKwBxXtyGNEEZ6gm9PRvWSz2fxkCus7KsgMAhEzjGYLakpIQaBiIIQTaV+hIF3R2qwQTrsOpcBVhUCiQlPsfbdDFQSAkyjmoohtQAwBzeEeUmhg2QFkBmghAuqxz6jDOFkRVjnOMF4oBKmEFm0zQ2jmgHo0okiqxPPZDHff/QD7OzcR2jmO9+4Wh7a5so+xUA94dGFesZidF8GalnFCP8QyhTJURUoR86ND+LrGufduIDQNeH/vPl3/4b9g7+5uJiAL4bnAfujJRRdbRS2tWNf2pJ4BSYWaWWiFusEOgJQinHOQFHH44AA8mx3Th+9cK6S5ruhIT5qCTmkSO+ydRDLZlVIhvRJS4ZbG06SBEyA4a9DM58QiYuaz40KfrKZhoKdjCl0WqBBVg4Yyuy9yskcbK34+O4aIgFVBx8fHmEwmIGMW52MdI9arXIaZGVZPoscztQ6ArerLupaoE+r4+BjeV8REoKZtUVUVbBGoI55SkqVdDmofL7L8NmXhRYKBRr3cQCVLEaxpWzA74pTH433XN6h9aIf7vgyLE0U6BRzJaCrUsWcxLV9nM8aUn/v0locxhliSUByDKNWVc7Bu8W7QN46WZcfOPpSHMTEmhBgQinPHou2O2DBFqzFGqCqxc2y9c2XuNgzfAIFqpt9ORYmjxn8sTBZEEGJAG8qIqkyGAMAxwztG5T2887DWoK5qEIHYWGudc5n7QxZG+/ElIca8rlVFLNzhqt5rEEZOFcYQgZkxqTzqqkLlXRkQGjjnoABxB0F6p+z4DUsQIljtcoeFUV1JryxzTGOzy8j0J52cFv2QyLCIkqqCTLZntkJpTwwA5tGCZtG3RnE7ni5ms1tYI1CbN4OUkETQtC1iGXtW3qPyDt47eOdBqsQhBGsMYX0gjUbozWShrO13TSLLu1qid/MY3BiCY+7bnlR8KxXHbkM26axhWENkjMFkUhMnEdM0TQnrpSMWNJ4iLg6BO00uR58twjvlgdYbkRHSpwMpZJWFiGA+bxBjJN7a3KQXX3oZN965jhjDiILJeSIfHLCwDNgksEX1XV5aTogLQ+HR4tnhIyRJH8mqQEoJ3jt89dVfwJ1bO8SbW1t44dXXcPOD95Ak4srV5/DU574Arirs3/oYN9+7jvt3biO2oU9mUk4/iKKkhbFAZhBKJI/Kk8Jag83NbXz+hZ/BpSufQTub4f1rb+HaT9+Eryq89Nov4Uf/9A/g/3n7Gj7+yz9HVVUw1qKdz3HpuRdw+fnPgoiwd28ft976MfZ3bqKZHSO0c7RNg1icMyXp61J/gMBaWMtgZlhmuHqC808/g2de+QoubF0EANz4yTW8/cbrSClh59YtfO8v/hiTugb99e9+O73w8pfNvZ2buLv7CZr5HL6ucenSJtbOnMHa2XOYbpzt+yfTDeDYFm2Y3vUyJkp5+hjzbDaGgNjM0Rwd4XD/Pvbv3sb9e/dx8+ZHOHhwCOccnvnMs3jx5S/jg7ffOuS19TOy/fyXzIUrV3HlYB+xbdDODjE/OsR8PsfB/odowztlepgWGdYerJ3S15egMIZAJk8Yna9w7uIWnr76eUzWN+Cna1g7f1H9ZI0+fv8d4Q9vvB/vf/9vWYE8RbYGznn4qkZV1/D1FJONs7DsYA0XeEsLR3FOgx8q3fwsIsWQ5/lNg8PDB7h35zaatu1nuAQgto1waJuws3NYL54T0v5sR5/oRgcHhneJsnGbo0MTsADaVhRr058pyqllOqkTW2vbtSlDVUfUOj20zzr9INMS20b00OnPWKvWGkA1MoAwTGZ0aYxJKyv98sMfttjq/2jxgB1lwkMUkQG0/a5PaEbxkGNjnT4f2tquHpsqkmLhBEUe+FHDojrz9rR565MejqNHHDGk03hHNcYSoMdMwNxahiqUaOUpw5OjoYdPOk/Xpp6uRWsNmqZtGMDrqvpy/n0VKi8N+uOcMX2o6R5x+lRVReX1/wUVW0BT1aeAogAAAABJRU5ErkJggg==);--ari-pan:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAoCAMAAADE8VquAAACf1BMVEUAAAAgICAQEBANDQ0UFBQUFBQSEhIaGhoQEBAfHx8XFxcSEhIvLy8SEhIUFBQ2NjZiYmJdXV1aWlpbW1sVFRUmJiYWFhYaGhoaGhoeHh4TExMUFBQeHh4gICAbGxsTExMbGxsaGhodHR0dHR0aGhobGxsYGBgUFBQVFRUXFxcXFxcWFhYaGhobGxsZGRkYGBgXFxcWFhYXFxcUFBQUFBQTExMTExMTExMUFBQQEBAQEBAQEBAMDAwMDAwJCQkJCQkJCQkGBgYGBgYGBgYDAwMDAwMCAgICAgI5OTkODg5LS0tKSkpSUlI7OzsQEBBZWVldXV08PDwUFBROTk5aWlpkZGRNTU0WFhYSEhIREREfHx8qKio9PT06OjopKSkeHh4XFxcYGBgZGRkTExN1dXV4eHgaGhobHByrq6utra0cHBw1NTUbGxshISEkJCQlJSQQEA+0tLS3t7cPDg4jIiIiIiIgICBAQEAwMDAzMzMmJSUdHBwMDAzCwsLGxcYjIyItLS0xMTAvLy8/Pz8oKCgrKyvPz8/T09MNDQ1MTEwnJycPDw/a2trf39/j4+Pm5uYdHR0gHx8oKCfq6urt7e0qKSkoJycxMTHy8vIzMzIlJSUpKSgrKyosLCstLCwpKCjx8fE0MzMqKikxMDDz8/MnJyYvLy739/ctLSwmJiUuLi0wMC/29vYqKyosLCwuLi43Nzb19fU6OTktLC0yMjI0NDQyMTEvLi4yMjFRUVFEREQ4OTk2Njbr6+vn5+c4ODhDQ0NFRUVISEhBQUE4ODfb29vZ2dk/Pz4VFRUmJiY7OzorKiqhoaGgn585OTgJCQkVFRQEBAQFBQUGBgb////VMJxXAAAASHRSTlMAA1Km0er2/lMDBqX+pn/8/P7+/tf9+fj5zPz+zY/q/ut8nMDf8/j6+m6IgIWMjY2NjW9ddHNycXFNX148Siw3Nh4lJBAUBgcgP/CnAAAACXBIWXMAAC4jAAAuIwF4pT92AAACoUlEQVR4nF2Q6T9UYRiGn0JKshQqkuyyy5YlsqSxDfMW7zlOzHLqtBi0akjNMVEaLYjGdoZMs5gwqlGpKbROq+Qf6ujXB7m+PNd9/+5PD8C69Q6OThucBQLnDU6ODhs3AbhsLnQtKiouKS0tKS4uci3c4gJuQncPz61l5SJRedk2Tw93oRt4Ie/SI0fLK0SiivKySoE38gIfTJC4ijpWXS2qEWOSwD4gwVKZBCP6+AkaYYlMiiXAVDEymewkceo0cYYXPoK4Vi6vq284e+78hYuXGuXyWjFUXVY0KZqvtFy91sIo2VbV9Spoq2yX08LClhs3OwqFBFNzSw2Y6uwkCZK+fQcJCbJTSGGgCYQQRszde3L+IETQgCVSpqtb3HO/t03c3cVIJRiYrrp6dd8DTW//gLpPXV/XxUDj4NAwpx1pGu1/OKLlhocGG0E9zA1TY826/ketzWMUH9RAaduH9HqlYdSoUOr1Q+1aCjgT1TOuV5pHjY+V+vEeysSBycytrBQTxtaVFWc2AWswc5NjDQNG40DD2CRnNrAwZVGpLJa+aaNxus+y4lOgZRU6ncYkeDLx1KTR6RTsM7DOsBbFc4Ogf1Tw4qXCwM5YoW321WurxmJ789Zm0Vjn5mfbAM3VLrx7/6Hp4yer7fPC/MwcAqmNtn/RfP32/cfIT9WgnbZJAbMSmiQxWlxEmCRpCYvBzv/L/gvRS79pXvh/2WE7bzz08vI/2QE7ka+fH29LS3zl5+eLdoH/bnsAzaeODr6nA+x7/CEwKDgkNMwnPCIi3CcsNCQ4KBD2RkZFx8TGxSckxMfFxkRHRe6DxKSk5JTU/X9JTUlOSkqEtPSM9FVkpKdB5oE1ZEJW9sH/yM6CnNy83FXk5eZA/qE15EPB4TUU/AGjFCIu7pe82wAAAABJRU5ErkJggg==)} + +/* V3 operator approved layout: the physical artwork is ORIGINAL and never scaled. */ +.console-pane{--master-w:142px;--plugin-w:min(330px,36vw)} +.console-body{--rail-w:28px;--route-h:62px;--fx-h:23px;--send-h:23px;--eq-h:23px;--pan-h:43px;--trim-h:25px;--switch-h:40px;--footer-h:46px} +.console-body:not(.collapsed-fx){--fx-h:112px} +.console-body:not(.collapsed-send){--send-h:80px} +.console-body:not(.collapsed-eq){--eq-h:44px} +.console-body.collapsed-route{--route-h:23px} +.console-body.collapsed-fx{--fx-h:23px} +.console-body.collapsed-send{--send-h:23px} +.console-body.collapsed-eq{--eq-h:23px} +.console-body .section-rail{width:var(--rail-w);min-width:var(--rail-w);flex:0 0 var(--rail-w)} +.console-body #viewport{flex:1 1 0;min-width:0;width:0;overflow:hidden!important;scrollbar-width:none!important;overscroll-behavior:none} +.console-body #viewport::-webkit-scrollbar{display:none!important;height:0!important;width:0!important} +.console-body .tracks{display:grid;grid-template-columns:repeat(var(--bank-columns,10),minmax(0,1fr));width:100%!important;min-width:0!important;max-width:100%;height:100%;overflow:hidden} +.console-body .tracks>.strip{flex:none!important;width:auto!important;min-width:0!important;max-width:none!important;overflow:hidden} +.console-body #master{width:var(--master-w);min-width:var(--master-w);flex:0 0 var(--master-w);overflow:hidden} +.console-body #master>.strip{width:100%!important;min-width:0!important;max-width:none!important} +.console-body.plugin-open #viewport{margin-right:var(--plugin-w)} +.plugin-browser{top:67px!important;right:var(--master-w)!important;bottom:0!important;width:var(--plugin-w)!important;max-width:var(--plugin-w)!important;box-shadow:none!important} +.bank-arrow{height:29px!important;min-width:30px!important;font-size:20px!important} +.bank-arrow:disabled{opacity:.4;cursor:default} +#bankSelect{min-width:107px!important;max-width:114px!important;font-size:11px!important} +.console-body .strip,.console-body .strip.audio,.console-body .strip.fx,.console-body .strip.bus,.console-body .strip.master{background:#232a2e!important;box-shadow:inset 1px 0 #51616b22!important;border-right:1px solid #101920!important} +.console-body .strip.selected{background:#2b353a!important;box-shadow:inset 2px 0 #82b8c8!important} +.console-body .section{border-bottom:1px solid #35434a66!important;box-shadow:none!important} +.console-body .fx-section,.console-body .send-section,.console-body .eq-section{background:#252c30!important} +.console-body .subhead,.console-body .send-header,.console-body .eq-header{border:0!important} +.console-body .subhead .hint{font-size:11px!important;color:#b7cbd0!important} +.console-body .subhead .sym{opacity:.5} +.console-body .fxslot-row{border-bottom:1px solid #38485044!important} +.console-body .fx-pick.empty{color:#87b4c4} +.console-body .eq-line{background:#212a30!important;border:0!important} +.console-body .eq-status-quiet{color:#8faab2;font-size:10px} +.console-body .route-section{padding:3px 4px!important} +.console-body .route-field{grid-template-columns:22px minmax(0,1fr)!important;gap:3px!important} +.console-body .route-top{border:0!important} +.console-body .route-select{font-size:11px!important;min-width:0;padding-left:3px!important} +.console-body .pan-section{grid-template-columns:23px minmax(0,1fr) 23px!important;gap:3px!important;padding:0 4px!important;background:#242b30!important} +.console-body .pan-icon{font-size:9px!important} +.console-body .center-pan{height:40px!important;min-height:40px!important;max-height:40px!important;width:100%!important;appearance:none!important;-webkit-appearance:none!important;background:transparent!important;padding:0!important} +.console-body .center-pan::-webkit-slider-runnable-track{height:5px!important;border:1px solid #0a1218!important;background:linear-gradient(to right,#0b151a 0%,#0b151a var(--pan-start),#42b5ca var(--pan-start),#42b5ca var(--pan-end),#0b151a var(--pan-end),#0b151a 100%)!important} +.console-body .center-pan::-webkit-slider-thumb{-webkit-appearance:none!important;appearance:none!important;width:18px!important;height:40px!important;margin-top:-18px!important;border:0!important;border-radius:0!important;background:var(--ari-pan) center/18px 40px no-repeat!important;box-shadow:none!important} +.console-body .center-pan::-moz-range-thumb{width:18px!important;height:40px!important;border:0!important;border-radius:0!important;background:var(--ari-pan) center/18px 40px no-repeat!important;box-shadow:none!important} +.console-body .switch-section{background:#242b30!important;gap:3px!important;padding:3px 4px!important} +.console-body .switch{box-shadow:none!important;background:linear-gradient(#4d565b,#242d33)!important;border:1px solid #131e24!important} +.console-body .switch.on.mute{background:#a03835!important;color:#fff!important} +.console-body .switch.on.solo{background:#cebb57!important;color:#17191b!important} +.console-body .fader-section{background:#20282f!important;padding:5px 4px!important;gap:5px!important;min-height:145px!important;box-shadow:none!important} +.console-body .fader-head{height:31px!important;min-height:31px!important;background:#0c171e!important;box-shadow:inset 0 1px 2px #050b0e!important} +.console-body .fader-readout{font-size:15px!important;color:#79d3e3!important;text-shadow:none!important} +.console-body .strip.master .fader-readout{color:#ddc1a1!important} +.console-body .fader-workspace{display:grid!important;grid-template-columns:25px minmax(0,1fr) 24px!important;gap:3px!important} +.console-body .meter-box{grid-column:1;width:25px!important;max-width:25px!important;padding:12px 2px 5px!important} +.console-body .fader-box{grid-column:2;border:0!important;border-radius:4px!important;background:linear-gradient(90deg,#172026,#303a42 12%,#202a31 50%,#303a42 88%,#141c21)!important;box-shadow:inset 2px 0 4px #090e13,inset -2px 0 4px #0b1216!important} +.console-body .fader-box:before{top:38px!important;bottom:38px!important;width:7px!important;background:linear-gradient(90deg,#030709,#11181d 50%,#030709)!important} +.console-body .fader-box:after{bottom:38px!important;width:4px!important;height:calc((100% - 77px) * var(--fader-lit,0))!important;max-height:calc(100% - 77px)!important;background:linear-gradient(to top,transparent,#1b6575 28%,#27bfd8 70%,#183e4c)!important;box-shadow:none!important} +.console-body .fader{width:36px!important;max-width:100%!important;height:calc(100% - 77px)!important;min-height:10px!important;margin:0!important;writing-mode:vertical-lr!important;direction:rtl!important;appearance:none!important;-webkit-appearance:none!important;background:transparent!important} +.console-body .fader::-webkit-slider-thumb{-webkit-appearance:none!important;appearance:none!important;width:36px!important;height:77px!important;border:0!important;border-radius:0!important;background:var(--ari-silver) center/36px 77px no-repeat!important;box-shadow:none!important} +.console-body .fader::-moz-range-thumb{width:36px!important;height:77px!important;border:0!important;border-radius:0!important;background:var(--ari-silver) center/36px 77px no-repeat!important;box-shadow:none!important} +.console-body .strip.master .fader::-webkit-slider-thumb{background:var(--ari-rose) center/36px 77px no-repeat!important} +.console-body .strip.master .fader::-moz-range-thumb{background:var(--ari-rose) center/36px 77px no-repeat!important} +.console-body .fader-scale{grid-column:3;width:auto!important;min-width:0!important;padding:38px 0!important;align-items:flex-start!important;text-align:left!important;font-size:9px!important;color:#98a7ad!important} +.console-body .bottom-section{background:#222b31!important} +.console-body .footer-label{background:#303d43!important;border:0!important;border-radius:1px!important} +.console-body .footer-label .name{font-weight:500!important;font-size:12px!important} +.console-body .footer-label .color-strip{height:3px!important;flex-basis:3px!important;opacity:.8} +.console-body .strip.selected .footer-label{background:#344850!important} +.console-body .strip.bus .footer-label,.console-body .strip.fx .footer-label{background:#39363d!important} +.console-body .strip.master .footer-label{background:#453b36!important} +.console-body .fader,.console-body .center-pan{filter:none!important;transition:none!important} + + +/* Unaltered operator-approved BTN-180 recipe, copied from web/styles-src/20-button-180.css */ +/* Button 180 is the ONE shared material for channel, MASTER, toolbar and left-rail pads. */ +/* BUTTON 180 — one identical RESTING surface for OFF and ON. + Semantic colors alone define the latched state; only the transient :active + pointer press moves the cap inward by 1px without changing its layout slot. */ +:root{ + --b180-off:#cbd1d1;--b180-edge:#747f7f;--b180-off-ink:#172229; + --b180-color:var(--b180-off);--b180-border:var(--b180-edge); + --b180-ink:var(--b180-off-ink); + --b180-on-cyan:#94e8ed;--b180-on-green:#91edac; + --b180-on-magenta:#edb8df;--b180-on-purple:#d6b9f0; + --b180-on-mute:#f99aa4;--b180-on-solo:#f4d479; + --b180-on-stereo:#9dd2f0; +} +:is(.btn-180,.toolbar .nav button.btn-180,.toolbar .spec-device,.left-rail .tabs button.btn-180, +.strip .channel-actions .candy,.strip .utility-row button,.strip .fader-tools button, +.left-rail .rail-presets button.btn-180,.left-rail .rail-bottom button.btn-180, +#masterLeft .master-tools button,.native-btn){ + /* Exact same inset + outside-edge model as the previously approved ON face. + All layers are shared; only --b180-border is allowed to tint the edge. */ + --b180-shadow-surface: + inset 5px 5px 2px -1px rgba(0,0,0,.18), + inset 0 0 1px 1px rgba(255,255,255,.14), + inset 0 1px 20px rgba(0,0,0,.12), + inset 0 -1px 2px rgba(0,0,0,.32), + 0 0 0 1px var(--b180-border), + 0 1px 1px rgba(0,0,0,.28), + 0 2px 3px rgba(0,0,0,.13); + border:1px solid var(--b180-border)!important; + letter-spacing:1px; + padding:8px 20px; + font-size:14px; + text-transform:uppercase; + border-radius:3px!important; + outline:none; + transform:translateY(0px)!important; + position:relative; + /* Shared geometry and shading; OFF/ON are merely different colorways. */ + box-shadow:var(--b180-shadow-surface)!important; + background:var(--b180-color)!important; + filter:none!important; + color:var(--b180-ink)!important; + text-shadow:0 1px 0 rgba(255,255,255,.16)!important; + transition:background-color 45ms linear, border-color 45ms linear, color 0ms, transform 0ms!important; + font-family:Arial,Helvetica,sans-serif; + cursor:pointer;text-decoration:none;user-select:none; + display:inline-flex;justify-content:center;align-items:center; + font-weight:700; +} +:is(.btn-180,.toolbar .nav button.btn-180,.toolbar .spec-device,.left-rail .tabs button.btn-180, +.strip .channel-actions .candy,.strip .utility-row button,.strip .fader-tools button, +.left-rail .rail-presets button.btn-180,.left-rail .rail-bottom button.btn-180, +#masterLeft .master-tools button,.native-btn):disabled{ + pointer-events:none;opacity:.65;color:#7e7e7e!important; + background:#dcdcdc!important;box-shadow:none!important; + text-shadow:none!important;border:none!important; +} +/* Glass glint is drawn by inset shadows only; no pseudo-elements. */ +:is(.btn-180,.toolbar .nav button.btn-180,.toolbar .spec-device,.left-rail .tabs button.btn-180, +.strip .channel-actions .candy,.strip .utility-row button,.strip .fader-tools button, +.left-rail .rail-presets button.btn-180,.left-rail .rail-bottom button.btn-180, +#masterLeft .master-tools button,.native-btn)::before,:is(.btn-180,.toolbar .nav button.btn-180,.toolbar .spec-device,.left-rail .tabs button.btn-180, +.strip .channel-actions .candy,.strip .utility-row button,.strip .fader-tools button, +.left-rail .rail-presets button.btn-180,.left-rail .rail-bottom button.btn-180, +#masterLeft .master-tools button,.native-btn)::after{content:none!important} +:is(.btn-180,.toolbar .nav button.btn-180,.toolbar .spec-device,.left-rail .tabs button.btn-180, +.strip .channel-actions .candy,.strip .utility-row button,.strip .fader-tools button, +.left-rail .rail-presets button.btn-180,.left-rail .rail-bottom button.btn-180, +#masterLeft .master-tools button,.native-btn):focus-visible{outline:2px solid #9ceaff;outline-offset:1px} +/* Geometry-only accommodation for 27–34px mixer slots. */ +:is(.btn-180,.toolbar .nav button.btn-180,.toolbar .spec-device,.left-rail .tabs button.btn-180, +.strip .channel-actions .candy,.strip .utility-row button,.strip .fader-tools button, +.left-rail .rail-presets button.btn-180,.left-rail .rail-bottom button.btn-180, +#masterLeft .master-tools button,.native-btn){padding:0 3px!important;letter-spacing:.12px!important;font-size:11px!important;min-width:0} +.toolbar .nav button.btn-180{letter-spacing:.35px!important} +.left-rail .rail-presets button.btn-180{text-align:left;justify-content:flex-start;padding:0 9px!important} +.toolbar .spec-device{text-transform:none;letter-spacing:0!important} +/* Semantic ON palette is defined exactly once after the recessed state. */ +#masterLeft .master-actions .master-stereo-badge{ + border:1px solid #4b6779;background:linear-gradient(#233a49,#102635 60%,#203442); + box-shadow:inset 0 1px 2px #020c18c0,0 1px 0 #68859940;color:#a9d6e6;cursor:default +} + +/* Latching OFF/ON must NOT alter material, depth or layout. The physical + press response below exists only while :active, never on .active/.selected. */ +/* Latch LED colors only; dark captions are legible on bright faces. */ +/* Native dialog buttons keep native cyan; toolbar and rail states below + each have ONE scope owner, with no competing earlier palette selectors. */ +:is(.native-btn.primary,.native-btn.on){--b180-color:#22bbcc;--b180-border:#087b8e;--b180-ink:#041c27} +/* Utility ON is exclusively cyan, owned by the more specific scoped rule below. */ +:is(.strip .channel-actions .mute.active,#masterLeft #masterMute.active, + .native-btn.warn){--b180-color:var(--b180-on-mute);--b180-border:#b14a5f;--b180-ink:#32151e} +.strip .channel-actions .solo.active{--b180-color:var(--b180-on-solo);--b180-border:#a48337;--b180-ink:#2b210b} +#masterLeft .master-tools button.active{--b180-color:var(--b180-on-purple);--b180-border:#8668b8;--b180-ink:#26163c} +:is(.strip .channel-actions .candy,.strip .utility-row button,.strip .fader-tools button, + #masterLeft .master-tools button,.toolbar .nav button.btn-180,.left-rail .tabs button.btn-180, + .left-rail .rail-presets button.btn-180,.left-rail .rail-bottom button.btn-180,.native-btn){ + color:var(--b180-ink,#f2f8fb)!important; +} +/* Keep pre-refactor fixed-sized buttons and their existing rails. + The strip name is painted above the A/B shadow, not moved away. */ +.strip .fader-tools,#masterLeft .master-tools{position:relative;z-index:1;isolation:isolate} +.strip .strip-name,#masterLeft .master-strip-name{position:relative;z-index:2;isolation:isolate} +/* No odd vertical displacement of the active nav relative to its neighbors. */ + +/* Issue #56: passive hover has no filter or animated shadow. + Preserve all seven resting / seven pressed shadows and 1px tactile response. + Historical brightness is isolated to opt-in baseline A/B only. */ + +/* Hardware tactility: brief pointer/keyboard activation presses the SAME cap + 1px into the control panel. The layout and hit target stay the same; only + the rendered face shifts, while the lower cast shadow collapses inward. + Identical response for gray OFF and colored ON; no persistent pressed skin. */ +:is(.btn-180,.toolbar .nav button.btn-180,.toolbar .spec-device, + .strip .channel-actions .candy,.strip .utility-row button,.strip .fader-tools button, + #masterLeft .master-actions button,#masterLeft .master-tools button, + .left-rail .tabs button.btn-180,.left-rail .rail-presets button.btn-180, + .left-rail .rail-bottom button.btn-180,.native-btn):active:not(:disabled){ + transform:translateY(1px)!important; + box-shadow: + inset 3px 2px 2px -1px rgba(0,0,0,.50), + inset 0 0 1px 0 rgba(255,255,255,.14), + inset 0 1px 15px rgba(0,0,0,.29), + inset 0 -1px 2px rgba(0,0,0,.32), + 0 0 0 1px var(--b180-border), + 0 1px 1px rgba(0,0,0,.28), + 0 2px 3px rgba(0,0,0,.13)!important; +} + +/* OFF uses the same shared material with a brighter light-steel face. + Bright ON color recipes above remain untouched. */ +:is(.toolbar .spec-device, + .strip .channel-actions .candy,.strip .utility-row button, + #masterLeft .master-actions button,#masterLeft .master-tools button, + .left-rail .tabs button.btn-180,.left-rail .rail-presets button.btn-180, + .left-rail .rail-bottom button.btn-180):not(.active):not(.selected):not(.on):not([aria-pressed="true"]){ + --b180-color:var(--b180-off);--b180-border:var(--b180-edge); + --b180-ink:var(--b180-off-ink); + color:var(--b180-ink)!important; +} +@media(prefers-reduced-motion:reduce){ + :is(.toolbar .nav button.btn-180,.toolbar .spec-device,.strip .channel-actions .candy, + .strip .utility-row button,.left-rail button.btn-180){transition:none!important} +} + +/* Scope-specific ON palette: only variables change; all keys share + the same seven-layer pad and exact press recipe above. */ +#app .toolbar-actions .nav button.btn-180.selected{ + --b180-color:#e5f4a2;--b180-border:#8baf48;--b180-ink:#1c2b14; +} +#app .left-rail button.btn-180:is(.selected,.active){ + --b180-color:var(--b180-on-magenta);--b180-border:#ad6d9f;--b180-ink:#32172f; +} +/* Polarity/HPF share the gentle cyan pad; MUTE/SOLO keep their alert palettes. */ +#app #mixer .strip .utility-row button.btn-180.active{ + --b180-color:var(--b180-on-cyan);--b180-border:#38909e;--b180-ink:#12323c; +} +#app .left-rail .rail-presets button.btn-180{text-transform:none} +#app .toolbar-actions .nav button.btn-180{height:34px;min-height:34px;min-width:77px;padding:0 10px!important;letter-spacing:.35px!important} +#app .left-rail button.btn-180 > span, +#app .toolbar-actions .nav button.btn-180 > span{transform:none!important;transition:none!important} + +/* Device is a standard toolbar-size BTN-180 pad, not the old cyan-caption spec. + Green indicates verified connected native audio status only. Preview is OFF. */ +#app .toolbar .spec-device{ + height:34px;min-height:34px; + padding:0 10px!important;letter-spacing:.35px!important; +} +#app .toolbar .spec-device #headerDriver{ + color:var(--b180-ink)!important; +} +#app .toolbar .spec-device.on{ + --b180-color:var(--b180-on-green); + --b180-border:#3a9b68; + --b180-ink:#113322; +} +/* Toolbar actions are NEUTRAL when idle, green only for selected/active. + One solid repaint on state change, never a hover filter or glow. */ +#app .toolbar-actions .nav button.btn-180:not(.selected):not(.active):not([aria-pressed="true"]){ + --b180-color:var(--b180-off);--b180-border:var(--b180-edge); + --b180-ink:var(--b180-off-ink); +} +#app .toolbar-actions .nav button.btn-180:is(.selected,.active,[aria-pressed="true"]){ + --b180-color:#b2e8a0;--b180-border:#649c62;--b180-ink:#1a361d; +} +/* P0 low-end GPU: hover does not repaint BTN-180. Focus-visible, + 1px hardware press, shared static shadows and semantic ON stay unchanged. */ + + +/* V4 production artwork recipes port. All section dimensions are shared by Master. */ +.console-body{--fx-h:173px;--eq-h:0px;--trim-h:43px;--switch-h:42px;--send-h:23px;--footer-h:46px;--channel-w:148px} +.console-body:not(.collapsed-fx){--fx-h:173px} +.console-body:not(.collapsed-send){--send-h:103px} +.console-body .section-rail .rail-cell.fader{min-height:145px} +.console-body #master{flex:0 0 var(--channel-w)!important;width:var(--channel-w)!important;min-width:var(--channel-w)!important;max-width:var(--channel-w)!important} +.console-body #master>.strip.master{width:100%!important;min-width:0!important;max-width:100%!important} +.console-body .tracks{grid-template-columns:repeat(var(--bank-columns,10),minmax(0,1fr))!important} +.console-body .switch-section{height:var(--switch-h)!important;flex:0 0 var(--switch-h)!important;display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:5px!important;padding:5px 5px 6px!important} +.console-body .switch.btn-180{ + width:100%!important;height:29px!important;min-height:29px!important;min-width:0!important;max-width:none!important;flex:none!important; + border:1px solid var(--b180-border)!important;border-radius:3px!important; + color:var(--b180-ink)!important;background:var(--b180-color)!important; + box-shadow:var(--b180-shadow-surface)!important; + font:700 10px/1 Arial,Helvetica,sans-serif!important;letter-spacing:.12px!important;padding:0 2px!important; + text-transform:uppercase!important;text-shadow:0 1px 0 rgba(255,255,255,.16)!important; +} +.console-body .switch.btn-180.on.mute{--b180-color:var(--b180-on-mute);--b180-border:#b14a5f;--b180-ink:#32151e} +.console-body .switch.btn-180.on.solo{--b180-color:var(--b180-on-solo);--b180-border:#a48337;--b180-ink:#2b210b} +.console-body .switch.btn-180.on.cue{--b180-color:var(--b180-on-cyan);--b180-border:#38909e;--b180-ink:#12323c} +.console-body .switch.btn-180:active:not(:disabled){ + transform:translateY(1px)!important; + box-shadow: + inset 3px 2px 2px -1px rgba(0,0,0,.50), + inset 0 0 1px 0 rgba(255,255,255,.14), + inset 0 1px 15px rgba(0,0,0,.29), + inset 0 -1px 2px rgba(0,0,0,.32), + 0 0 0 1px var(--b180-border), + 0 1px 1px rgba(0,0,0,.28), + 0 2px 3px rgba(0,0,0,.13)!important; +} +.console-body .fader-workspace{display:grid!important;grid-template-columns:51px minmax(36px,1fr) 26px!important;gap:3px!important;min-width:0!important;overflow:hidden!important} +.console-body .meter-box{ + grid-column:1!important;width:51px!important;max-width:51px!important;min-width:51px!important; + display:flex!important;align-items:stretch!important;gap:0!important;padding:0!important; + border:0!important;border-radius:4px!important; + background:#080f14!important;box-shadow:inset 0 3px 3px #0008!important; +} +.console-body .meter-box .vu-bars{ + box-sizing:border-box;flex:0 0 30px;width:30px;min-width:30px;max-width:30px; + display:flex;align-items:stretch;justify-content:flex-end;gap:2px;position:relative; + padding:12px 1px 13px;overflow:hidden; + background:linear-gradient(90deg,#0b1a20 0%,#020609 13%,#010408 61%,#07131a 100%); + border-radius:5px;box-shadow:inset 0 4px 4px -3px #070e13,inset 0 -4px 4px -3px #070e13, + inset 4px 0 5px -4px #081116,inset -4px 0 5px -4px #081116; +} +.console-body .meter-box.mono .vu-bars{justify-content:center} +.console-body .meter-box .meter-lane{ + position:relative;width:10px;flex:0 0 10px;max-width:10px;min-width:10px;height:100%; + border:0;border-radius:2px; + background:#080f14;box-shadow:inset 0 1px 2px #0009,inset 1px 0 2px #000c,inset -1px 0 2px #000b; +} +.console-body .meter-box .meter-fill{ + left:0!important;right:0!important;top:0;bottom:0;height:100%; + background:linear-gradient(to top,#15cf69 0%,#39ed79 48%,#c4e934 70%,#ffce26 82%,#ff8b20 90%,#f74635 100%)!important; + clip-path:inset(calc(100% - var(--lit,0%)) 0 0)!important; + transition:none!important;box-shadow:none!important; +} +.console-body .meter-box .meter-lane::before{ + content:"";position:absolute;inset:0;z-index:2; + background:repeating-linear-gradient(to top,transparent 0 5px,#061018 5px 7px); + pointer-events:none; +} +.console-body .meter-box .vu-scale{position:relative;flex:0 0 19px;width:19px;min-width:19px;color:#a0bbc5;font:8px/1 Consolas,monospace;pointer-events:none} +.console-body .meter-box .vu-scale-travel{position:absolute;top:12px;bottom:13px;left:0;right:0} +.console-body .meter-box .vu-tick{position:absolute;left:0;right:0;top:var(--tick);height:0;white-space:nowrap} +.console-body .meter-box .vu-tick::before{content:"";position:absolute;top:0;left:0;width:3px;height:1px;background:#516b78} +.console-body .meter-box .vu-tick span{position:absolute;left:4px;top:-5px;font:8px/10px Consolas,monospace} +.console-body .meter-box .peak{top:3px!important;left:2px!important;right:auto!important;width:26px!important;height:6px!important} +.console-body .fader-box{ + grid-column:2!important;position:relative!important;isolation:isolate; + min-width:36px!important;width:100%!important;overflow:visible!important; + border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important; +} +.console-body .fader-box::before{ + content:"";position:absolute;top:0!important;bottom:0!important;left:50%!important; + width:min(46px,100%)!important;transform:translateX(-50%)!important; + z-index:0;pointer-events:none;box-sizing:border-box; + background:linear-gradient(90deg,#15232c 0%,#283741 13%,#2a3942 48%,#283741 87%,#15232c 100%)!important; + border:0!important;border-radius:6px!important; + box-shadow:inset 0 4px 4px -3px #070e13,inset 0 -4px 4px -3px #070e13, + inset 4px 0 5px -4px #081116,inset -4px 0 5px -4px #081116!important; +} +.console-body .fader-box::after{ + content:"";position:absolute;left:50%!important;top:38px!important;bottom:39px!important;width:5px!important; + transform:translateX(-50%)!important;z-index:1;pointer-events:none; + border:0!important;opacity:1!important;max-height:none!important;height:auto!important; +} +.console-body .fader-travel{ + position:absolute;top:38px;bottom:39px;left:0;right:0;pointer-events:none;z-index:3; +} +.console-body .fader-travel .cap{ + position:absolute;top:var(--fader-y,50%);left:50%;transform:translate(-50%,-50%); + width:36px;height:77px;border:0;border-radius:0; + background:var(--ari-silver) center/36px 77px no-repeat; + pointer-events:none;filter:none;box-shadow:none; +} +.console-body .strip.master .fader-travel .cap{background:var(--ari-rose) center/36px 77px no-repeat} +.console-body .fader-box .fader{ + position:absolute;z-index:4;top:38px;bottom:39px;left:50%;transform:translateX(-50%); + width:36px!important;height:calc(100% - 77px)!important;min-height:10px!important; + writing-mode:vertical-lr!important;direction:rtl!important;cursor:ns-resize; + opacity:0!important;-webkit-appearance:none!important;appearance:none!important; + pointer-events:auto; +} +.console-body .fader-scale{grid-column:3!important;position:relative;flex:none!important;width:26px!important;min-width:26px!important;padding:0!important;background:none!important} +.console-body .gain-scale-travel{position:absolute;top:38px;bottom:39px;left:0;right:0} +.console-body .gain-tick{position:absolute;top:0;height:0;left:0;right:0} +.console-body .gain-tick::before{content:"";position:absolute;left:1px;top:0;height:1px;width:3px;background:#687d89} +.console-body .gain-tick.major::before{width:6px;background:#a4b9c4} +.console-body .gain-tick span{position:absolute;top:-6px;left:8px;right:0;text-align:right;font:9px/12px Consolas,monospace;white-space:nowrap;color:#a8b9c3} +.console-body .trim-section{height:var(--trim-h)!important;flex:0 0 var(--trim-h)!important;display:grid!important;grid-template-columns:26px minmax(0,1fr) 31px!important;gap:3px!important;align-items:center!important} +.console-body .trim-label,.console-body .sendlevel label{color:#9cb0b8;font:9px/1 'Segoe UI',Arial,sans-serif} +.console-body .ari-horizontal{ + -webkit-appearance:none!important;appearance:none!important;min-width:0!important;width:100%!important; + height:40px!important;min-height:40px!important;margin:0!important;padding:0!important; + background:transparent!important;cursor:ew-resize; +} +.console-body .ari-horizontal::-webkit-slider-runnable-track{ + height:5px!important;border-radius:2px!important;border:1px solid #06090b!important; + background:linear-gradient(to right,#35b1cb 0%,#35b1cb var(--range-pct,50%),#0b151a var(--range-pct,50%),#0b151a 100%)!important; + box-shadow:inset 0 1px 2px #000,inset 0 -1px #50616a50!important; +} +.console-body .ari-horizontal::-webkit-slider-thumb{ + -webkit-appearance:none!important;appearance:none!important;width:18px!important;height:40px!important; + margin-top:-18px!important;border:0!important;border-radius:0!important; + background:var(--ari-pan) center/18px 40px no-repeat!important;box-shadow:none!important; +} +.console-body .ari-horizontal::-moz-range-track{height:5px;border-radius:2px;border:1px solid #06090b;background:linear-gradient(to right,#35b1cb 0%,#35b1cb var(--range-pct,50%),#0b151a var(--range-pct,50%),#0b151a 100%)} +.console-body .ari-horizontal::-moz-range-thumb{width:18px!important;height:40px!important;border:0!important;border-radius:0!important;background:var(--ari-pan) center/18px 40px no-repeat!important} +.console-body .send-section .sendlevel{height:42px!important;min-height:42px!important;flex:0 0 42px!important;display:grid!important;grid-template-columns:29px minmax(0,1fr) 27px!important;gap:2px!important} +.console-body .send-section .sendlevel output{font:9px Consolas,monospace} + +/* Exact RAIL3 source copied from web/styles-src/42-mixer-premium.css — operator-approved hardware fader: upper slot unlit black; + below the thumb cyan blooms smoothly, then rolls off into black at the foot. + The groove is physically ONE 5px machined slot; black sidewalls are static. + Three bounded CSS gradients over a tiny area; no blur, shadows animation, + filters, extra DOM, observer, RAF, DSP or additional gain handlers. */ +.console-body .fader-box::after{ + background-color:#10171c; + background-image: + /* fixed black edge occlusion throughout the physical slot */ + linear-gradient(90deg,#010508 0%,#03090f 18%,transparent 38%, + transparent 62%,#03090f 82%,#010508 100%), + /* fade light back into the machined black well at the lower end */ + linear-gradient(to bottom,transparent 0%,transparent 62%, + rgba(1,6,10,.10) 72%,rgba(1,6,10,.52) 86%, + rgba(1,6,10,.85) 94%,#01060a 100%), + /* above cap black, under cap dark -> gentle cyan; follows existing detent */ + linear-gradient(to bottom, + #12191e 0%,#12191e calc(var(--fader-cut,50%) + 26px), + #0e2e39 calc(var(--fader-cut,50%) + 39px), + #176d85 calc(var(--fader-cut,50%) + 52px), + #27bfd8 calc(var(--fader-cut,50%) + 68px), + #27bfd8 100%); + box-shadow:inset 1px 0 #010406,inset -1px 0 #010406; +} + + +/* Hard layout invariant: one physical width for all VU/fader modules and Master. */ +.console-body .tracks>.strip{box-sizing:border-box;min-width:0!important;max-width:none!important} +.console-body #master{box-sizing:border-box} + +/* Match the source GUI gain ruler: +10/0/−60, while VU remains 0…−60 dBFS. */ +.console-body .fader-box:focus-within::before{box-shadow:inset 0 0 0 1px #82cddd,inset 0 4px 4px -3px #070e13,inset 0 -4px 4px -3px #070e13!important} + +/* BTN-180 latch colors: ON uses the SAME original seven-shadow chassis as OFF. + Override historical V3 solid red/yellow legacy declarations; only color variables differ. */ +.console-body .switch.btn-180.on.mute, +.console-body .switch.btn-180.on.solo, +.console-body .switch.btn-180.on.cue{ + background:var(--b180-color)!important;color:var(--b180-ink)!important; + border-color:var(--b180-border)!important; + box-shadow:var(--b180-shadow-surface)!important; +} +.console-body .switch.btn-180.on:active:not(:disabled){ + box-shadow:inset 3px 2px 2px -1px rgba(0,0,0,.50), + inset 0 0 1px 0 rgba(255,255,255,.14), + inset 0 1px 15px rgba(0,0,0,.29), + inset 0 -1px 2px rgba(0,0,0,.32), + 0 0 0 1px var(--b180-border), + 0 1px 1px rgba(0,0,0,.28), + 0 2px 3px rgba(0,0,0,.13)!important; +} + +/* V5 FINAL CHROME: old ArSonMix materials, slimmer physical fader and no blue lumen. */ +.console-body{--route-h:76px;--fx-h:194px;--send-h:23px;--pan-h:43px;--switch-h:44px;--footer-h:46px;--trim-h:0px} +.console-body:not(.collapsed-fx){--fx-h:194px!important} +.console-body.collapsed-fx{--fx-h:23px!important} +.console-body:not(.collapsed-send){--send-h:103px} +.console-body.collapsed-send{--send-h:23px} +.console-body .route-section{height:var(--route-h)!important;flex:0 0 var(--route-h)!important;padding:3px 4px!important} +.console-body .route-top{height:17px!important;min-height:17px!important;flex:0 0 17px!important} +.console-body .route-field{height:24px!important;min-height:24px!important;flex:0 0 24px!important;display:grid!important;grid-template-columns:20px minmax(0,1fr)!important;align-items:center!important;gap:4px!important;overflow:visible!important} +.console-body .route-caption{font-size:10px!important} +.console-body .route-select{display:block!important;width:100%!important;min-width:0!important;height:22px!important;min-height:22px!important;padding:0 9px 0 4px!important;font-size:11px!important;line-height:20px!important;color:#e0eff5!important;background:#10212c!important;border:1px solid #435968!important;white-space:nowrap!important;text-overflow:ellipsis!important} +.console-body .route-identity{overflow:hidden;white-space:nowrap;text-overflow:ellipsis} +.console-body .fx-section{height:var(--fx-h)!important;min-height:var(--fx-h)!important;flex:0 0 var(--fx-h)!important;background:#152630!important} +.console-body .fxslot-list{overflow:auto hidden!important} +.console-body .fxslot-row{height:22px!important;min-height:22px!important} +.console-body .fx-pick{font:600 10px/1.2 'Segoe UI',Arial,sans-serif!important;color:#9de5bf!important} +.console-body .fx-pick.empty{font-weight:500!important;color:#65d1f1!important} +.console-body .subhead{background:#112530!important} +.console-body .trim-section,.console-body .rail-cell.trim{display:none!important} +.console-body .fader-section{background:#0e1a23!important;min-height:0!important} +.console-body .fader-workspace{grid-template-columns:51px minmax(35px,1fr) 26px!important;gap:2px!important} +.console-body .meter-box{background:linear-gradient(90deg,#0d2028,#010608 22%,#07141b)!important;border-radius:5px!important} +.console-body .meter-box .vu-bars{background:linear-gradient(90deg,#0d1d26,#02080b 19%,#010609 64%,#0c1d27)!important} +.console-body .fader-box::before{width:min(40px,100%)!important;background:linear-gradient(90deg,#15232c,#283741 13%,#2a3942 48%,#283741 87%,#15232c)!important;border-radius:5px!important} +.console-body .fader-box::after{top:31px!important;bottom:31px!important;background-color:#03080b!important;background-image:none!important;width:5px!important;height:auto!important;opacity:1!important;box-shadow:inset 1px 0 #010406,inset -1px 0 #010406!important} +.console-body .fader-travel{top:31px!important;bottom:31px!important;pointer-events:none!important} +.console-body .fader-travel .cap{top:var(--fader-y,50%)!important;width:29px!important;height:62px!important;background:var(--ari-silver) center/29px 62px no-repeat!important;transform:translate(-50%,-50%)!important;filter:none!important} +.console-body .strip.master .fader-travel .cap{background:var(--ari-rose) center/29px 62px no-repeat!important} +.console-body .fader-box .fader{top:31px!important;bottom:31px!important;height:calc(100% - 62px)!important;opacity:0!important;pointer-events:none!important} +.console-body .fader-box{touch-action:none!important;cursor:ns-resize!important} +.console-body .fader-box:focus-within{outline:1px solid #80b9c8!important;outline-offset:-1px} +.console-body .gain-scale-travel{top:31px!important;bottom:31px!important} +.console-body .fader-head{background:#07151b!important;box-shadow:inset 0 1px 3px #000b!important} +.console-body.plugin-open #viewport{margin-right:0!important} +.plugin-browser{position:absolute!important;z-index:90!important;top:36px!important;right:12px!important;left:auto!important;bottom:12px!important;width:min(440px,calc(100% - 40px))!important;max-width:440px!important;max-height:calc(100% - 48px)!important;border:1px solid #577084!important;border-radius:6px!important;background:#192933!important;box-shadow:0 12px 32px #000a!important;overflow:hidden!important} +.plugin-browser[hidden],.fast-picker[hidden]{display:none!important} +.plugin-scan-settings{padding:7px 10px;flex:none;display:flex;flex-direction:column;gap:5px;border-top:1px solid #35505d;background:#172630} +.plugin-scan-settings .scan-title{font-size:10px;color:#a6c5d4} +.scan-paths{display:flex;flex-direction:column;gap:3px;max-height:58px;overflow:auto} +.scan-path{display:flex;gap:7px;min-width:0;font-size:10px;align-items:center} +.scan-path>span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} +.scan-path small{color:#89c1cf}.scan-path button{background:transparent;border:0} +.scan-add{display:flex;gap:5px}.scan-add input{flex:1;min-width:0;height:25px;padding:0 5px;color:#e3f0f5;background:#091922;border:1px solid #40616f}.scan-add button{font-size:10px} +.scan-status{font-size:10px;color:#a8bdc8} +.fast-picker{position:absolute;z-index:100;left:24px;top:110px;width:302px;max-width:calc(100% - 40px);background:#172a34;border:1px solid #587e8e;border-radius:5px;box-shadow:0 10px 25px #000b;overflow:hidden} +.fast-head{display:flex;align-items:center;justify-content:space-between;gap:7px;height:34px;padding:0 9px;background:#203944;border-bottom:1px solid #395e6b;font-weight:600} +.fast-head span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fast-head button{background:transparent;border:0;font-size:20px;color:#ddf1f5} +#fastSearch{display:block;width:calc(100% - 14px);height:30px;margin:7px;padding:0 8px;background:#061820;border:1px solid #547486;border-radius:3px} +.fast-results{min-height:58px;max-height:270px;display:flex;flex-direction:column;gap:2px;overflow:auto;padding:3px 6px 6px} +.fast-effect{width:100%;min-height:29px;padding:5px 7px;display:flex;gap:6px;align-items:center;text-align:left;background:#213844;border:1px solid #305365} +.fast-effect:hover,.fast-effect:focus-visible{background:#365d6b;border-color:#83c8d4} +.fast-effect-title{flex:1;min-width:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;color:#a8eac5} +.fast-effect-kind{color:#a5bfc8;font-size:9px}.fast-star{color:#e9c771}.fast-empty{padding:15px;color:#9eafb7} +.fast-foot{height:32px;display:flex;gap:7px;align-items:center;padding:0 8px;border-top:1px solid #355363;color:#91acb8;font-size:9px} +.fast-foot button{margin-left:auto;border:0;background:transparent;color:#85d7f1} + + +/* V5 live surface: more FX rack where vertical room exists, no forced tall rack at 768px. */ +.console-body:not(.collapsed-fx){--fx-h:clamp(155px,24vh,225px)!important} +.console-body.collapsed-fx{--fx-h:23px!important} + +/* V6 CONSOLIDATED COLOR/MATERIAL SYSTEM — owner-approved old chrome with new Console UX. + Design tokens: navy metal body + two-tone channel nameplates; BTN-180 plastic face. + No heavy card shadows on the mixer; active colors are state/identity only. */ +:root{ + --am-metal-base:#0b161e; + --am-metal-panel:#14232c; + --am-metal-raised:#20313b; + --am-metal-edge:#334956; + --am-metal-inset:#030a0f; + --am-text-primary:#dae9ef; + --am-text-muted:#94b1bd; + --am-accent:#66cbdd; + --am-crystal:#e7eff0; + --b180-off:var(--am-crystal); + --b180-edge:#899aa0; + --b180-off-ink:#12212a; +} +html,body{background:var(--am-metal-base)!important;color:var(--am-text-primary)} +.app{background:var(--am-metal-base)!important} +.window-title{ + height:29px!important;background:linear-gradient(#172833,#0c1922)!important; + border-bottom:1px solid #293c47!important;color:var(--am-text-primary)!important; +} +.window-title .logo{color:#75d4ec!important} +.window-title .file-name{color:#b8cbd4!important} +.window-title .study{color:#7f9eaa!important} +.command-bar{ + height:44px!important;min-height:44px!important;flex:0 0 44px!important; + display:flex!important;align-items:center!important;gap:8px!important; + background:linear-gradient(#263742,#182832 52%,#101e27)!important; + border-top:1px solid #44525b!important;border-bottom:1px solid #030b10!important; + box-shadow:inset 0 1px #4b657044,inset 0 -1px #0009!important; +} +.command-bar>*,.command-bar>label,.command-bar>.sep{ + align-self:center!important;vertical-align:middle!important; +} +.command-bar .tool.btn-180, +.command-bar .more-tools summary.tool.btn-180, +.more-tools-panel button.tool.btn-180{ + --b180-color:var(--am-crystal); + --b180-border:#87969c; + --b180-ink:#12212a; + display:inline-flex!important;align-items:center!important;justify-content:center!important; + height:29px!important;min-height:29px!important;max-height:29px!important; + flex:0 0 auto!important;min-width:0!important; + padding:0 10px!important;font:700 10px/1 Arial,Helvetica,sans-serif!important; + letter-spacing:.11px!important;white-space:nowrap!important;text-transform:none!important; + background:var(--b180-color)!important;color:var(--b180-ink)!important; + border:1px solid var(--b180-border)!important;box-shadow:var(--b180-shadow-surface)!important; + text-shadow:0 1px #fff5!important;border-radius:3px!important; +} +.command-bar .tool.btn-180:hover:not(:disabled), +.command-bar .more-tools summary.tool.btn-180:hover{ + --b180-color:#f3f9fa; + --b180-border:#a6b9bd; +} +.command-bar .tool.btn-180.active, +.command-bar .tool.btn-180[aria-pressed="true"], +.command-bar .more-tools[open] summary.tool.btn-180{ + --b180-color:#aee7ea;--b180-border:#5d9eac;--b180-ink:#0c2932; +} +.command-bar .tool.btn-180:active:not(:disabled){ + transform:translateY(1px)!important; + box-shadow: + inset 3px 2px 2px -1px rgba(0,0,0,.50), + inset 0 0 1px 0 rgba(255,255,255,.14), + inset 0 1px 15px rgba(0,0,0,.29), + inset 0 -1px 2px rgba(0,0,0,.32), + 0 0 0 1px var(--b180-border), + 0 1px 1px rgba(0,0,0,.28), + 0 2px 3px rgba(0,0,0,.13)!important; +} +.command-bar .toolbar-select, +.command-bar .density-select{ + height:29px!important;min-height:29px!important;max-height:29px!important; + box-sizing:border-box!important;margin:0!important; + background-color:#0c1a23!important;color:#d9e8ef!important; + border:1px solid #506370!important;border-radius:3px!important; + font:500 11px/1 "Segoe UI",Arial,sans-serif!important; + padding:0 20px 0 7px!important;align-self:center!important; +} +.command-bar .toolbar-label{ + display:inline-flex!important;align-items:center!important;justify-content:center!important; + min-height:29px!important;height:29px!important;font:600 9px/1 "Segoe UI",Arial,sans-serif!important; + letter-spacing:.055em!important;color:#a7bdc8!important; +} +.command-bar .sep{height:18px!important;margin:0 1px!important;background:#46607077!important} +.command-bar .bank-arrow{ + width:31px!important;min-width:31px!important;max-width:31px!important; + height:29px!important;padding:0!important; +} +.command-bar .bank-arrow svg{ + width:24px!important;height:24px!important;display:block!important; + color:#1f1f1f!important;fill:#1f1f1f!important; + flex:none!important;pointer-events:none!important; +} +.command-bar .bank-arrow:disabled{opacity:.54!important} +.command-bar .short-help{color:#91a9b6!important} +.mixer-title{ + height:25px!important;flex:0 0 25px!important; + background:linear-gradient(#1e303b,#101f29)!important; + border-top:1px solid #324653!important;border-bottom:1px solid #040c11!important; + color:#c5dde7!important; +} +.mixer-title .accent{background:#6bccdc!important} +.mixer-title .right{color:#90aab7!important} +.console-pane,.console-body,.tracks-viewport{background:var(--am-metal-base)!important} +.console-body{--identity-h:29px!important;--footer-h:50px!important} +.console-body .rail-cell.identity{ + display:flex!important;height:var(--identity-h)!important;flex:0 0 var(--identity-h)!important; + align-items:center;justify-content:center;background:linear-gradient(#2b414e,#122631)!important; + color:#d9edf3!important;font:600 10px/1 Arial,sans-serif!important; + border-bottom:2px solid #61c9de!important; +} +.console-body .strip{ + --ch:var(--track-color,#5f91ad); + background:linear-gradient(90deg,#101f28 0%,#172732 9%,#16232c 88%,#101e26)!important; + border-right:1px solid #040c12!important; + box-shadow:inset 1px 0 #546f7940!important; +} +.console-body .strip.selected{ + background:linear-gradient(90deg,#192f39,#1b3039 50%,#14232c)!important; + box-shadow:inset 2px 0 #8ed1e2!important; +} +.console-body .strip-identity-top{ + width:100%!important;min-width:0!important;flex:0 0 var(--identity-h)!important; + height:var(--identity-h)!important;min-height:var(--identity-h)!important; + display:grid!important;grid-template-columns:auto minmax(0,1fr) 19px!important; + column-gap:5px!important;align-items:center!important;padding:0 6px!important; + margin:0!important;border:0!important;border-radius:0!important; + border-bottom:2px solid var(--ch)!important; + color:#f3f9fb!important; + background: + linear-gradient(180deg,color-mix(in srgb,var(--ch) 78%,#1f3946), + color-mix(in srgb,var(--ch) 56%,#07131b))!important; + box-shadow:inset 0 1px #ffffff36,inset 0 -1px #0008!important; + font:600 10px/1.1 "Segoe UI",Arial,sans-serif!important; + text-align:left!important;cursor:pointer!important;text-shadow:0 1px #0009!important; +} +.console-body .strip-identity-top:hover{filter:brightness(1.10)!important} +.console-body .strip-identity-top .identity-number{ + opacity:.89!important;letter-spacing:.025em!important; + font:700 9px/1 Arial,sans-serif!important;white-space:nowrap!important; +} +.console-body .strip-identity-top .identity-name{ + overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important; + font-weight:600!important;font-size:11px!important;text-align:center!important; +} +.console-body .strip-identity-top .identity-symbol{ + display:flex;align-items:center;justify-content:center; + width:19px;height:22px;font-size:14px!important;line-height:1!important; +} +.console-body .strip .route-section, +.console-body .strip .fx-section, +.console-body .strip .send-section, +.console-body .strip .pan-section, +.console-body .strip .switch-section{ + background:#152631!important; +} +.console-body .strip .route-section{background:linear-gradient(#142732,#11212b)!important} +.console-body .strip .fx-section{background:#11222c!important} +.console-body .strip .send-section{background:#15252e!important} +.console-body .strip .pan-section{background:#172833!important} +.console-body .strip .switch-section{background:#162731!important} +.console-body .strip .subhead{background:#10222c!important} +.console-body .strip .section{border-bottom:1px solid #34515e44!important} +.console-body .route-section .route-select{color:#e0eff4!important;background-color:#0c1d27!important;border-color:#34515f!important} +.console-body .strip .fader-section{background:#0c1922!important} +.console-body .strip .fader-head{background:#07131a!important} +.console-body .strip .bottom-section{ + background:#0c1a23!important;padding:0 2px 2px!important; + height:var(--footer-h)!important;flex:0 0 var(--footer-h)!important; +} +.console-body .strip .db-value{height:15px!important;min-height:15px!important;flex:0 0 15px!important;font-size:10px!important} +.console-body .strip .footer-label{ + position:relative!important;display:grid!important; + grid-template-columns:minmax(0,1fr) 23px!important; + grid-template-rows:1fr!important;align-items:center!important; + height:33px!important;min-height:33px!important;flex:0 0 33px!important; + border:0!important;border-top:1px solid #ffffff3d!important; + border-bottom:3px solid var(--ch)!important; + border-radius:1px!important;overflow:hidden!important; + background: + linear-gradient(180deg,color-mix(in srgb,var(--ch) 74%,#1c3540), + color-mix(in srgb,var(--ch) 51%,#091820))!important; + box-shadow:inset 0 1px #ffffff22,inset 0 -1px #0006!important; +} +.console-body .strip .footer-label .name{ + display:block!important;min-width:0!important; + overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important; + color:#f6fbff!important;font:600 11px/1.2 "Segoe UI",Arial,sans-serif!important; + padding:0 2px 0 6px!important;text-shadow:0 1px 1px #000a!important; + text-align:center!important;cursor:pointer!important; +} +.console-body .strip .footer-label .footer-icon{ + display:flex;align-items:center;justify-content:center; + width:21px;height:100%!important;font-size:15px!important;line-height:1!important; + color:#fff!important;text-shadow:0 1px #0007; + cursor:pointer; +} +.console-body .strip .footer-label .color-strip{display:none!important} +.console-body .strip.master .footer-label, +.console-body .strip.bus .footer-label, +.console-body .strip.fx .footer-label{background:linear-gradient(180deg,color-mix(in srgb,var(--ch) 74%,#1c3540),color-mix(in srgb,var(--ch) 51%,#091820))!important} +.console-body .switch.btn-180{ + --b180-color:var(--am-crystal); + --b180-border:#899aa0; + --b180-ink:#12212a; + background:var(--b180-color)!important;border-color:var(--b180-border)!important; + color:var(--b180-ink)!important; + box-shadow:var(--b180-shadow-surface)!important; + text-shadow:0 1px #fff7!important; +} +.console-body .switch.btn-180:not(.on):hover{--b180-color:#f4f9fa;--b180-border:#a5b6bb} +.console-body .switch.btn-180.on.mute{--b180-color:var(--b180-on-mute);--b180-border:#b14a5f;--b180-ink:#32151e} +.console-body .switch.btn-180.on.solo{--b180-color:var(--b180-on-solo);--b180-border:#a48337;--b180-ink:#2b210b} +.console-body .switch.btn-180.on.cue{--b180-color:var(--b180-on-cyan);--b180-border:#38909e;--b180-ink:#12323c} +/* Channel identity editor: same glass/metal background as plugin manager, not generic modal. */ +.channel-identity{ + position:absolute;z-index:115;left:28px;top:100px;width:302px;max-width:calc(100% - 24px); + padding:10px;display:flex;flex-direction:column;gap:7px; + background:linear-gradient(#213642,#132630)!important; + border:1px solid #688595;border-radius:5px; + box-shadow:0 14px 28px #000b,0 0 0 1px #08131b; + color:#dbe8ee; +} +.channel-identity[hidden]{display:none!important} +.identity-head{display:flex;align-items:center;justify-content:space-between;min-height:23px;color:#e5f2f7;font:600 11px/1 "Segoe UI",Arial,sans-serif} +.identity-head #identityClose{background:transparent;border:0;color:#d9e9f1;font-size:19px;padding:0 5px} +.identity-label{font:600 9px/1 Arial,sans-serif;letter-spacing:.07em;color:#a8c9d5} +#identityName{width:100%;height:30px;background:#07151e;border:1px solid #557380;border-radius:3px;color:#e9f4f7;padding:0 8px;font-size:11px} +.identity-icons{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px} +.identity-icon{height:30px;display:flex;align-items:center;justify-content:center;font-size:16px;background:#283a45;color:#eff9fc;border:1px solid #4c6571;border-radius:3px} +.identity-icon.selected{background:#466270;border-color:#b7e1ef;box-shadow:inset 0 0 0 1px #bedde8} +.identity-colors{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px} +.identity-swatch{height:24px;background:var(--choice);border:2px solid #0d1d27;border-radius:3px;box-shadow:inset 0 1px #ffffff59,0 1px #0009} +.identity-swatch.selected{outline:2px solid #effbff;outline-offset:1px} +.identity-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:3px} +.identity-actions .btn-180{height:29px!important;min-height:29px!important;min-width:75px!important;font-size:10px!important;--b180-color:var(--am-crystal);--b180-border:#86969e} +#identitySave{--b180-color:#a7e4eb;--b180-border:#5b9fae} +@media(max-width:1100px){ + .command-bar{gap:4px!important;padding:0 5px!important} + .command-bar .tool.btn-180{padding:0 7px!important} + .command-bar .toolbar-label{font-size:8px!important} + .command-bar .sep{display:none} +} + + +/* V7 CRITICAL VISUAL REBALANCE — measured against the 1666x888 owner screenshot. + Hierarchy: chrome header > route > compact FX insert rack > sends/PAN > direct + mute/solo/PFL > tactile fader + peak meters. NO web-style blue black voids. */ +:root { + --am-metal-base:#15232c; + --am-metal-panel:#22333d; + --am-metal-raised:#2b3f4b; + --am-metal-edge:#41515b; + --am-metal-inset:#060d12; + --am-text-primary:#e1ebee; + --am-text-muted:#afc0c6; + --am-accent:#6cb9ca; +} +/* CSS variable on parent rail and strips drives identical FX geometry. */ +.console-body:not(.collapsed-fx){--fx-h:clamp(111px,13.5vh,137px)!important} +.console-body.collapsed-fx{--fx-h:23px!important} +.console-body .strip{ + background:linear-gradient(90deg,#1e2e39 0%,#2a3c46 10%,#293943 52%,#25343e 92%,#1d2b35 100%)!important; + border-right:1px solid #0b151c!important; + box-shadow:inset 1px 0 #74889439,inset -1px 0 #0b161c!important; +} +.console-body .strip.selected{ + position:relative!important;z-index:2!important; + background:linear-gradient(90deg,#22343f,#30434c 12%,#2c3e48 90%,#20303a)!important; + box-shadow:inset 0 0 0 1px var(--ch),inset 0 0 0 2px #111e26b5!important; +} +.console-body .strip .route-section{background:linear-gradient(#293b46,#23343d)!important} +.console-body .strip .fx-section{ + background:linear-gradient(#1f303a,#22333c)!important; + height:var(--fx-h)!important;min-height:var(--fx-h)!important;flex:0 0 var(--fx-h)!important; +} +.console-body .strip .send-section{background:#263843!important} +.console-body .strip .pan-section{background:#293b46!important} +.console-body .strip .switch-section{background:#2c3e48!important} +.console-body .strip .subhead{background:linear-gradient(#233946,#1c2e39)!important} +.console-body .strip .section{ + border-bottom:1px solid #0d2029b0!important; + box-shadow:inset 0 -1px #73899529!important; +} +.console-body .strip .fxslot-list{background:transparent!important;overflow-y:auto!important;overflow-x:hidden!important;scrollbar-width:thin} +.console-body .strip .fxslot-row{background:#1b2c35!important;border-bottom:1px solid #475b6440!important} +.console-body .strip .fxslot-row:hover{background:#304956!important} +.console-body .strip .fx-pick{font-weight:550!important;font-size:10px!important;color:#c4dfd0!important} +.console-body .strip .fx-pick.empty{color:#80ccdf!important} +.console-body .strip .route-select{background-color:#132630!important;border-color:#526672!important} +.console-body .strip .route-caption{color:#b1c5cf!important} +/* Old glossy plastic buttons looked bolted on from a different application. + All header and live controls share fine-edged satin/brushed steel. */ +.command-bar{ + background:linear-gradient(#334752,#243743 46%,#1d303a)!important; + border-top:1px solid #65808c3b!important; + border-bottom:1px solid #0c171f!important; +} +.command-bar .tool, +.command-bar .more-tools summary.tool, +.more-tools-panel .tool, +.identity-actions .console-control{ + display:inline-flex!important;align-items:center!important;justify-content:center!important; + min-width:0!important;height:29px!important;min-height:29px!important;max-height:29px!important; + border:1px solid #536773!important;border-radius:3px!important; + background:linear-gradient(#405460,#2c3f4c 47%,#263845 48%,#314550)!important; + color:#e6eef2!important;text-shadow:0 1px #000b!important; + box-shadow:inset 0 1px #ffffff23,inset 0 -1px #101c25,0 1px 1px #0005!important; + font:600 10px/1.1 "Segoe UI",Arial,sans-serif!important; + letter-spacing:0!important;padding:0 10px!important;text-transform:none!important; + filter:none!important;transform:none!important; +} +.command-bar .tool:hover:not(:disabled), +.more-tools-panel .tool:hover:not(:disabled), +.identity-actions .console-control:hover{ + background:linear-gradient(#4b6571,#354c59 48%,#304651 49%,#3a5360)!important; + color:#fff!important; +} +.command-bar .tool:active:not(:disabled),.identity-actions .console-control:active{ + background:linear-gradient(#1a2b35,#304350)!important; + box-shadow:inset 1px 2px 3px #0009,0 1px #67808c22!important; +} +.command-bar .tool[aria-pressed="true"],.command-bar .more-tools[open] summary.tool{ + background:linear-gradient(#406575,#244956)!important; + border-color:#5595a8!important;color:#c7eff9!important; +} +.command-bar .bank-arrow{padding:0!important;width:31px!important} +.command-bar .bank-arrow svg{display:block!important;width:24px!important;height:24px!important} +.command-bar .bank-arrow svg path{fill:#e0eef3!important} +/* Preserve user's exact SVG path and element fill; display on dark face via CSS path override. */ +.command-bar .toolbar-select,.command-bar .density-select{background-color:#132733!important;border-color:#5a7280!important} +.console-body .switch-section .switch{ + display:flex!important;align-items:center!important;justify-content:center!important; + width:100%!important;min-width:0!important;height:29px!important;min-height:29px!important; + flex:none!important;padding:0 2px!important; + background:linear-gradient(#52616a,#334751 47%,#2b3d47 48%,#3e515d)!important; + border:1px solid #617681!important;border-radius:3px!important; + color:#e8f3f7!important;text-shadow:0 1px #000a!important; + box-shadow:inset 0 1px #ffffff31,inset 0 -1px #0f1c25,0 1px 2px #0006!important; + font:700 10px/1 "Segoe UI",Arial,sans-serif!important;letter-spacing:0!important; + filter:none!important; +} +.console-body .switch-section .switch:hover{border-color:#91a9b3!important;filter:brightness(1.05)!important} +.console-body .switch-section .switch.on.mute{ + background:linear-gradient(#ad5660,#7f303c)!important;border-color:#c16e78!important;color:#fff4f4!important; +} +.console-body .switch-section .switch.on.solo{ + background:linear-gradient(#d3b365,#a58439)!important;border-color:#e9cb80!important;color:#1d251b!important;text-shadow:0 1px #ffffff66!important; +} +.console-body .switch-section .switch.on.cue{ + background:linear-gradient(#64b9c3,#307783)!important;border-color:#85d4da!important;color:#081b22!important;text-shadow:0 1px #ffffff44!important; +} +/* User screenshot: lighten chassis, keep recess visibly DARKER and deeply machined. */ +.console-body .strip .fader-section{ + background:linear-gradient(90deg,#253640,#30434e 15%,#2c3f49 78%,#22343e)!important; + padding:6px 6px 6px!important; +} +.console-body .fader-workspace{grid-template-columns:49px minmax(35px,1fr) 25px!important;gap:2px!important} +.console-body .fader-box{ + background:linear-gradient(90deg,#111f27,#1b2c35 18%,#1d3038 80%,#101e26)!important; +} +.console-body .fader-box::before{ + width:min(36px,100%)!important;border-radius:5px!important; + background:linear-gradient(90deg,#050b10 0%,#0d1a22 14%,#101d25 50%,#0b1720 86%,#040a0f 100%)!important; + box-shadow:inset 2px 1px 5px #000c,inset -1px 0 #7d899122,0 1px #ffffff20!important; +} +.console-body .fader-box::after{ + background-color:#010508!important;background-image:none!important; + top:27px!important;bottom:27px!important; + width:5px!important;box-shadow:inset 1px 0 #000,inset -1px 0 #1b2b32!important; +} +.console-body .fader-travel{top:27px!important;bottom:27px!important} +.console-body .fader-travel .cap{ + width:26px!important;height:55px!important; + background:var(--ari-silver) center/26px 55px no-repeat!important; + image-rendering:auto!important; + filter:drop-shadow(1px 2px 1px #0008)!important; +} +.console-body .strip.master .fader-travel .cap{background:var(--ari-rose) center/26px 55px no-repeat!important} +.console-body .fader-box .fader{top:27px!important;bottom:27px!important;height:calc(100% - 54px)!important} +.console-body .gain-scale-travel{top:27px!important;bottom:27px!important} +.console-body .meter-box{ + background:linear-gradient(90deg,#050d13 0%,#010507 25%,#03080c 72%,#152630 100%)!important; + box-shadow:inset 2px 1px 5px #0009,inset 0 0 0 1px #3f5b6744!important; +} +.console-body .meter-box .vu-bars{ + background:linear-gradient(90deg,#111f27,#010508 24%,#010507 78%,#101c23)!important; +} +.console-body .fader-head{ + background:linear-gradient(#07151d,#0a1c26)!important; + box-shadow:inset 0 1px 4px #000c!important; +} +.console-body .strip .bottom-section{background:#253944!important} +/* Slider: original assets, smaller thumb, deliberately 3px lower than the rail center. */ +.console-body .center-pan::-webkit-slider-thumb, +.console-body .ari-horizontal::-webkit-slider-thumb{ + width:15px!important;height:32px!important;margin-top:-12px!important; + background:var(--ari-pan) center/15px 32px no-repeat!important; + border:0!important;box-shadow:none!important; +} +.console-body .center-pan::-moz-range-thumb, +.console-body .ari-horizontal::-moz-range-thumb{ + width:15px!important;height:32px!important; + background:var(--ari-pan) center/15px 32px no-repeat!important; +} +.console-body .pan-control .center-pan{margin-top:3px!important} +.console-body .sendlevel .ari-horizontal{margin-top:3px!important} +/* Modeless Plugin Manager — draggable and resizable, no scrim, no forced strip reflow. */ +.plugin-browser{ + position:absolute!important;right:14px!important;left:auto;top:40px!important;bottom:auto!important; + width:min(408px,calc(100% - 32px))!important; + height:min(536px,calc(100% - 54px))!important; + max-height:calc(100% - 54px)!important; + resize:both!important;min-width:min(310px,calc(100% - 32px))!important;min-height:210px!important; + border:1px solid #637f8b!important;border-radius:6px!important; + background:#1b2b35!important;box-shadow:0 10px 26px #000a,0 0 0 1px #0d1c25!important; + overflow:hidden!important;pointer-events:auto!important; +} +.plugin-browser:not([hidden]) .plugin-head{cursor:move!important;touch-action:none!important;user-select:none!important} +.plugin-head{background:linear-gradient(#3b5260,#223944)!important} +.plugin-head-title{pointer-events:none!important} +.plugin-head button{cursor:pointer!important} +.plugin-minimize{height:28px;min-width:28px;background:#324956;border:1px solid #58717c;color:#dbeaf0;font-size:17px;border-radius:3px} +.plugin-browser.minimized{ + height:48px!important;min-height:48px!important;max-height:48px!important;resize:none!important; +} +.plugin-browser.minimized > :not(.plugin-head){display:none!important} +.plugin-browser[hidden]{display:none!important} +/* Header drag updates inline left/top: must overrule old fixed right/top CSS !important. */ +.plugin-browser[style*="left:"]{right:auto!important} +/* Plugin drag coordinate is an inline important top; do not override it. */ + + +/* V7 rendered-Chromium finding: .console-body .switch{flex:1 1 auto} + also matched the LEFT RAIL .rail-cell.switch and stretched M/S/C by 127px. + Pin the label to the same immutable physical row as the strip controls. */ +.console-body .section-rail .rail-cell.switch{ + flex:0 0 var(--switch-h)!important; + height:var(--switch-h)!important; + min-height:var(--switch-h)!important; + max-height:var(--switch-h)!important; + padding:0!important; + align-items:center!important;justify-content:center!important; + background:#273b46!important;color:#a7bfca!important; + border-bottom:1px solid #172730!important; + box-shadow:inset 0 1px #ffffff12!important; +} + +/* V8: Collapse hides the content, not merely the container's height. + Earlier high-specificity route/select and send/display rules forced expanded + controls into 23px collapsed rails. All strip + rail heights use one token. */ +.console-body.collapsed-route .strip .route-section{padding:0 4px!important} +.console-body.collapsed-route .strip .route-section .route-field{display:none!important} +.console-body.collapsed-route .strip .route-section .route-top{ + height:22px!important;min-height:22px!important;flex:0 0 22px!important} +.console-body.collapsed-fx .strip .fxslot-list{display:none!important} +.console-body.collapsed-fx .strip .fx-section{padding:0 3px!important} +.console-body.collapsed-fx .strip .subhead{ + height:22px!important;min-height:22px!important;flex:0 0 22px!important} +.console-body.collapsed-send .strip .send-section{padding:0 3px!important} +.console-body.collapsed-send .strip .send-section .send-select, +.console-body.collapsed-send .strip .send-section .sendlevel{display:none!important} +.console-body.collapsed-send .strip .send-header{ + height:22px!important;min-height:22px!important;flex:0 0 22px!important} +.console-body.collapsed-send .strip .send-header .send-slot, +.console-body.collapsed-send .strip .send-header .mini.pre{display:none!important} +.console-body.collapsed-send .strip .send-header .send-compact{ + display:block!important;flex:1 1 0!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} +.console-body.collapsed-send .strip .send-header .push{display:none!important} +.console-body.collapsed-send .strip .send-header .sendtag{ + max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} +.console-body .section-rail .rail-cell.route{height:var(--route-h)!important;flex:0 0 var(--route-h)!important} +.console-body .section-rail .rail-cell.fx{height:var(--fx-h)!important;flex:0 0 var(--fx-h)!important} +.console-body .section-rail .rail-cell.send{height:var(--send-h)!important;flex:0 0 var(--send-h)!important} + +/* V9: CONSOLE MECHANICAL LAYOUT — Rack owns freed height, never the live fader. + Fader height is invariant when ROUTE / SEND are expanded/collapsed. Master and + rail are siblings in the same flex-height contract, not independent rulers. + The rack becomes the variable-height processing workspace. */ +.console-body{--fader-fixed-h:clamp(198px,31vh,300px)} +.console-body:not(.collapsed-fx) .strip .fader-section{ + flex:0 0 var(--fader-fixed-h)!important; + height:var(--fader-fixed-h)!important; + min-height:var(--fader-fixed-h)!important; + max-height:var(--fader-fixed-h)!important; +} +.console-body:not(.collapsed-fx) .section-rail .rail-cell.fader{ + flex:0 0 var(--fader-fixed-h)!important; + height:var(--fader-fixed-h)!important; + min-height:var(--fader-fixed-h)!important; + max-height:var(--fader-fixed-h)!important; +} +.console-body:not(.collapsed-fx) .strip .fx-section{ + flex:1 1 var(--fx-h)!important; + height:auto!important;min-height:23px!important;max-height:none!important; + overflow:hidden!important; +} +.console-body:not(.collapsed-fx) .section-rail .rail-cell.fx{ + flex:1 1 var(--fx-h)!important; + height:auto!important;min-height:23px!important;max-height:none!important; +} +.console-body:not(.collapsed-fx) .strip .fxslot-list{ + display:block!important;flex:1 1 0!important; + min-height:0!important;max-height:none!important; + overflow-y:auto!important;overflow-x:hidden!important; + overscroll-behavior:contain; +} +.console-body:not(.collapsed-fx) .strip .fxslot-row{ + height:25px!important;min-height:25px!important;flex:0 0 25px!important; +} +.console-body:not(.collapsed-fx) .strip .fx-pick{font-size:11px!important} +.console-body:not(.collapsed-fx) .strip .fx-section .subhead{ + flex:0 0 25px!important;height:25px!important;min-height:25px!important; + color:#e3f0f5!important; +} +.console-body.collapsed-fx .strip .fx-section, +.console-body.collapsed-fx .section-rail .rail-cell.fx{ + flex:0 0 23px!important;height:23px!important;min-height:23px!important; + max-height:23px!important; +} +/* Only if the operator intentionally COLLAPSES FX does the fader absorb slack. */ +.console-body.collapsed-fx .strip .fader-section, +.console-body.collapsed-fx .section-rail .rail-cell.fader{ + flex:1 1 var(--fader-fixed-h)!important; + height:auto!important;min-height:130px!important;max-height:none!important; +} +@media(max-height:680px){ + .console-body{--fader-fixed-h:clamp(135px,28vh,190px);--route-h:56px;--pan-h:36px;--switch-h:40px;--footer-h:45px} + .console-body:not(.collapsed-fx) .strip .fxslot-row{height:22px!important;min-height:22px!important} +} +/* V9: glass LCD meter module — fixed calibration zones, distinct dBFS ruler, + independent mono/stereo lanes and native-only eventual signal source. + No backdrop filters, canvas, gradients animated per frame or JS layout pass. */ +.console-body .strip .meter-box{ + border:1px solid #60778460!important; + border-radius:5px!important; + background:linear-gradient(90deg,#091720 0%,#01070c 25%,#06151c 76%,#1b3039)!important; + box-shadow:inset 2px 2px 5px #000c,inset -1px 0 #afc4cf27,0 1px #ffffff19!important; +} +.console-body .strip .meter-box .vu-bars{ + position:relative;isolation:isolate; + background:linear-gradient(90deg,#071620,#020b10 28%,#01090e 71%,#152b35)!important; + border-left:1px solid #37505b99!important;border-right:1px solid #253b45!important; + box-shadow:inset 1px 0 3px #000,inset -1px 0 2px #000!important; +} +.console-body .strip .meter-box .vu-bars::after{ + content:"";position:absolute;inset:9px 0 10px;z-index:5;pointer-events:none; + border-radius:3px; + background: + linear-gradient(103deg,#e4faff17 0%,#bce7fa08 22%,transparent 44%,#d3f2ff0e 62%,transparent 86%), + linear-gradient(to bottom,#ffffff12 0%,transparent 14%,transparent 86%,#05101799 100%); + box-shadow:inset 1px 0 #d1f3fa29,inset -1px 0 #000c,inset 0 1px #bdd7e422; +} +.console-body .strip .meter-box .meter-lane{ + background:linear-gradient(90deg,#040e12,#071c19 55%,#071117)!important; + border-radius:2px!important;box-shadow:inset 1px 1px 3px #000,inset -1px 0 2px #000!important; +} +.console-body .strip .meter-box .meter-fill{ + background:linear-gradient(to top, + #08a862 0%,#1de483 43%,#6cf178 64%,#dbdf39 76%,#ffbc38 87%,#ff7b30 94%,#fa4545 100%)!important; + filter:none!important;box-shadow:inset 1px 0 #cfffff30,inset -1px 0 #020b0766!important; +} +.console-body .strip .meter-box .meter-lane::before{ + background:repeating-linear-gradient(to top,transparent 0px,transparent 5px,#010d13df 5px,#010d13df 7px)!important; +} +.console-body .strip .meter-box .meter-lane::after{ + content:"";position:absolute;inset:0;z-index:3;pointer-events:none; + background:linear-gradient(90deg,#eaffff28 0%,transparent 30%,transparent 73%,#0009 100%); +} +.console-body .strip .meter-box .vu-scale{color:#bfd4df!important;text-shadow:0 1px #000} +.console-body .strip .meter-box .vu-tick span{font:9px/11px Consolas,monospace!important} +.console-body .strip .meter-box .peak{ + background:linear-gradient(#381417,#12090b)!important;border:1px solid #754040!important; + box-shadow:inset 0 1px #bd515044!important;border-radius:2px!important; +} +.console-body .strip .meter-box .peak.clipping{ + background:linear-gradient(#ff958b,#f0342c 47%,#9d1319)!important; + border-color:#ff9a95!important;box-shadow:0 0 3px #f33b30,inset 0 1px #ffd1c2!important; +} +/* Hardware continuity: satin upper plates, subtle milled lines, consistent hierarchy. */ +.console-body .strip .route-section{ + background:linear-gradient(90deg,#1b303b,#304650 12%,#293c46 80%,#1a2b36)!important; +} +.console-body .strip .fx-section{ + background:linear-gradient(90deg,#172a35,#253943 9%,#243741 82%,#162a35)!important; +} +.console-body .strip .send-section{ + background:linear-gradient(90deg,#1e303b,#293e49 12%,#253841 83%,#172c37)!important; +} +.console-body .strip .pan-section{ + background:linear-gradient(90deg,#1d303b,#324753 13%,#2c404a 83%,#20333e)!important; +} +.console-body .strip .subhead,.console-body .strip .send-header{ + border-bottom:1px solid #101e29!important;box-shadow:inset 0 -1px #7f9ba920!important; +} +.console-body .strip .fxslot-row{ + background:linear-gradient(180deg,#253b46,#1b2d38)!important; + border-bottom:1px solid #3c586642!important; +} +.console-body .strip .fxslot-row:hover{background:linear-gradient(#34505f,#263f4d)!important} +.console-body .strip .fxslot-list{scrollbar-color:#668594 #142530!important} +.console-body .strip .fader-head{ + background:linear-gradient(113deg,#030b11,#0e2733 42%,#091b25 72%,#06131b)!important; + border:1px solid #4c6876!important; + box-shadow:inset 0 2px 5px #0009,inset 0 -1px #9cb6c51e,0 1px #ffffff25!important; +} +.console-body .strip .fader-readout{font-variant-numeric:tabular-nums!important;color:#a7f1ff!important} +.console-body .strip .split-count{font:600 9px/1.2 Consolas,monospace;color:#b5e8f1; + border:1px solid #5d8291;border-radius:2px;padding:1px 2px;white-space:nowrap} + +/* V11 — FL-style selectable source/target wiring in the MIDDLE (SEND/BUS) strip. + Only visual reference. Default SEND rack collapsed, its wire tray stays visible. + Do not move hardware faders, clip VU or shrink expandable FX slot rack. */ +.console-body.collapsed-send{--send-h:53px!important} +.console-body:not(.collapsed-send){--send-h:129px!important} +.console-body .section-rail .rail-cell.send{ + height:var(--send-h)!important;min-height:var(--send-h)!important; + flex:0 0 var(--send-h)!important; + background:linear-gradient(#263b45,#1d303a)!important; + color:#a4d6e2!important; +} +.console-body .strip .send-section{ + display:flex!important;flex-direction:column!important; + height:var(--send-h)!important;min-height:var(--send-h)!important; + flex:0 0 var(--send-h)!important;overflow:hidden!important; +} +.console-body .strip .wire-tray{ + display:flex!important;align-items:center!important;justify-content:center!important; + width:100%;min-width:0;min-height:29px;flex:0 0 29px; + margin-top:auto;padding:2px 4px 3px;box-sizing:border-box; + background:linear-gradient(#1b323b,#10242d 40%,#07171e)!important; + border-top:1px solid #63808b66;box-shadow:inset 0 2px #d4f5ff0e; +} +.console-body .strip .wire-socket{ + display:flex;align-items:center;justify-content:center;gap:5px; + flex:1;max-width:100%;min-width:0;height:24px; + border:1px solid #45616f;border-radius:3px; + color:#a7c4cf;background:linear-gradient(#314653,#182e39 48%,#162a34); + box-shadow:inset 0 1px #a9deef2a,0 1px #0009; + font:600 9px/1 Arial,sans-serif!important; + cursor:pointer;user-select:none; +} +.console-body .strip .wire-socket:hover:not(:disabled){ + color:#edfff5;border-color:#9ee6b5;background:linear-gradient(#37534e,#193c38); +} +.console-body .strip .wire-socket .wire-arrow{font-size:14px;font-weight:700;line-height:13px} +.console-body .strip .wire-socket.is-source{ + color:#132d18;border-color:#7dcb6c;background:linear-gradient(#bded9c,#65b96c)!important; + box-shadow:inset 0 1px #efffcb,0 1px #06190c!important; +} +.console-body .strip .wire-socket.is-linked{ + color:#ccffe0;border-color:#64c383;background:linear-gradient(#286b4f,#13432e)!important; + box-shadow:inset 0 1px #b9ffcb24,0 1px #010d05!important; +} +.console-body .strip .wire-socket:disabled{cursor:default;opacity:1} +.console-body .strip .wire-socket:focus-visible{outline:1px solid #c7fbe0;outline-offset:1px} +.wire-legend{ + margin-left:auto;color:#a4e3bd;font:600 10px/1 'Segoe UI',Arial,sans-serif; + border:1px solid #46675c;padding:3px 7px;border-radius:2px; + background:linear-gradient(#1e3730,#142823);white-space:nowrap;overflow:hidden;text-overflow:ellipsis; +} +.mixer-title .wire-legend + .right{margin-left:0} +.tracks-viewport{position:relative!important;isolation:isolate} +.routing-wire-overlay{ + position:absolute;inset:0;width:100%;height:100%;overflow:hidden; + z-index:6;pointer-events:none;contain:paint; +} +@media(max-width:1000px){.wire-legend{max-width:220px}} +@media(max-height:680px){.console-body.collapsed-send{--send-h:49px!important}} + +/* V12 physical console wire strip: FL send-switch affordances, but original ArSonMix tooling. + 53px collapsed row stays visible; FX elastic and hardware fader are untouched. */ +.wire-mode-label{font:600 9px/1 Arial,Helvetica,sans-serif;color:#a4c7d2;white-space:nowrap;margin-left:5px} +.wire-mode-select{height:24px;max-width:146px;min-width:112px;padding:1px 17px 1px 6px; + border:1px solid #4b6370;border-radius:3px;background:linear-gradient(#2c414b,#192e39); + color:#d6e9ec;font:500 10px/1 'Segoe UI',Arial,sans-serif} +.wire-mode-select:hover{border-color:#8bb8c4} +.wire-master{height:24px;min-width:66px;padding:0 7px; + color:#bce9cb;border:1px solid #557a65;border-radius:3px; + background:linear-gradient(#29483b,#182f29);box-shadow:inset 0 1px #c7ffe522,0 1px #030b0d; + font:600 10px/1 Arial,Helvetica,sans-serif!important;white-space:nowrap} +.wire-master[aria-pressed="false"]{color:#a1a6ad;background:linear-gradient(#273037,#1b252b);border-color:#4c5960} +.wire-master:focus-visible,.wire-mode-select:focus-visible{outline:1px solid #b0ecfa;outline-offset:2px} +.console-body .strip .wire-tray{gap:3px!important;padding:2px 3px 3px!important} +.console-body .strip .wire-tray.linked .wire-socket{min-width:29px;flex:1 1 32px;padding:0 2px!important} +.console-body .strip .wire-socket.is-source .wire-arrow{color:#234b25} +.console-body .strip .wire-tray .wire-pot{ + position:relative;flex:0 0 26px;width:26px;height:24px;min-width:26px; + border:0;cursor:ew-resize;display:flex;justify-content:center;align-items:center; +} +.console-body .strip .wire-tray .wire-pot::before{ + content:"";width:22px;height:22px;position:absolute;inset:1px 2px; + border-radius:50%;box-sizing:border-box; + background:conic-gradient(from 225deg,#a8f5b1 0 var(--wire-pct,90.9%),#344d52 var(--wire-pct,90.9%) 75%,transparent 75% 100%); + box-shadow:0 1px 2px #000c,inset 0 0 0 1px #83c79a66;pointer-events:none; +} +.console-body .strip .wire-tray .wire-pot::after{ + content:"";position:absolute;left:11px;top:3px;width:3px;height:8px; + border-radius:1px;background:#c7fdeb;border:1px solid #335b50; + box-shadow:0 0 2px #84efaf;transform-origin:2px 10px; + transform:rotate(var(--wire-deg,110deg));pointer-events:none; +} +.console-body .strip .wire-tray .wire-gain{ + position:absolute;inset:0;width:26px!important;height:24px!important;margin:0; + cursor:ew-resize;opacity:0;z-index:2;appearance:none;-webkit-appearance:none;touch-action:none; +} +.console-body .strip .wire-tray .wire-pot:focus-within{outline:1px solid #b4f4cb;border-radius:50%} +.console-body .strip .wire-tray .wire-disconnect{ + flex:0 0 17px;width:17px;height:21px;min-width:17px;padding:0; + font:600 14px/18px Arial,sans-serif!important;color:#a8c4cb; + border:1px solid #47616a;border-radius:3px;background:linear-gradient(#34444c,#172932); + box-shadow:inset 0 1px #a3bed31c;cursor:pointer; +} +.console-body .strip .wire-tray .wire-disconnect:hover{color:#fff1e5;background:linear-gradient(#80423c,#512521);border-color:#c47365} +.console-body .strip .wire-tray .wire-disconnect:focus-visible{outline:1px solid #ffcaba;outline-offset:1px} +.console-body .strip .wire-tray.linked .wire-label{font-size:8px!important} +.console-body .strip .wire-tray.linked .wire-socket{background:linear-gradient(#316748,#163b2c)!important} +.console-body .strip .wire-tray.linked .wire-arrow{filter:drop-shadow(0 0 2px #7dec9c)} +.console-body .strip .wire-tray .wire-gain:focus-visible{outline:none} +.routing-wire-overlay{filter:drop-shadow(0 0 1.2px #5cc67f40)} +@media(max-width:1250px){.wire-legend{max-width:145px}.wire-mode-select{max-width:112px;font-size:9px}.wire-master{min-width:55px;padding:0 4px}} +@media(max-width:970px){.wire-legend{display:none}.wire-mode-label{display:none}} + +/* V12-P0 CONVERGENCE: native owner's latest passing physical geometry baseline. + The center wire strip costs 30px more than the pre-wire SEND row; recover + its space from compact top chrome and fixed mechanical label wells, not + from FX visibility or any accidental ROUTE-driven fader movement. */ +.window-title{height:23px!important;min-height:23px!important;flex:0 0 23px!important} +.command-bar{height:35px!important;min-height:35px!important;flex:0 0 35px!important} +.status-bar{height:20px!important;min-height:20px!important;flex:0 0 20px!important} +.console-body{ + --identity-h:25px!important;--footer-h:48px!important; + --pan-h:37px;--switch-h:40px; + --p0-fader-standard:clamp(215px,calc(100dvh - 510px),600px); + --p0-fader-h:var(--p0-fader-standard); + --fader-fixed-h:var(--p0-fader-h); /* feeds earlier high-specificity fader selectors */ +} +.console-body:not(.collapsed-send){ + --p0-fader-h:max(150px,calc(var(--p0-fader-standard) - 80px)); +} +@media(max-height:680px){ + .console-body{--p0-fader-standard:clamp(155px,calc(100dvh - 505px),300px)} + .console-body:not(.collapsed-send){--p0-fader-h:max(118px,calc(var(--p0-fader-standard) - 80px))} +} +.console-body .strip .fader-section, +.console-body .section-rail > .rail-cell.fader{ + flex:0 0 var(--p0-fader-h)!important;height:var(--p0-fader-h)!important; + min-height:var(--p0-fader-h)!important;max-height:var(--p0-fader-h)!important; +} +.console-body:not(.collapsed-fx) .strip .fx-section, +.console-body:not(.collapsed-fx) .section-rail > .rail-cell.fx{ + flex:1 1 0px!important;height:auto!important; + min-height:122px!important;max-height:none!important; +} +.console-body .strip .fxslot-list{ + flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important; + scrollbar-width:thin; +} +.console-body.collapsed-fx .strip .fx-section, +.console-body.collapsed-fx .section-rail > .rail-cell.fx{ + flex:0 0 23px!important;height:23px!important;min-height:23px!important;max-height:23px!important; +} +/* When intentionally collapsing the entire FX section, unused room may return + to the physical fader, but never when only ROUTE is collapsed. */ +.console-body.collapsed-fx.collapsed-send .strip .fader-section, +.console-body.collapsed-fx.collapsed-send .section-rail > .rail-cell.fader{ + flex:1 1 0px!important;height:auto!important;max-height:none!important; +} +/* Keep the four visible FX rows ≥88px even while expanded SEND consumes space. */ +.console-body:not(.collapsed-send) .strip .fx-section .subhead{ + flex:0 0 24px!important;height:24px!important;min-height:24px!important; +} + +/* P0 physical center PAN tick: clear C detent without heavy decorative chrome. */ +.console-body .strip .pan-control{position:relative} +.console-body .strip .pan-control::after{ + content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,9px); + height:5px;width:1px;background:#c0d9e7b3;box-shadow:0 0 2px #a6c7d5aa; + pointer-events:none; +} +.console-body .strip .pan-control.is-centered::after{background:#a2e3cf!important} + +/* V13 physical routing bay — no old DAW send form in mixer strips. + Compact: 80px, Expanded: 160px; +80px fold is balanced by P0 fader + budget on expand, preserving the rack's four legible insert rows. */ +.console-body.wire-routing-v13.collapsed-send{--send-h:80px!important} +.console-body.wire-routing-v13:not(.collapsed-send){--send-h:160px!important} +.console-body.wire-routing-v13 .strip .wire-section{ + padding:0!important;position:relative!important; + background:linear-gradient(90deg,#142934 0%,#29404b 8%,#1b323d 51%,#233844 92%,#142732 100%)!important; + border-top:1px solid #7698a353!important; + box-shadow:inset 0 1px #d4f0fa16,inset 0 -1px #020b12a8!important; +} +.console-body.wire-routing-v13 .strip .wire-deck{ + display:flex;position:relative;flex:1 1 0!important;min-height:0!important; + width:100%;flex-direction:column;gap:2px;align-items:flex-start; + padding:5px 6px 2px; + background: + linear-gradient(90deg,#b7e3eb0c,transparent 6%,transparent 92%,#b7e3eb08), + repeating-linear-gradient(90deg,transparent 0 19px,#b6d5de09 19px 20px), + linear-gradient(#0f202a,#0e1c25 52%,#0a1820); + border-bottom:1px solid #354c58; + box-shadow:inset 0 3px 6px #0005,inset 0 1px #60879448!important; + overflow:hidden; +} +.console-body.wire-routing-v13 .strip .wire-deck-label{ + font:600 9px/12px 'Segoe UI',Arial,sans-serif; + color:#adcad6;letter-spacing:.7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; + max-width:100%;opacity:.86; +} +.console-body.wire-routing-v13 .strip .wire-deck-status{ + font:500 9px/12px Consolas,monospace;color:#789ca9;letter-spacing:.2px; + white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis; +} +.console-body.wire-routing-v13 .strip .wire-deck-rail{ + width:100%;height:1px;flex:0 0 1px;position:relative;margin-top:auto; + background:linear-gradient(90deg,transparent,#799ca34f,transparent); +} +.console-body.wire-routing-v13 .strip:has(.wire-socket.is-source) .wire-deck-status{color:#b8edb0} +.console-body.wire-routing-v13 .strip:has(.wire-socket.is-linked) .wire-deck-status{color:#a5dccc} +.console-body.wire-routing-v13 .strip .wire-tray{ + flex:0 0 32px!important;min-height:32px!important;max-height:32px!important; + gap:4px!important;padding:3px 4px 4px!important; + margin:0!important;border-top:1px solid #4a6974!important; + background:linear-gradient(#243a45,#122732 30%,#07151e 100%)!important; + box-shadow:inset 0 1px #b3d8e818,0 -1px #000a!important; +} +.console-body.wire-routing-v13 .strip .wire-socket{ + height:25px!important; + border-radius:4px!important; + box-shadow:inset 0 1px #ecfbff34,0 2px 2px #020a0ed0!important; +} +.console-body.wire-routing-v13 .strip .wire-socket.is-linked{ + box-shadow:inset 0 1px #c8ffd956,0 0 8px #32d17414,0 2px 2px #000a!important; +} +.console-body.wire-routing-v13 .section-rail .rail-cell.send{ + font:600 12px Arial,sans-serif!important; + color:#b1dae4!important; + background:linear-gradient(#263e4a,#112530)!important; + border-top:1px solid #607d8770!important; +} +.console-body.wire-routing-v13 .section-rail .rail-cell.send::after{ + content:"WIRE";display:block;font:600 7px/8px Arial,sans-serif; + color:#78afb5;letter-spacing:.4px; +} +.console-body.wire-routing-v13:not(.collapsed-send) .section-rail .rail-cell.send::after{content:"PATCH"} +.console-body.wire-routing-v13 .strip .send-header, +.console-body.wire-routing-v13 .strip .send-select, +.console-body.wire-routing-v13 .strip .sendlevel, +.console-body.wire-routing-v13 .strip .send-slot{display:none!important} +.console-body.wire-routing-v13 .strip .wire-pot{z-index:7} +.console-body.wire-routing-v13 .strip .wire-disconnect{z-index:7} +.routing-wire-overlay{z-index:6;pointer-events:none!important} +/* Keep compact routing visible on short stage laptops; no legacy form resurfaces. */ +@media(max-height:680px){ + .console-body.wire-routing-v13.collapsed-send{--send-h:58px!important} + .console-body.wire-routing-v13:not(.collapsed-send){--send-h:138px!important} + .console-body.wire-routing-v13 .strip .wire-deck{padding-top:3px} + .console-body.wire-routing-v13 .strip .wire-deck-status{display:none} +} + +/* V13 P0 visual-authority synchronization from approved latest main: + graphite inset well is a flat recessed #142530 metal instrument surface, + NOT the earlier gradient. Keep original 26x55 cap and meter calibration. */ +.console-body .strip .fader-box::before{ + background:#142530!important; + background-image:none!important; + box-shadow:inset 1px 0 #7997a33d,inset -1px 0 #050d14a6!important; +} +/* V13 OPERATOR CONSOLE: flat anodized metal and a STATIONARY lower block. + ROUTE / FX / SEND own the entire flexible upper region; PAN + M/S/PFL + + FADER + footer never resize or move when any section is toggled. Styles + deliberately live at the end, after legacy V9-V12 chrome precedence. */ +.console-body{ + --v13-fader-h:clamp(150px,calc(100dvh - 630px),485px); + --v13-plate:#1b2c36; + --v13-route:#1b2d37; + --v13-insert:#182a34; + --v13-send:#1d2e38; + --v13-lower:#1c2e38; + --v13-edge:#39515c; + --p0-fader-h:var(--v13-fader-h)!important; + --fader-fixed-h:var(--v13-fader-h)!important; +} +.console-body .strip .route-section, +.console-body.collapsed-route .strip .route-section, +.console-body .section-rail>.rail-cell.route{ + flex:0 0 var(--route-h)!important; + height:var(--route-h)!important; + min-height:var(--route-h)!important; + max-height:var(--route-h)!important; +} +.console-body .strip .send-section, +.console-body.collapsed-send .strip .send-section, +.console-body .section-rail>.rail-cell.send{ + flex:0 0 var(--send-h)!important; + height:var(--send-h)!important; + min-height:var(--send-h)!important; + max-height:var(--send-h)!important; +} +/* FX absorbs differences in both ROUTE and SEND height, on every channel + and on the left rail. The min accommodates 4×25px rows + 25px header. */ +.console-body:not(.collapsed-fx) .strip .fx-section, +.console-body:not(.collapsed-fx) .section-rail>.rail-cell.fx{ + flex:1 1 125px!important;height:auto!important; + min-height:125px!important;max-height:none!important; +} +.console-body.collapsed-fx .strip .fx-section, +.console-body.collapsed-fx .section-rail>.rail-cell.fx{ + flex:0 0 23px!important;height:23px!important; + min-height:23px!important;max-height:23px!important; +} +/* FX is intentionally closed: SEND (if open) absorbs the spare upper height, + otherwise the upper region leaves a deliberate gap, never fader stretch. */ +.console-body.collapsed-fx:not(.collapsed-send) .strip .send-section, +.console-body.collapsed-fx:not(.collapsed-send) .section-rail>.rail-cell.send{ + flex:1 1 var(--send-h)!important; + height:auto!important;max-height:none!important; +} +.console-body .strip .pan-section, +.console-body .section-rail>.rail-cell.pan{ + height:var(--pan-h)!important;min-height:var(--pan-h)!important; + max-height:var(--pan-h)!important;flex:0 0 var(--pan-h)!important; +} +.console-body .strip .switch-section, +.console-body .section-rail>.rail-cell.switch{ + height:var(--switch-h)!important;min-height:var(--switch-h)!important; + max-height:var(--switch-h)!important;flex:0 0 var(--switch-h)!important; +} +.console-body .strip .fader-section, +.console-body.collapsed-fx .strip .fader-section, +.console-body.collapsed-fx.collapsed-send .strip .fader-section, +.console-body .section-rail>.rail-cell.fader, +.console-body.collapsed-fx .section-rail>.rail-cell.fader, +.console-body.collapsed-fx.collapsed-send .section-rail>.rail-cell.fader{ + height:var(--v13-fader-h)!important;min-height:var(--v13-fader-h)!important; + max-height:var(--v13-fader-h)!important;flex:0 0 var(--v13-fader-h)!important; +} +.console-body .strip .bottom-section, +.console-body .section-rail>.rail-cell.footer{ + height:var(--footer-h)!important;min-height:var(--footer-h)!important; + max-height:var(--footer-h)!important;flex:0 0 var(--footer-h)!important; +} +/* PAN is the boundary: keep lower console docked to the bottom when all + upper compartments are intentionally collapsed. */ +.console-body.collapsed-fx.collapsed-send .strip .pan-section, +.console-body.collapsed-fx.collapsed-send .section-rail>.rail-cell.pan{ + margin-top:auto!important; +} +/* V14: THREE-way collapse is the sole exception to the anchored lower + deck. CSS flex consumes freed upper space with a taller fader rising toward + the collapsed controls; PAN/SOLO follow upward as a coherent unit. For any + other combination, original deck geometry remains unchanged. No resize JS. */ +.console-body.collapsed-route.collapsed-fx.collapsed-send .strip .pan-section, +.console-body.collapsed-route.collapsed-fx.collapsed-send .section-rail>.rail-cell.pan{ + margin-top:0!important; +} +.console-body.collapsed-route.collapsed-fx.collapsed-send .strip .fader-section, +.console-body.collapsed-route.collapsed-fx.collapsed-send .section-rail>.rail-cell.fader{ + flex:1 1 var(--v13-fader-h)!important; + height:auto!important; + min-height:var(--v13-fader-h)!important; + max-height:none!important; +} +/* Colored channel nameplates and LEDs remain meaningful on a dark, satin, + untextured metal desk. Shadows only define seams and mechanical recesses. */ +/* FLAT plate language: no large face gradients, glow, brushed stripes or + uneven fading. Light/dark gradients remain only inside actual meter LEDs + and the original PNG thumbs, never across a panel's surface. */ +.window-title{background:#101f28!important;box-shadow:inset 0 -1px #526a743b!important} +.command-bar{background:#1b2d38!important;box-shadow:inset 0 1px #ffffff0b,inset 0 -1px #07131b!important} +.mixer-title{background:#162934!important;box-shadow:inset 0 -1px #5c758039!important} +.console-body .section-rail{background:#162a35!important;box-shadow:inset -1px #07131b!important} +.console-body .section-rail>.rail-cell{background:#1b2e39!important;border-bottom:1px solid #172a33!important;box-shadow:inset 0 1px #ffffff08!important} +.console-body .section-rail>.rail-cell[data-section]:hover{background:#2c4350!important} +.console-body .section-rail>.rail-cell[data-section].collapsed{background:#223947!important} +.console-body .strip{ + background:#1c2f3a!important;border-right:1px solid #10222c!important; + box-shadow:inset 1px 0 #9bb3bd1a,inset -1px 0 #05141b55!important; +} +.console-body .strip.selected{ + background:#233b48!important; + box-shadow:inset 0 0 0 1px var(--ch),inset 0 0 0 2px #10222d!important; +} +.console-body .strip .route-section{background:var(--v13-route)!important} +.console-body .strip .fx-section{background:var(--v13-insert)!important} +.console-body .strip .send-section{background:var(--v13-send)!important} +.console-body .strip .pan-section, +.console-body .strip .switch-section{background:var(--v13-lower)!important} +.console-body .strip .fader-section{ + background:#1b2e3a!important; + border-top:1px solid #516b7847!important; + box-shadow:inset 0 1px #ffffff09!important; +} +.console-body .strip .bottom-section{background:#192b36!important} +.console-body .strip .section{ + border-bottom:1px solid #102630!important; + box-shadow:inset 0 -1px #7a98a11b!important; +} +.console-body .strip .subhead, +.console-body .strip .send-header{ + background:#142732!important; + border-bottom:1px solid #10232c!important; + box-shadow:inset 0 1px #77939b17!important; +} +.console-body .strip .fxslot-row, +.console-body .strip .fxslot-row:hover{ + background:#182c37!important;border-bottom:1px solid #47637138!important; + box-shadow:none!important; +} +.console-body .strip .fxslot-row:hover{background:#294453!important} +.console-body .strip .fader-head{ + background:#081923!important;border:1px solid #405b69!important; + box-shadow:inset 0 1px 1px #0009,inset 0 -1px #8da9b21d!important; +} +.console-body .strip .fader-readout{text-shadow:none!important;color:#98e6f5!important} +.console-body .strip .fader-box{background:#1b2e39!important;box-shadow:none!important} +.console-body .strip .fader-box::before{ + background:#142530!important; + box-shadow:inset 1px 0 #7997a33d,inset -1px 0 #050d14a6!important; +} +.console-body .strip .fader-box::after{ + background:#050e15!important; + box-shadow:inset 1px 0 #80939d3a,inset -1px 0 #000!important; +} +.console-body .strip .meter-box{ + background:#06131b!important; + border:1px solid #314b57!important; + box-shadow:inset 1px 0 3px #0009,inset -1px 0 2px #0009!important; +} +.console-body .strip .meter-box::after, +.console-body .strip .meter-box .vu-bars::after, +.console-body .strip .meter-box .meter-lane::after{ + background:none!important;box-shadow:none!important; +} +.console-body .strip .meter-box .vu-bars{background:#07141b!important} +.console-body .strip .meter-box .meter-lane{background:#071c19!important;box-shadow:inset 1px 0 #000a!important} +.console-body .strip .wire-tray{ + background:#172d38!important;border-top:1px solid #6e8c9840!important; + box-shadow:inset 0 1px #ffffff0b!important; +} +.console-body .strip .wire-socket{ + background:#203743!important;border-color:#4c6975!important; + box-shadow:inset 0 1px #91abba22!important; +} +.console-body .strip .wire-socket.is-source{ + background:#82c57f!important;color:#112e1d!important; + box-shadow:inset 0 1px #d6fbd195!important; +} +.console-body .strip .wire-socket.is-linked, +.console-body .strip .wire-tray.linked .wire-socket{ + background:#1f6347!important;color:#ddffeb!important; + box-shadow:inset 0 1px #b2efc72b!important; +} +.console-body .strip .wire-socket:hover:not(:disabled){background:#35535e!important} +.console-body .strip .wire-socket.is-source:hover:not(:disabled){background:#97d791!important} +.console-body .strip .wire-socket.is-linked:hover:not(:disabled){background:#267d57!important} +.console-body .strip .wire-tray .wire-disconnect{background:#1d333f!important;box-shadow:none!important} +.console-body .strip .wire-tray .wire-pot::before{box-shadow:inset 0 0 0 1px #83c79a66!important} +.console-body .strip .wire-tray .wire-pot::after{box-shadow:none!important} +.console-body .strip .wire-tray.linked .wire-arrow{filter:none!important} +.console-body .rail-cell.fader{background:#243641!important} +.wire-mode-select,.wire-master{background:#203843!important;box-shadow:inset 0 1px #ffffff1a!important} +.wire-master[aria-pressed="true"]{background:#26493a!important} +.wire-legend{background:#203e34!important} +.console-body .strip .route-caption, +.console-body .strip .subhead .hint{color:#b8cbd5!important} +.console-body .strip .route-select, +.console-body .strip .send-select{background:#0e222d!important} + +/* Integration with contemporary V13 WIRE bay. The wire bay may use 160px + on tall desks; stage laptop uses 148px to protect 4 inserts + fixed fader. + Wire controls, semantics and dynamic SVG routings are unchanged. */ +@media(max-height:820px){ + .console-body.wire-routing-v13:not(.collapsed-send){--send-h:148px!important} +} +.console-body.wire-routing-v13 .strip .wire-section{ + background:#1d2e38!important;border-top:1px solid #4c677447!important; + box-shadow:inset 0 1px #ffffff0b!important; +} +.console-body.wire-routing-v13 .strip .wire-deck{ + background:#182b36!important; + border-bottom:1px solid #415b683c!important; + box-shadow:inset 0 1px #ffffff0b!important; +} +.console-body.wire-routing-v13 .strip .wire-deck-rail{ + background:#455f6c50!important; +} +.console-body.wire-routing-v13 .strip .wire-tray{ + background:#112833!important; + box-shadow:inset 0 1px #ffffff0b!important; +} +.console-body.wire-routing-v13 .section-rail .rail-cell.send{ + background:#1b303b!important;border-top:1px solid #617d8a43!important; +} +.console-body.wire-routing-v13 .strip .wire-socket{ + box-shadow:inset 0 1px #ffffff16!important; +} +.console-body.wire-routing-v13 .strip .wire-socket.is-linked{ + box-shadow:inset 0 1px #b2efc72b!important; +} +/* A carefully restrained physical edge is fine; broad face gradients and + worn-metal zebra strokes are not. */ + +/* V14.1 physical hierarchy: three upper modules can close independently. + SEND close is a TRUE 23px folded header, not a tiny still-active patch bay. + The source/destination graph belongs to state, not to the SVG or DOM nodes. */ +.console-body.wire-routing-v13.collapsed-send{ + --send-h:23px!important; +} +@media(max-height:680px){ + .console-body.wire-routing-v13.collapsed-send{--send-h:23px!important} +} +.console-body.wire-routing-v13.collapsed-send .strip .wire-deck, +.console-body.wire-routing-v13.collapsed-send .strip .wire-tray{ + display:none!important; + pointer-events:none!important; +} +.console-body.wire-routing-v13.collapsed-send .routing-wire-overlay{ + display:none!important; +} +/* No odd visual leftover: the collapsed compartment is just a tidy header, + with its disclosure affordance on the rail. */ +.console-body.wire-routing-v13.collapsed-send .strip .wire-section{ + background:#172732!important; + border-top:1px solid #3e55603d!important; + box-shadow:inset 0 1px #ffffff08!important; +} +.console-body.wire-routing-v13.collapsed-send .section-rail .rail-cell.send::after{ + content:"OPEN"!important; + color:#91bac5!important; +} +/* Dark premium satin graphite: uniform plate colors, no giant highlights. + Only section borders, actual recessed fader grooves and meter LEDs have + relief. The physical thumb asset is intentionally untouched. */ +.console-body{ + --v13-plate:#182832; + --v13-route:#172731; + --v13-insert:#142630; + --v13-send:#182a34; + --v13-lower:#192b35; + --v13-edge:#3e5661; +} +.console-body .strip{ + background:#1b2c36!important; + border-right:1px solid #0b1a22!important; + box-shadow:inset 1px 0 #94b4c11b,inset -1px 0 #06121955!important; +} +.console-body .strip.selected{ + background:#20333e!important; + box-shadow:inset 0 0 0 1px var(--ch),inset 0 0 0 2px #0c1a24!important; +} +.console-body .strip .route-section{background:var(--v13-route)!important} +.console-body .strip .fx-section{background:var(--v13-insert)!important} +.console-body .strip .send-section{background:var(--v13-send)!important} +.console-body .strip .pan-section, +.console-body .strip .switch-section{background:var(--v13-lower)!important} +.console-body .strip .fader-section{ + background:#1b2b36!important; + box-shadow:inset 0 1px #a5becc0b!important; +} +.console-body .strip .bottom-section{background:#182832!important} +.console-body .strip .fader-box{background:#14232e!important} +.console-body .strip .fader-box::before{ + background:#0e1b24!important; + box-shadow:inset 1px 0 #91b4c337,inset -1px 0 #0008!important; +} +.console-body .strip .fader-head{ + background:#08151e!important;box-shadow:inset 0 1px #b1d0dc12!important; +} +.console-body .strip .meter-box{background:#061219!important} +.console-body .strip .wire-section{background:#182a34!important} +.console-body .section-rail{background:#152630!important} +.console-body .section-rail>.rail-cell{ + background:#1a2c37!important; + box-shadow:inset 0 1px #ffffff08!important; +} +.console-body .section-rail>.rail-cell[data-section]:hover{background:#29424f!important} +.console-body.wire-routing-v13 .strip .wire-deck{background:#142a35!important} +.console-body.wire-routing-v13 .strip .wire-tray{background:#102631!important} +.console-body.wire-routing-v13 .section-rail .rail-cell.send{background:#192d38!important} + +/* V15 original physical patch connectors: filled bronze/silver OUT jack, recessed + hollow IN socket. Calm console design; route highlight only on actual intent. + Compact always keeps the wires visible; expanded has more cable canvas. */ +.console-body.wire-routing-v15.collapsed-send{--send-h:80px!important} +.console-body.wire-routing-v15:not(.collapsed-send){--send-h:160px!important} +@media(max-height:680px){ + .console-body.wire-routing-v15.collapsed-send{--send-h:66px!important} + .console-body.wire-routing-v15:not(.collapsed-send){--send-h:146px!important} +} +.console-body.wire-routing-v15 .wire-tray{ + justify-content:center!important;gap:4px!important; + padding:3px 5px 4px!important;min-height:35px!important; + flex:0 0 35px!important;max-height:35px!important; +} +.console-body.wire-routing-v15 .wire-node-out, +.console-body.wire-routing-v15 .wire-node-in{ + display:flex!important;flex-direction:column!important;align-items:center!important; + justify-content:center!important; + flex:0 0 28px!important;width:28px!important;min-width:28px!important; + height:28px!important;min-height:28px!important; + border-radius:50%!important; + font:600 18px/17px 'Segoe UI Symbol',Arial,sans-serif!important; + user-select:none;-webkit-user-select:none;touch-action:none; + position:relative;box-sizing:border-box;z-index:7; +} +.console-body.wire-routing-v15 .wire-node-out{ + border:1px solid #a4bdc3!important;color:#b7e0ec!important; + background:#2d4752!important; + box-shadow:inset 0 1px 0 #e6ffff34,inset 0 -2px 3px #07131c,0 1px 2px #040e17aa!important; + cursor:grab; +} +.console-body.wire-routing-v15 .wire-node-out span{line-height:16px} +.console-body.wire-routing-v15 .wire-node-out.is-source{ + color:#bcffd5!important;border-color:#6cdbaf!important; + background:#225640!important; + box-shadow:inset 0 1px #e2fff63b,0 0 0 1px #1c422f,0 0 8px #52ca8c3c!important; +} +.console-body.wire-routing-v15 .wire-node-out:active{cursor:grabbing} +.console-body.wire-routing-v15 .wire-node-out:disabled{cursor:default;color:#657783!important} +.console-body.wire-routing-v15 .wire-node-in{ + border:2px solid #75949e!important;color:#8faeb7!important; + background:#0a1923!important; + box-shadow:inset 1px 2px 3px #000e,inset 0 0 0 2px #29414b,0 1px #ffffff18!important; + cursor:crosshair; +} +.console-body.wire-routing-v15 .wire-node-in .wire-arrow{font-size:21px!important;line-height:17px!important} +.console-body.wire-routing-v15 .wire-node-in.is-linked{ + border-color:#80dfb4!important;color:#adffd6!important; + background:#124932!important; + box-shadow:inset 1px 2px 3px #0009,0 0 0 1px #305f4e,0 0 8px #52d49324!important; +} +.console-body.wire-routing-v15 .wire-node-in.is-source{opacity:.32!important;cursor:default} +.console-body.wire-routing-v15 .wire-node-in:disabled{cursor:default} +.console-body.wire-routing-v15 .wire-node-out small, +.console-body.wire-routing-v15 .wire-node-in .wire-label{ + font:600 7px/7px 'Segoe UI',Arial,sans-serif!important; + color:inherit!important;letter-spacing:.45px; +} +.console-body.wire-routing-v15 .wire-node-in .wire-arrow, +.console-body.wire-routing-v15 .wire-node-out span{pointer-events:none} +.console-body.wire-routing-v15 .wire-tray.linked .wire-node-in{ + flex:0 0 27px!important;width:27px!important;min-width:27px!important; +} +.console-body.wire-routing-v15 .wire-node-out:focus-visible, +.console-body.wire-routing-v15 .wire-node-in:focus-visible{ + outline:2px solid #e4fffa!important;outline-offset:2px!important; +} +.console-body.wire-routing-v15.wire-dragging .wire-node-in:not(:disabled){ + border-color:#abf2d0!important;box-shadow:inset 1px 2px 3px #000b,0 0 0 2px #2d765b!important; +} +.console-body.wire-routing-v15 .wire-pot{flex:0 0 24px!important;width:24px!important;min-width:24px!important} +.console-body.wire-routing-v15 .wire-disconnect{flex:0 0 16px!important;width:16px!important;min-width:16px!important} +.route-choice[hidden]{display:none!important} +.route-choice{ + position:absolute;z-index:30;box-sizing:border-box;width:280px; + border:1px solid #5c8090;border-radius:6px;background:#1b2d38; + color:#cde0e8;padding:10px;box-shadow:0 8px 28px #0009,inset 0 1px #bfdbe41c; + font:11px/1.4 'Segoe UI',Arial,sans-serif; +} +.route-choice-head{display:flex;justify-content:space-between;align-items:center; + font-weight:650;color:#e5f6f8;font-size:12px;padding-bottom:7px; + border-bottom:1px solid #56707a5c;} +.route-choice-head button{background:#283f4c;border:1px solid #486778; + color:#d9ebed;border-radius:3px;width:25px;height:23px;cursor:pointer} +.route-choice-description{color:#aac4cc;font-size:10px;padding:9px 0} +.route-choice-option{display:flex;align-items:center;text-align:left;gap:9px; + width:100%;padding:9px 8px;margin-top:5px;border:1px solid #42616c; + border-radius:4px;background:#263c48;color:#e1f2ef;cursor:pointer} +.route-choice-option:hover{background:#315261;border-color:#9bc8c8} +.route-choice-option.primary{border-color:#4b9d7a;background:#244638} +.route-choice-option.primary:hover{background:#31634c} +.route-choice-option strong{font:600 11px/15px 'Segoe UI',Arial,sans-serif} +.route-choice-option small{display:block;color:#a8c7c9;font-size:10px;line-height:14px} +.route-choice-option .choice-symbol{font-size:20px;color:#a7eec5} +.route-choice-foot{color:#91b1b9;font-size:9px;padding-top:9px} +.route-choice-option:focus-visible,.route-choice-head button:focus-visible{outline:2px solid #b0ebd8;outline-offset:2px} +@media(max-width:1100px){ + .console-body.wire-routing-v15 .wire-tray{gap:2px!important;padding-inline:2px!important} + .console-body.wire-routing-v15 .wire-node-out, + .console-body.wire-routing-v15 .wire-node-in{width:25px!important;min-width:25px!important;flex-basis:25px!important} +} + +/* V16: When BOTH expandable FX and SEND are closed, reclaim the blank + upper volume for the calibrated fader even if ROUTE is still expanded. + Any other upper combination retains the anchored lower deck. */ +.console-body.collapsed-fx.collapsed-send .strip .pan-section, +.console-body.collapsed-fx.collapsed-send .section-rail>.rail-cell.pan{margin-top:0!important} +.console-body.collapsed-fx.collapsed-send .strip .fader-section, +.console-body.collapsed-fx.collapsed-send .section-rail>.rail-cell.fader{ + flex:1 1 var(--v13-fader-h)!important;height:auto!important; + min-height:var(--v13-fader-h)!important;max-height:none!important; +} +/* Front edge: this slender, non-interactive seam sits OVER the metal + compartments instead of disappearing beneath panel backgrounds. */ +.console-body .strip{position:relative!important;isolation:isolate} +.console-body .strip::after{ + content:"";position:absolute;right:0;top:0;bottom:0;width:1px; + background:#061722;box-shadow:-1px 0 #8babb538; + z-index:15;pointer-events:none; +} +.console-body .strip.channel-dragging{opacity:.55!important} +.console-body .strip.channel-drop-before::before, +.console-body .strip.channel-drop-after::before{ + content:"";position:absolute;top:0;bottom:0;width:3px; + background:#8ce3f1;z-index:18;pointer-events:none; +} +.console-body .strip.channel-drop-before::before{left:0} +.console-body .strip.channel-drop-after::before{right:0} +.console-body .strip-identity-top[draggable="true"]{cursor:grab} +.console-body .strip-identity-top[draggable="true"]:active{cursor:grabbing} + +/* V16: the WIRE graph is an upper compartment. When SEND is folded + the sockets and cable illustration are invisible, leaving only a + clean 23px disclosure row; model fan-out remains untouched. */ +.console-body.wire-routing-v15.collapsed-send{--send-h:23px!important} +@media(max-height:680px){.console-body.wire-routing-v15.collapsed-send{--send-h:23px!important}} +.console-body.wire-routing-v15.collapsed-send .strip .wire-deck, +.console-body.wire-routing-v15.collapsed-send .strip .wire-tray{display:none!important} +.console-body.wire-routing-v15.collapsed-send .routing-wire-overlay{display:none!important} +/* ARSONMIX GLOBAL HARDWARE KEY V1 — owner approved MUTE/SOLO material. + This is one reusable material token, NOT a new button geometry/layout. + Never apply to circular WIRE connectors, fader thumb, meter LEDs, sliders, + section-rail disclosures, or drag targets. All colors are semantic variants. + No animations, filters, textures, permanent pressed state, or extra JS. */ +:root{ + --am-hw-key-radius:2px; + --am-hw-key-neutral:#bfc3c5; + --am-hw-key-dark:#46515b; + --am-hw-key-rim:#5f696f; + --am-hw-key-upper-glint:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.75) 48%,transparent 100%); + --am-hw-key-lower-glint:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.34) 50%,transparent 100%); + --am-hw-key-relief:inset 1px 0 0 rgba(255,255,255,.45),inset -1px 0 0 rgba(0,0,0,.25),0 2px 0 #070a0c,0 3px 3px rgba(0,0,0,.6); + --am-hw-key-flat:inset 0 1px 2px rgba(0,0,0,.65),0 0 0 transparent; + --am-hw-key-face:var(--am-hw-key-neutral); + --am-hw-key-ink:#171c20; + --am-hw-key-border:var(--am-hw-key-rim); +} +/* A single mechanical face for every ordinary PUSH button; retain existing + 29px header / strip widths and accessibility semantics. New buttons opt + in with .hw-key instead of inheriting unexpected styling on rotary/jacks. */ +:is( + .command-bar button.tool, + .command-bar summary.tool, + .more-tools-panel button.tool, + .console-body .strip .switch-section button.switch, + .identity-actions button.console-control, + .plugin-footer button, + .route-choice-head button, + .route-choice-option, + button.hw-key +){ + position:relative!important; + border:1px solid var(--am-hw-key-border)!important; + border-radius:var(--am-hw-key-radius)!important; + color:var(--am-hw-key-ink)!important; + background:linear-gradient(180deg, + color-mix(in srgb,var(--am-hw-key-face) 84%,white) 0%, + color-mix(in srgb,var(--am-hw-key-face) 96%,white) 8%, + var(--am-hw-key-face) 38%, + color-mix(in srgb,var(--am-hw-key-face) 86%,black) 78%, + color-mix(in srgb,var(--am-hw-key-face) 64%,black) 100%)!important; + box-shadow:var(--am-hw-key-relief)!important; + text-shadow:0 1px rgba(255,255,255,.19)!important; + filter:none!important; + transform:translateY(0)!important; + transition:transform 80ms ease,box-shadow 80ms ease!important; +} +/* EXACT top/bottom edge glints: no inset offset on the key face. The whitened + core fades horizontally to transparent at both ends. */ +:is( + .command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +)::before{ + content:""!important;position:absolute!important;pointer-events:none!important; + top:0!important;left:2px!important;right:2px!important;height:2px!important; + background:var(--am-hw-key-upper-glint)!important; + border:0!important;box-shadow:none!important;opacity:1!important; +} +:is( + .command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +)::after{ + content:""!important;position:absolute!important;pointer-events:none!important; + bottom:0!important;left:2px!important;right:2px!important;height:1px!important; + background:var(--am-hw-key-lower-glint)!important; + border:0!important;box-shadow:none!important;opacity:1!important; +} +/* The key actually sinks into the surrounding socket only during touch/click. + A latched MUTE/SOLO remains raised, changing ONLY semantic color. */ +:is( + .command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +):active:not(:disabled){ + transform:translateY(2px)!important; + box-shadow:var(--am-hw-key-flat)!important; + filter:none!important; +} +:is( + .command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +):focus-visible{ + outline:2px solid #9ceaff!important;outline-offset:2px!important; +} +:is( + .command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +):disabled{ + opacity:.5!important;cursor:not-allowed!important; +} +/* Family colorways only. Physical edges and shadows are shared unchanged. */ +.command-bar button.tool, +.command-bar summary.tool, +.more-tools-panel button.tool, +.route-choice-head button{ + --am-hw-key-face:var(--am-hw-key-dark); + --am-hw-key-ink:#ecf4f6; + --am-hw-key-border:#66737b; +} +.command-bar button.tool:is(.active,[aria-pressed="true"]), +.command-bar summary.tool[aria-expanded="true"], +.more-tools[open] summary.tool{ + --am-hw-key-face:#6498a9; + --am-hw-key-ink:#081b23; + --am-hw-key-border:#6ca5b5; +} +.console-body .strip .switch-section button.switch.on.mute{ + --am-hw-key-face:#c43b37;--am-hw-key-ink:#fff;--am-hw-key-border:#752626; + text-shadow:0 -1px #641313!important; +} +.console-body .strip .switch-section button.switch.on.solo{ + --am-hw-key-face:#e0c23a;--am-hw-key-ink:#1d1a0c;--am-hw-key-border:#92761b; +} +.console-body .strip .switch-section button.switch.on.cue{ + --am-hw-key-face:#65b7cb;--am-hw-key-ink:#0d2530;--am-hw-key-border:#417b8e; +} +.route-choice-option.primary{ + --am-hw-key-face:#39745a;--am-hw-key-ink:#f0fff6;--am-hw-key-border:#5b9c77; +} +#identitySave{ + --am-hw-key-face:#84cbd9;--am-hw-key-ink:#0b2832;--am-hw-key-border:#5a9aab; +} +@media(prefers-reduced-motion:reduce){ + :is(.command-bar .tool,.console-body .switch-section .switch,.route-choice-option,button.hw-key){ + transition:none!important; + } +} + + +/* Wire V17: fixed four-column hardware patch. Never reflow on route changes. */ +.console-body.wire-routing-v15 .strip .wire-tray,.console-body.wire-routing-v15 .strip .wire-tray.linked{ + display:grid!important;grid-template-columns:24px 28px 22px!important;gap:4px!important; + align-items:center!important;justify-content:center!important; + height:35px!important;min-height:35px!important;max-height:35px!important; + padding:3px 2px!important;box-sizing:border-box!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-out{ + width:24px!important;min-width:24px!important;flex:0 0 24px!important;height:28px!important; + border:0!important;background:transparent!important;box-shadow:none!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-out .wire-pin{ + display:block;width:12px;height:12px;border:1px solid #9db6c2;border-radius:50%; + background:linear-gradient(145deg,#d7e6eb,#718e9c);box-shadow:inset 0 1px #ffffff69,0 1px 2px #0009; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-out.is-source .wire-pin{ + background:var(--ch,#9fe8bf);border-color:#ecfff1;box-shadow:0 0 5px var(--ch,#9fe8bf); +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-in, +.console-body.wire-routing-v15 .strip .wire-tray.linked .wire-node-in{ + width:28px!important;min-width:28px!important;flex:0 0 28px!important;height:28px!important; + border:2px solid #7994a0!important;border-radius:50%!important;padding:0!important;gap:0!important; + background:#071820!important;box-shadow:inset 0 2px 4px #000b,inset 0 0 0 2px #233b45!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-in .wire-arrow{ + display:block;width:9px;height:9px;flex:0 0 9px;border-radius:50%; + background:#071720;border:1px solid #2b4350;font-size:0!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-in.is-linked{ + border-color:var(--ch,#a4eac8)!important;background:#0a2028!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-in.is-linked .wire-arrow{ + width:11px;height:11px;flex:0 0 11px;background:var(--ch,#a4eac8); + border:1px solid #ffffff8a;box-shadow:0 0 4px var(--ch,#a4eac8); +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-in.is-snap-target{ + border-color:#e6fff3!important;box-shadow:inset 0 2px 4px #0009,0 0 0 3px #75ddae66!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-out small, +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-in .wire-label{ + position:absolute;bottom:-2px;pointer-events:none;color:#a7bcc4!important;font-size:7px!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot{ + width:22px!important;min-width:22px!important;flex:0 0 22px!important;grid-column:3; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot::before{ + inset:2px 1px!important;width:20px!important;height:20px!important; + background:conic-gradient(from 225deg,var(--ch,#94dabc) 0 var(--wire-pct,91%),#344953 var(--wire-pct,91%) 75%,transparent 75% 100%)!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot::after{left:9px!important;top:4px!important} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot.is-idle{ + opacity:.64;pointer-events:none;cursor:default!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot.is-idle::before{ + background:conic-gradient(from 225deg,#4b626d 0 75%,transparent 75% 100%)!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot.is-idle::after{ + transform:rotate(-135deg)!important;background:#657e8a!important;box-shadow:none!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-gain{width:22px!important;height:24px!important} +.console-body.wire-routing-v15 .strip .wire-tray .wire-disconnect{ + width:14px!important;min-width:14px!important;flex:0 0 14px!important;grid-column:4; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-disconnect.is-idle{visibility:hidden!important;pointer-events:none} +.console-body.wire-routing-v15 .strip .wire-tray{background:#0e222b!important} +.routing-wire-overlay{filter:none!important} +.console-body.wire-routing-v15.wire-dragging .strip .wire-node-in.is-source.is-snap-target{opacity:1!important} + + + +/* V18 HARDWARE KEY SOCKET + CRISP LED METER — owner visual audit, 2026-11-02. + Material token stays global. The body is a real recessed mounting well: + dark 1px machined cut, light 1px metal lip, cap stands 1px above its well. + Only semantic color differs between controls; no blurred shadows, filters, + backdrop filters, RAF style recalculation or extra LED DOM nodes. */ +:root { + --am-hw-key-radius:2px; + --am-hw-key-press-y:1px; + --am-hw-key-relief: + inset 1px 0 0 rgba(255,255,255,.38), + inset -1px 0 0 rgba(0,0,0,.27), + inset 0 1px 0 rgba(255,255,255,.12), + 0 1px 0 #050a0d, + 0 0 0 1px #070c10, + 0 0 0 2px #3b4d57, + 0 1px 0 2px #04090c; + --am-hw-key-flat: + inset 0 1px 0 #10171c, + inset 0 -1px 0 rgba(255,255,255,.07), + 0 0 0 1px #03080c, + 0 0 0 2px #3b4d57; +} +/* A recessed common switch bay is machined into the STRIP panel, not + painted halfway across the top face. Housing never moves with buttons. */ +.console-body .strip .switch-section { + position:relative!important; + background:#111f28!important; + border-top:1px solid #07141b!important; + border-bottom:1px solid #415561!important; + box-shadow:inset 0 1px 0 #060d12,inset 0 -1px 0 #263a45!important; + isolation:isolate; +} +.console-body .strip .switch-section button.switch{ + z-index:1!important; + border-radius:var(--am-hw-key-radius)!important; + box-shadow:var(--am-hw-key-relief)!important; +} +/* Every hardware PUSH key shares the same outer socket, sharp relief and + very shallow mechanical travel. Do not flatten latched MUTE/SOLO. */ +:is(.command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key){ + border-radius:var(--am-hw-key-radius)!important; + box-shadow:var(--am-hw-key-relief)!important; + transition:none!important; + will-change:auto!important; +} +:is(.command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key):active:not(:disabled){ + transform:translateY(var(--am-hw-key-press-y))!important; + box-shadow:var(--am-hw-key-flat)!important; +} +/* Edge highlights stay on the exact face edges, horizontally translucent + at the corners; the lower glint is intentionally thinner. */ +:is(.command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key)::before{ + top:0!important;height:2px!important;left:1px!important;right:1px!important; +} +:is(.command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key)::after{ + bottom:0!important;height:1px!important;left:1px!important;right:1px!important; +} +/* Portrait cells: illuminated 9px tall × 6px wide, separated by a + fixed 2px DARK cross-bar. Vertical color across the ladder remains smooth + green → yellow → amber → red, not disjoint palettes per color zone. + Uses existing --lit variable for clipped signal fill, no JS or 40+ nodes. */ +.console-body .strip .meter-box .vu-bars{ + justify-content:center!important; + gap:3px!important; + background:#06121a!important; + box-shadow:inset 1px 0 0 #142b35,inset -1px 0 0 #010508!important; +} +.console-body .strip .meter-box .meter-lane, +.console-body .strip .meter-box.mono .meter-lane{ + box-sizing:border-box!important; + width:6px!important;min-width:6px!important;max-width:6px!important; + flex:0 0 6px!important; + border:0!important;border-radius:0!important; + background:#07141a!important; + box-shadow:inset 1px 0 0 #20303a,inset -1px 0 0 #000!important; +} +.console-body .strip .meter-box .meter-fill{ + left:0!important;right:0!important; + background:linear-gradient(to top, + #0e9f43 0%,#3bd849 24%,#7bef40 43%, + #c5e936 56%,#f6d42e 69%,#ffae27 80%, + #ff761e 91%,#ee3028 100%)!important; + box-shadow:none!important;filter:none!important; + transition:none!important; +} +/* Individual LED's own top-face/shadow shading has 9px portrait lit area, + 2px non-emitting separator; no per-cell colored blocks. */ +.console-body .strip .meter-box .meter-lane::before{ + content:""!important; + background:repeating-linear-gradient(to top, + transparent 0px,transparent 9px,#020a0f 9px,#020a0f 11px)!important; + box-shadow:none!important; +} +.console-body .strip .meter-box .meter-lane::after{ + content:""!important; + background: + repeating-linear-gradient(to top, + rgba(255,255,255,.13) 0px,rgba(255,255,255,.05) 1px, + transparent 3px,transparent 6px,rgba(0,0,0,.28) 9px, + transparent 9px,transparent 11px), + linear-gradient(90deg,rgba(255,255,255,.13),transparent 55%,rgba(0,0,0,.28))!important; + box-shadow:none!important; +} +.console-body .strip .meter-box .peak, +.console-body .strip .meter-box .peak.clipping{ + box-shadow:inset 0 1px 0 rgba(255,255,255,.16)!important; +} +/* Remove convolution-style glow and blur work. All depth comes from + 1px crisp borders, embossed edges, static face gradients, native textures. */ +html * ,html *::before,html *::after{ + filter:none!important; + backdrop-filter:none!important; + -webkit-backdrop-filter:none!important; +} +.plugin-browser,.channel-identity,.route-choice,.more-tools-panel{ + box-shadow:0 0 0 1px #60717b,0 1px 0 1px #07141b!important; +} +.console-body .strip .wire-tray .wire-node-out.is-source .wire-pin, +.console-body .strip .wire-tray .wire-node-in .wire-dot, +.console-body .strip .wire-tray .wire-node-in.is-linked{ + box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 0 0 1px #07151b!important; +} + + +/* V18 connected IN is a grab handle; origin appears empty only while dragging. */ +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-in.is-linked{cursor:grab} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-in.is-replug-origin{ + border-color:#7994a0!important;background:#071820!important; + box-shadow:inset 0 2px 4px #000b,inset 0 0 0 2px #233b45!important; + cursor:grabbing!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-node-in.is-replug-origin .wire-arrow{ + background:#071720!important;border-color:#2b4350!important;box-shadow:none!important; +} + + +/* V19 FUTURE-CONSOLE KEY MATERIAL — graphite + restrained status illumination. + Visual inspiration: dark hardware surfaces, jewel status keys and tightly + machined sockets on modern large-format digital mixing consoles. + Shared material: same 2px square-rounded cap, 1px press, one chrome + edge-light recipe, NO diffuse shadows, blur, filter, animations, or DOM. */ +:root { + --am-hw-key-neutral:#3b4e59; + --am-hw-key-dark:#344650; + --am-hw-key-rim:#637783; + --am-hw-key-radius:2px; + --am-hw-key-press-y:1px; + --am-hw-key-upper-glint:linear-gradient(90deg, + rgba(233,249,255,0) 0%,rgba(233,249,255,.24) 19%, + rgba(246,253,255,.74) 50%,rgba(233,249,255,.24) 81%, + rgba(233,249,255,0) 100%); + --am-hw-key-lower-glint:linear-gradient(90deg, + rgba(208,231,240,0) 0%,rgba(208,231,240,.2) 50%, + rgba(208,231,240,0) 100%); + --am-hw-key-face:var(--am-hw-key-neutral); + --am-hw-key-ink:#e3edf1; + --am-hw-key-border:var(--am-hw-key-rim); + --am-hw-key-relief: + inset 1px 0 0 rgba(238,249,255,.22), + inset -1px 0 0 rgba(0,0,0,.43), + inset 0 1px 0 rgba(255,255,255,.11), + 0 1px 0 #030b10, + 0 0 0 1px #071219, + 0 0 0 2px #485d68, + 0 1px 0 2px #050f15; + --am-hw-key-flat: + inset 0 1px 0 #09151b, + inset 0 -1px 0 rgba(220,245,255,.08), + 0 0 0 1px #071219, + 0 0 0 2px #485d68; +} +/* Important: one real physical material for push-buttons. Layout stays put. */ +:is(.command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key){ + background:linear-gradient(180deg, + color-mix(in srgb,var(--am-hw-key-face) 89%,#d6e9f1) 0%, + color-mix(in srgb,var(--am-hw-key-face) 96%,#d6e9f1) 10%, + var(--am-hw-key-face) 36%, + color-mix(in srgb,var(--am-hw-key-face) 89%,#061018) 76%, + color-mix(in srgb,var(--am-hw-key-face) 70%,#061018) 100%)!important; + color:var(--am-hw-key-ink)!important; + border-color:var(--am-hw-key-border)!important; + border-radius:var(--am-hw-key-radius)!important; + text-shadow:0 1px 0 rgba(0,0,0,.23)!important; + box-shadow:var(--am-hw-key-relief)!important; + filter:none!important; + transition:none!important; +} +:is(.command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key):active:not(:disabled){ + transform:translateY(1px)!important; + box-shadow:var(--am-hw-key-flat)!important; +} +/* A deliberate narrow white reflection ON THE EDGE, never in the middle. */ +:is(.command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key)::before{ + top:0!important;height:2px!important;left:1px!important;right:1px!important; + background:var(--am-hw-key-upper-glint)!important; +} +:is(.command-bar button.tool,.command-bar summary.tool, + .more-tools-panel button.tool,.console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key)::after{ + bottom:0!important;height:1px!important;left:1px!important;right:1px!important; + background:var(--am-hw-key-lower-glint)!important; +} +/* Graphite OFF, colored ON — same geometry. No always-on glow. */ +.command-bar button.tool, +.command-bar summary.tool, +.more-tools-panel button.tool, +.route-choice-head button { + --am-hw-key-face:#354650; + --am-hw-key-ink:#e2ecf0; + --am-hw-key-border:#647783; +} +.command-bar button.tool:is(.active,.primary,[aria-pressed="true"]), +.command-bar summary.tool[aria-expanded="true"], +.more-tools[open] summary.tool { + --am-hw-key-face:#367789; + --am-hw-key-ink:#f3fcff; + --am-hw-key-border:#6fb3c2; +} +.console-body .strip .switch-section button.switch:not(.on) { + --am-hw-key-face:#405360; + --am-hw-key-ink:#e4edf0; + --am-hw-key-border:#72838c; +} +.console-body .strip .switch-section button.switch.on.mute { + --am-hw-key-face:#bd344b; + --am-hw-key-ink:#fff4f5; + --am-hw-key-border:#ed6575; + text-shadow:0 -1px 0 rgba(56,0,9,.5)!important; +} +.console-body .strip .switch-section button.switch.on.solo { + --am-hw-key-face:#dbad39; + --am-hw-key-ink:#231b07; + --am-hw-key-border:#ffdc74; + text-shadow:0 1px 0 rgba(255,255,255,.2)!important; +} +.console-body .strip .switch-section button.switch.on.cue { + --am-hw-key-face:#399db4; + --am-hw-key-ink:#f5fdff; + --am-hw-key-border:#79d5e5; +} +.route-choice-option.primary{ + --am-hw-key-face:#357a65; + --am-hw-key-ink:#f0fff9; + --am-hw-key-border:#6ac6a3; +} +#identitySave { + --am-hw-key-face:#358c9f; + --am-hw-key-ink:#f2fcff; + --am-hw-key-border:#7ed4e1; +} +/* Socket bezel belongs to the console, not floating in the button face. */ +.console-body .strip .switch-section{ + background:#111f28!important; + box-shadow:inset 0 1px 0 #071017,inset 0 -1px 0 #273c48!important; +} +/* Keep every control crisp on modest GPU hardware. */ +:is(.command-bar,.console-body,.plugin-browser,.route-choice) button{ + backdrop-filter:none!important; + -webkit-backdrop-filter:none!important; +} + + +/* V20 CUBE/ILLUMINATED HARDWARE KEY — single material extension, zero blur. + Face appears internally backlit; three crisp unblurred sidewall lines + plus a dark socket convey cube depth. Press is precisely 1px. */ +:root{ + --am-hw-key-bright:#586c79; + --am-hw-key-deep:#202f39; + --am-hw-key-wall:#1d2c35; + --am-hw-key-relief:inset 1px 0 0 #e5f7ff37,inset -1px 0 0 #070e1377, + inset 0 1px 0 #e5f7ff2e,inset 0 -1px 0 #0009, + 0 1px 0 var(--am-hw-key-wall),0 2px 0 #080e13,0 3px 0 #05090d, + 0 0 0 1px #071017,0 0 0 2px #405762; + --am-hw-key-flat:inset 1px 0 0 #e5f7ff23,inset -1px 0 0 #070e1377, + inset 0 1px 0 #0006,inset 0 -1px 0 #e1f4ff13, + 0 1px 0 #080e13,0 2px 0 #05090d, + 0 0 0 1px #071017,0 0 0 2px #405762; + --am-hw-key-upper-glint:linear-gradient(90deg,transparent,#ffffff2b 18%,#ffffffb8 50%,#ffffff2b 82%,transparent); + --am-hw-key-lower-glint:linear-gradient(90deg,transparent,#ffffff18 26%,#ffffff5c 50%,#ffffff18 74%,transparent); +} +/* The same cap surface for ALL push-buttons: near-vertical satin + highlight, colored lens middle, dark lower skirt, sharp edge. */ +:is(.command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key){ + --am-hw-key-press-y:1px; + user-select:none!important;-webkit-user-select:none!important; + border-radius:2px!important; + background:linear-gradient(180deg, + color-mix(in srgb,var(--am-hw-key-bright) 77%,#d5edf4) 0%, + var(--am-hw-key-bright) 8%, + color-mix(in srgb,var(--am-hw-key-bright) 35%,var(--am-hw-key-face)) 19%, + var(--am-hw-key-face) 38%, + color-mix(in srgb,var(--am-hw-key-face) 72%,var(--am-hw-key-bright)) 53%, + var(--am-hw-key-face) 68%,var(--am-hw-key-deep) 100%)!important; + box-shadow:var(--am-hw-key-relief)!important; + transform:translateY(0)!important;transition:none!important; + filter:none!important; +} +:is(.command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key):active:not(:disabled){ + transform:translateY(1px)!important;box-shadow:var(--am-hw-key-flat)!important; +} +:is(.command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key)::before{ + top:0!important;left:1px!important;right:1px!important;height:2px!important; + background:var(--am-hw-key-upper-glint)!important; +} +:is(.command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key)::after{ + bottom:0!important;left:2px!important;right:2px!important;height:1px!important; + background:var(--am-hw-key-lower-glint)!important; +} +/* Machined socket behind keycaps, not light bleeding onto the chassis. */ +.console-body .strip .switch-section{ + background:#12232d!important; + box-shadow:inset 0 1px 0 #050b10,inset 1px 0 0 #08131a, + inset -1px 0 0 #263b47!important; +} +/* Off and on use same geometry. Only optical material tokens change. */ +.command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, +.route-choice-head button{ + --am-hw-key-face:#374c58;--am-hw-key-bright:#5c7582; + --am-hw-key-deep:#1a2b35;--am-hw-key-wall:#1c303b; +} +.command-bar button.tool:is(.active,.primary,[aria-pressed="true"]), +.command-bar summary.tool[aria-expanded="true"],.more-tools[open] summary.tool{ + --am-hw-key-face:#2d7386;--am-hw-key-bright:#71c3d8; + --am-hw-key-deep:#153e4a;--am-hw-key-wall:#1b5060; +} +.console-body .strip .switch-section button.switch:not(.on){ + --am-hw-key-face:#405360;--am-hw-key-bright:#586c79; + --am-hw-key-deep:#202f39;--am-hw-key-wall:#1d2c35; +} +.console-body .strip .switch-section button.switch.on.mute{ + --am-hw-key-face:#ae3346;--am-hw-key-bright:#f26e7c; + --am-hw-key-deep:#581e2b;--am-hw-key-wall:#611e2c; + --am-hw-key-ink:#fff7f8;--am-hw-key-border:#eb7380; +} +.console-body .strip .switch-section button.switch.on.solo{ + --am-hw-key-face:#bc8f2e;--am-hw-key-bright:#ffe08a; + --am-hw-key-deep:#654811;--am-hw-key-wall:#715520; + --am-hw-key-ink:#261d09;--am-hw-key-border:#f4d370; +} +.console-body .strip .switch-section button.switch.on.cue{ + --am-hw-key-face:#2a879e;--am-hw-key-bright:#79d8ed; + --am-hw-key-deep:#134458;--am-hw-key-wall:#185468; + --am-hw-key-ink:#f4fdff;--am-hw-key-border:#7fd7e8; +} +.route-choice-option.primary{ + --am-hw-key-face:#327b64;--am-hw-key-bright:#7fdec0; + --am-hw-key-deep:#164b3c;--am-hw-key-wall:#185341; +} +#identitySave{ + --am-hw-key-face:#2d8597;--am-hw-key-bright:#80d5e7; + --am-hw-key-deep:#174757;--am-hw-key-wall:#185468; +} +/* Explicitly no optical postprocessing / blur / expensive animation. */ +:is(.command-bar,.console-body,.plugin-browser,.route-choice) button{ + filter:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important; +} + + +/* V19 collapsed-section contract: DAW-like discreet labels and state indicators. + No rotated words, pseudo-caption OPEN/PATCH, blur, glow or extra layout rows. */ +.console-body .section-rail>.rail-cell[data-section]{ + font:500 9px/1.1 Arial,Helvetica,sans-serif!important; + font-style:normal!important;letter-spacing:0!important; + color:#9aafb9!important;background:#182b35!important; + text-shadow:none!important;transition:none!important; + border-top:0!important; +} +.console-body.wire-routing-v13 .section-rail>.rail-cell.send{ + background:#182b35!important;color:#9aafb9!important; +} +.console-body .section-rail>.rail-cell[data-section].collapsed{ + background:#12232d!important;color:#768d98!important; + box-shadow:inset 2px 0 #627e8e65!important; +} +.console-body .section-rail>.rail-cell[data-section]:not(.collapsed){ + box-shadow:inset 2px 0 #91c9d080!important; +} +.console-body .section-rail>.rail-cell[data-section]:hover{ + background:#29404b!important;color:#e3eff2!important; +} +.console-body .section-rail>.rail-cell[data-section]::after, +.console-body.wire-routing-v13 .section-rail>.rail-cell.send::after, +.console-body.wire-routing-v13.collapsed-send .section-rail>.rail-cell.send::after{ + content:""!important;display:block!important; + position:absolute!important;right:2px!important;top:4px!important; + width:3px!important;height:3px!important; + border:solid currentColor!important;border-width:0 1px 1px 0!important; + transform:rotate(45deg)!important;opacity:.75!important; + background:transparent!important;font-size:0!important; +} +.console-body .section-rail>.rail-cell[data-section].collapsed::after, +.console-body.wire-routing-v13.collapsed-send .section-rail>.rail-cell.send::after{ + transform:rotate(-45deg)!important; +} +.console-body .section-rail .rail-cell.route, +.console-body .section-rail .rail-cell.fx, +.console-body .section-rail .rail-cell.send{ + padding:0 2px 0 0!important;justify-content:center!important; +} +.console-body.wire-routing-v15 .strip .wire-fold-summary{ + display:none!important; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary{ + display:flex!important;gap:6px;align-items:center;justify-content:center; + width:100%;height:21px;min-height:21px;padding:0 2px; + border:0;border-radius:0;background:transparent!important; + color:#9bb0ba;font:500 9px/1 Arial,Helvetica,sans-serif; + letter-spacing:0;cursor:pointer;overflow:hidden;white-space:nowrap; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary:hover{ + background:#273c48!important; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary:focus-visible{ + outline:1px solid #91cbd6;outline-offset:-2px; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-in{ + color:#9baeb9; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-out{ + color:var(--ch,#a4bac7); +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-empty{ + color:#617883;font-size:10px; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-marker{ + display:inline-block;width:3px;height:3px;margin-right:2px; + border-radius:50%;background:currentColor;vertical-align:middle; +} +/* The collapsed WIRE rack stays exactly 23px. FX/fader geometry is unchanged. */ + + +/* V22 CLEAN HARDWARE KEY + SELECTION + FADER CONTRACT + The material is intentionally smooth: one uninterrupted face gradient. + A separate STATIC socket wrapper owns the hole, recess and overlaid metal + bezel. Only the button child moves 1px. No blur or filter. This repairs + the V20 wavy/zebra shading and the buried channel selection highlight. */ +:root { + --am-hw-key-relief:inset 1px 0 0 #ecf9ff36,inset -1px 0 0 #040b106b, + inset 0 1px 0 #ffffff22,inset 0 -1px 0 #0008, + 0 1px 0 var(--am-hw-key-wall),0 2px 0 #070d12; + --am-hw-key-flat:inset 1px 0 0 #ecf9ff25,inset -1px 0 0 #040b106b, + inset 0 1px 0 #0005,inset 0 -1px 0 #ffffff12, + 0 1px 0 #070d12; + --am-hw-key-upper-glint:linear-gradient(90deg,transparent 0%,#ffffff3a 28%,#ffffffaa 50%,#ffffff3a 72%,transparent 100%); + --am-hw-key-lower-glint:linear-gradient(90deg,transparent 0%,#ffffff0d 30%,#ffffff48 50%,#ffffff0d 70%,transparent 100%); +} +/* Thin internal light (not glowing) — no repeated bright/dark bands. */ +:is(.command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key) { + background:linear-gradient(180deg, + var(--am-hw-key-bright) 0%, + var(--am-hw-key-face) 42%, + var(--am-hw-key-deep) 100%)!important; + box-shadow:var(--am-hw-key-relief)!important; + filter:none!important; + backdrop-filter:none!important; + -webkit-backdrop-filter:none!important; + transition:none!important; +} +:is(.command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key):hover { + filter:none!important; +} +:is(.command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section button.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key):active:not(:disabled) { + transform:translateY(1px)!important; + box-shadow:var(--am-hw-key-flat)!important; +} +/* Static bezel structure deliberately resides OUTSIDE the button element. + ::after has z-index 4 over button (z-index 2); pointer-events:none, and + never inherits keycap's transform, MUTE state, or active/hover behavior. */ +.console-body .strip .switch-section .hw-switch-socket { + position:relative!important; + display:flex!important; + align-items:stretch!important; + justify-content:stretch!important; + flex:1 1 0!important; + min-width:0!important; + height:calc(var(--switch-h) - 7px)!important; + max-height:34px!important; + min-height:24px!important; + padding:2px!important; + box-sizing:border-box!important; + background:#08141b!important; + border:1px solid #09131a!important; + border-radius:3px!important; + box-shadow:inset 0 1px 0 #000,inset 1px 0 0 #02080c, + inset -1px 0 0 #2b424f,inset 0 -1px 0 #263b47!important; + isolation:isolate!important; + overflow:hidden!important; +} +.console-body .strip .switch-section .hw-switch-socket::before { + content:""!important; + position:absolute!important;inset:1px!important; + z-index:0!important;pointer-events:none!important; + border-radius:2px!important; + background:linear-gradient(180deg,#03080d 0%,#0c1921 46%,#172a33 100%)!important; + box-shadow:inset 0 1px 0 #000,inset 0 -1px 0 #2a404c!important; +} +.console-body .strip .switch-section .hw-switch-socket::after { + content:""!important; + position:absolute!important;inset:0!important; + z-index:4!important;pointer-events:none!important; + border-radius:3px!important; + border:1px solid #0a131a!important; + background:transparent!important; + box-shadow:inset 0 1px 0 #60808b5c, + inset 1px 0 0 #6b87904a, + inset -1px 0 0 #02090ebf, + inset 0 -1px 0 #03090e!important; +} +.console-body .strip .switch-section .hw-switch-socket>.switch { + position:relative!important;z-index:2!important; + flex:1 1 auto!important; + min-width:0!important;width:100%!important; + height:100%!important;min-height:0!important;max-height:none!important; + padding:0 1px!important; + border-radius:2px!important; + transform:translateY(0)!important; + overflow:hidden!important; +} +.console-body .strip .switch-section .hw-switch-socket>.switch:active:not(:disabled) { + transform:translateY(1px)!important; +} +/* No rectangular mask over switch text: upper bezel is ONLY 1px edge, + mounted in the parent frame, not a moving overlay on the cap. */ +.console-body .strip .switch-section { + align-items:flex-start!important; +} +/* V22 fader: keep original metal PNG, size it ~11% smaller; increase the + full calibration travel consistently across master, channel and rail. + FX absorbs up to 6px extra fader height only when viewport allows; short screens keep original dock. */ +.console-body { + --v13-fader-h:clamp(150px,calc(100dvh - 624px),490px); +} +.console-body .strip .fader-travel { + top:24px!important;bottom:24px!important; +} +.console-body .strip .fader-travel .cap { + width:23px!important;height:48px!important; + background:var(--ari-silver) center/23px 48px no-repeat!important; + filter:none!important;box-shadow:0 1px 0 #010508!important; +} +.console-body .strip.master .fader-travel .cap{ + background:var(--ari-rose) center/23px 48px no-repeat!important; +} +.console-body .strip .fader-box .fader{ + top:24px!important;bottom:24px!important; + height:calc(100% - 48px)!important; +} +.console-body .strip .gain-scale-travel { + top:24px!important;bottom:24px!important; +} +/* Selected channel border is ON TOP of every sub-panel, never buried. + Reuse the existing root strip::after instead of adding DOM nodes or + using strip's background/inset-box-shadow behind opaque children. */ +.console-body .strip.selected { + z-index:2!important; +} +.console-body .strip.selected::after { + content:""!important;position:absolute!important; + inset:0!important;width:auto!important;height:auto!important; + z-index:60!important;pointer-events:none!important; + border:2px solid var(--ch,#7ed5e4)!important; + border-radius:0!important; + background:transparent!important; + box-shadow:inset 0 0 0 1px #061923!important; + opacity:1!important; +} +/* Preserve drag-drop insert indicators without suppressing selected rim. */ +.console-body .strip.channel-drop-before::before, +.console-body .strip.channel-drop-after::before{z-index:61!important} +/* GPU budget: no blurred shading, translucent full-page overlays or + per-strip will-change compositor promotion. Keep interactions responsive. */ +.console-body .strip,.console-body .strip::after, +.console-body .strip .hw-switch-socket { + will-change:auto!important; + filter:none!important; + backdrop-filter:none!important; + -webkit-backdrop-filter:none!important; +} +.console-body .strip .fader-travel .cap, +.console-body .strip .fader-box .fader { + transition:none!important; +} + + +/* V22: iconography faithfully traced from approved wire + FX references. + Inline SVGs are single-pass vector paint; no icon fonts or image requests. */ +.console-body .section-rail .rail-svg-icon{ + width:21px!important;height:21px!important; + display:block;flex:none;overflow:visible;pointer-events:none; + color:inherit;fill:currentColor;opacity:.94; +} +.console-body .section-rail .rail-cell.fx .rail-svg-icon{width:23px!important;height:23px!important} +.console-body .section-rail .rail-cell.send .rail-svg-icon{width:20px!important;height:20px!important} +.console-body .section-rail .rail-cell.route .rail-svg-icon{width:20px!important;height:20px!important} +.console-body .section-rail .rail-cell[data-section]:hover .rail-svg-icon{opacity:1} +.console-body .section-rail .rail-cell[data-section].collapsed .rail-svg-icon{opacity:.76} + + +/* V23 DAW folded-bay correction: a 23px electronic link LED, NEVER the + truncated live patch jack/knob or numeric send badges. Physical rack geometry + and approved FX/WIRE/I/O rail icons are unchanged. */ +.console-body.wire-routing-v15.collapsed-send .strip .send-section.wire-section{ + display:flex!important;flex-direction:column!important;align-items:stretch!important; + justify-content:center!important; + height:23px!important;min-height:23px!important;max-height:23px!important; + padding:0!important;overflow:hidden!important; +} +.console-body.wire-routing-v15.collapsed-send .strip .send-section.wire-section .wire-deck, +.console-body.wire-routing-v15.collapsed-send .strip .send-section.wire-section .wire-tray, +.console-body.wire-routing-v15.collapsed-send .strip .send-section.wire-section .wire-tray.linked{ + display:none!important;visibility:hidden!important;pointer-events:none!important; + width:0!important;height:0!important;min-height:0!important;max-height:0!important; + flex:0 0 0!important;padding:0!important;margin:0!important;overflow:hidden!important; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary{ + display:flex!important;align-items:center!important;justify-content:center!important; + position:relative;z-index:1; + flex:0 0 22px!important;height:22px!important;min-height:22px!important;max-height:22px!important; + width:100%;padding:0!important;margin:0!important; + color:var(--ch,#8babb5);background:transparent!important;border:0!important; + font-size:0!important;line-height:0!important;overflow:hidden!important; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-link-icon{ + display:block;width:28px;height:12px;flex:0 0 28px; + overflow:visible;opacity:.77;pointer-events:none; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-link-trace{ + stroke:currentColor;stroke-width:1.1;fill:none;opacity:.45;stroke-linecap:round; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-link-in, +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-link-out{ + fill:#172c37;stroke:#67808a;stroke-width:1.15; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .has-in .fold-link-in{ + fill:currentColor;stroke:currentColor;opacity:.65; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .has-out .fold-link-out{ + fill:currentColor;stroke:currentColor;opacity:1; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary.is-empty{ + background:transparent!important; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary.has-wire:hover .fold-link-icon{ + opacity:1; +} + + +/* V24: precisely mirror physical patch in 23px folded rail: + LEFT = OUT filled 6.9px contact, RIGHT = IN 10.8px ring + 3.7px center. + Muted idle contacts stay visible. Each direction activates independently + with this channel's assigned color. Fixed 34x16px, no labels or effects. */ +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-link-icon{ + width:34px!important;height:16px!important;flex:0 0 34px!important; + display:block!important;overflow:visible;opacity:1!important; + color:var(--ch,#8aaeb9);pointer-events:none; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-link-out{ + fill:#324956;stroke:#5c7480;stroke-width:.9;opacity:.75; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-link-in{ + fill:#0c202b;stroke:#536b77;stroke-width:1.5;opacity:.9; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .fold-link-in-dot{ + fill:#344e59;stroke:none;opacity:.85; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .has-out .fold-link-out{ + fill:currentColor;stroke:currentColor;opacity:1; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .has-in .fold-link-in{ + fill:#0b222c;stroke:currentColor;opacity:1; +} +.console-body.wire-routing-v15.collapsed-send .strip .wire-fold-summary .has-in .fold-link-in-dot{ + fill:currentColor;opacity:1; +} +/* Three actual physical controls, no useless fourth slot for removed X. */ +.console-body.wire-routing-v15 .strip .wire-tray, +.console-body.wire-routing-v15 .strip .wire-tray.linked{ + grid-template-columns:24px 28px 22px!important;gap:4px!important; +} + + +/* V25 UX: compact physical WIRE, taller fader, thin selected rim, + sharp offline Google Material SVG icons; all same strip+rail tokens. */ +.console-body.wire-routing-v15:not(.collapsed-send){ + --send-h:112px!important; +} +@media(max-height:680px){ + .console-body.wire-routing-v15:not(.collapsed-send){--send-h:102px!important} +} +.console-body{ + --v13-fader-h:clamp(150px,calc(100dvh - 612px),502px); +} +.console-body .strip.selected::after{ + border-width:1px!important; + box-shadow:none!important; +} +/* Icons are inline Material vectors: independent of OS font fallback, + external CDN, SVG filters and extra fonts; keep buttons tactile. */ +.mi-svg{display:inline-block;vertical-align:middle;flex:0 0 auto;pointer-events:none} +.console-body .fx-section .mini.power{ + display:inline-flex!important;align-items:center!important;justify-content:center!important; + line-height:1!important; +} +.console-body .fx-section .mini.power .mi-svg{width:15px;height:15px} +.console-body .fx-section .mini.power.on .mi-svg{fill:currentColor} +.console-body .fx-section .fx-remove{ + display:inline-flex;align-items:center;justify-content:center; +} +.console-body .fx-section .fx-remove .mi-svg{width:14px;height:14px} +.console-body .fx-section .grip{display:inline-flex;align-items:center;justify-content:center} +.console-body .fx-section .grip .mi-svg{width:13px;height:15px} +.mixer-title .panel-sub{display:inline-flex;align-items:center;justify-content:center} +.route-choice-option .choice-symbol{display:inline-flex;align-items:center;justify-content:center} +#preview .mi-svg{margin-right:3px} + + +/* V26 Focus Signal Flow — compact inspectable two-way routing ledger. + Incoming is behind the selected channel's outgoing paths in the SAME SVG. + No glow, no additional layer, no moving fader or rack geometry. */ +.mixer-title .wire-legend{ + display:inline-flex;flex:0 1 auto;align-items:center;gap:6px; + min-width:0;max-width:min(52vw,465px); + margin-left:auto;padding:2px 5px; + background:#142932;border:1px solid #38525d;border-radius:3px; + color:#a6c4cd;font:500 9px/1.2 'Segoe UI',Arial,sans-serif; + text-overflow:clip;overflow:hidden;white-space:nowrap; +} +.mixer-title .wire-map-focus{ + flex:none;color:#d5e6eb;font-weight:600;letter-spacing:.03em; +} +.mixer-title .wire-map-group{ + display:inline-flex;align-items:center;gap:3px;min-width:0; + padding-left:6px;border-left:1px solid #304b56; +} +.mixer-title .wire-map-direction{color:#7895a1;flex:none;font-size:8px;letter-spacing:.04em} +.mixer-title .wire-map-chip{ + display:inline-flex;align-items:center;gap:1px;flex:none; + color:var(--wire-hue,#a2c4cf);background:#1a333d; + border:1px solid #38515c;border-radius:3px; + padding:1px 3px;line-height:13px;font-size:9px; +} +.mixer-title .wire-map-chip svg{width:10px;height:10px;flex:0 0 10px} +.mixer-title .wire-map-more{color:#99b4c0;font-size:9px} +.mixer-title .wire-map-none{color:#55707e;font-size:9px} +.routing-wire-overlay .wire-incoming-line, +.routing-wire-overlay .wire-outgoing-line, +.routing-wire-overlay .wire-outgoing-shadow{filter:none;pointer-events:none} + + +/* V27 narrow console QA: toolbar operations must never run into each + other at laptop widths. Keep drop-down overflow visible. */ +@media(max-width:1360px){ + .command-bar{gap:4px!important;padding-inline:5px!important;min-width:0!important} + .command-bar>.toolbar-label{display:none!important} + .command-bar>.sep{display:none!important} + .command-bar>#bankSelect{width:clamp(104px,12vw,142px)!important;min-width:100px!important;max-width:142px!important;flex:0 1 auto!important} + .command-bar>#densitySelect{width:102px!important;min-width:83px!important;max-width:105px!important;flex:0 1 auto!important} + .command-bar>#sofTarget{width:74px!important;min-width:55px!important;max-width:85px!important;flex:0 1 auto!important} + .command-bar>#sceneSelect{width:71px!important;min-width:52px!important;max-width:77px!important;flex:0 1 auto!important} + .command-bar>#sofToggle{min-width:0!important;max-width:140px!important;overflow:hidden!important;text-overflow:ellipsis!important} + .command-bar>.tool,.command-bar>.more-tools{flex-shrink:0!important} + .command-bar>.tool:not(.bank-arrow){padding-inline:7px!important} +} +@media(max-width:1030px){ + .command-bar>#sofToggle{max-width:100px!important} + .command-bar>#clearCue{max-width:77px!important;overflow:hidden!important;text-overflow:ellipsis!important} +} + +/* V28 FADER HEIGHT — regain visual travel from unused FX whitespace. + All strips and rail share --v13-fader-h, no change to knob asset or lower anchors. */ +.console-body{--v13-fader-h:clamp(160px,calc(100dvh - 584px),530px)} +/* WIRE stays sharply painted: no blur, shared ferrule or SVG filters. */ +.routing-wire-overlay path{filter:none!important;pointer-events:none} + + +/* V30 PHYSICAL BUTTON CORRECTION — owner screenshot 2026-11-02. + UI research: Dan Andersson's 3D Buttons CodePen (praktikdan/jbqBWm), + based on Mikael Eidenberg's synth-button concept. Adapted material and + raised-vs-recessed behavior for small mixer strips, not the demo's + mutually exclusive jQuery toggle. Original on/off model is unchanged. + + Core correction from V29: a #333 key ON dark #142832 chassis was too close + in luminance to its bezel; remove tiny black-on-black keycap and glowing + text illusion. Brighter GRAPHITE SATIN cap rests physically ABOVE a static + dark switchplate; latched buttons sit INSIDE the same opening. Narrow + LED seams are IN the depressed face — no diffuse shadow or filter. */ +:root{ + --am-key30-top:#738692; + --am-key30-bottom:#354750; + --am-key30-hover-top:#8296a0; + --am-key30-hover-bottom:#40535d; + --am-key30-down-top:#27353d; + --am-key30-down-bottom:#151e25; + --am-key30-hairline:linear-gradient(90deg,transparent 0%,#ecfaffb0 50%,transparent 100%); + --am-key30-lowline:linear-gradient(90deg,transparent 0%,#a8c6d858 50%,transparent 100%); +} +/* One stationary shared key well for all three MUTE/SOLO/PFL caps. This + plate and each .hw-switch-socket's overlaid lip NEVER move on click. */ +.console-body .strip .switch-section{ + background:#0b1a22!important; + border-top:1px solid #040e14!important; + border-bottom:1px solid #415764!important; + box-shadow:inset 0 1px #02090d,inset 0 -1px #2c424e!important; +} +.console-body .strip .switch-section .hw-switch-socket{ + background:#061118!important; + border:1px solid #050b0f!important; + border-radius:3px!important; + box-shadow:inset 0 1px 0 #000,inset 1px 0 0 #000, + inset -1px 0 0 #425965,inset 0 -1px 0 #435a64!important; + transform:none!important; +} +.console-body .strip .switch-section .hw-switch-socket::before{ + background:linear-gradient(180deg,#030a10,#142630)!important; + z-index:0!important; +} +.console-body .strip .switch-section .hw-switch-socket::after{ + z-index:4!important; + pointer-events:none!important; + border-radius:3px!important; + box-shadow:inset 0 1px 0 #b1cdd43b,inset 1px 0 0 #9cb9c32f, + inset -1px 0 0 #000e,inset 0 -1px 0 #050b10!important; +} +/* This one shared satin-material token also styles toolbar and ordinary + rectangular push controls, but never faders, sockets for patch cables, + VU meter or pan thumb. No layered waves or bright-dark-bright cycles. */ +:is( + .command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section .hw-switch-socket>.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +){ + --am-key30-led:#6acadd; + position:relative!important; + z-index:2!important; + box-sizing:border-box!important; + border:1px solid #7b929d!important; + border-top-color:#b4c7cf!important; + border-right-color:#263842!important; + border-bottom-color:#1a282f!important; + border-radius:2px!important; + background:linear-gradient(180deg,var(--am-key30-top) 0%,var(--am-key30-bottom) 100%)!important; + color:#f3f8fa!important; + text-shadow:0 -1px 0 #0e1c24!important; + box-shadow:inset 1px 0 0 #d6eff92f,inset 0 1px 0 #ffffff31, + 0 1px 0 #17252d,0 2px 0 #060c10!important; + transform:translateY(0)!important; + filter:none!important;backdrop-filter:none!important; + -webkit-backdrop-filter:none!important; + transition:none!important; +} +:is( + .command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section .hw-switch-socket>.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +)::before{ + content:""!important;display:block!important;position:absolute!important; + left:2px!important;right:2px!important;top:0!important;bottom:auto!important; + width:auto!important;height:2px!important; + background:var(--am-key30-hairline)!important; + border:0!important;box-shadow:none!important;pointer-events:none!important; +} +:is( + .command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section .hw-switch-socket>.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +)::after{ + content:""!important;display:block!important;position:absolute!important; + left:2px!important;right:2px!important;bottom:0!important;top:auto!important; + width:auto!important;height:1px!important; + background:var(--am-key30-lowline)!important; + border:0!important;box-shadow:none!important;pointer-events:none!important; +} +:is( + .command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section .hw-switch-socket>.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +):hover:not(:disabled):not(.on):not(.active):not([aria-pressed="true"]):not([aria-expanded="true"]){ + background:linear-gradient(180deg,var(--am-key30-hover-top),var(--am-key30-hover-bottom))!important; + box-shadow:inset 1px 0 0 #e6f5fa36,inset 0 1px 0 #ffffff39, + 0 1px 0 #17252d,0 2px 0 #060c10!important; +} +/* One color-variable controls the pair of LED seams; keep label readable + even when no accent LED is illuminated. Never use text-shadow glow. */ +:is( + .console-body .strip .switch-section .hw-switch-socket>.switch.on, + .command-bar button.tool.active,.command-bar button.tool[aria-pressed="true"], + .command-bar summary.tool[aria-expanded="true"], + .more-tools[open] summary.tool,.more-tools-panel button.tool.active, + button.hw-key[aria-pressed="true"] +){ + --am-key30-led:#6acadd; + background:linear-gradient(180deg,var(--am-key30-down-top),var(--am-key30-down-bottom))!important; + border:1px solid #09151b!important; + border-top-color:#0a1319!important; + border-left-color:#08121a!important; + border-right-color:#081219!important; + border-bottom-color:#263944!important; + color:#edf8fb!important; + box-shadow:inset 0 2px 1px #000b,inset 1px 0 0 #eaf6ff0d, + inset 0 -1px 0 #b8d8e328!important; + text-shadow:0 1px 0 #000!important; + transform:translateY(1px)!important; +} +:is( + .console-body .strip .switch-section .hw-switch-socket>.switch.on, + .command-bar button.tool.active,.command-bar button.tool[aria-pressed="true"], + .command-bar summary.tool[aria-expanded="true"], + .more-tools[open] summary.tool,.more-tools-panel button.tool.active, + button.hw-key[aria-pressed="true"] +)::before{ + left:0!important;right:auto!important;top:3px!important;bottom:3px!important; + width:2px!important;height:auto!important; + background:linear-gradient(180deg,transparent,var(--am-key30-led) 38%, + var(--am-key30-led) 62%,transparent)!important; +} +:is( + .console-body .strip .switch-section .hw-switch-socket>.switch.on, + .command-bar button.tool.active,.command-bar button.tool[aria-pressed="true"], + .command-bar summary.tool[aria-expanded="true"], + .more-tools[open] summary.tool,.more-tools-panel button.tool.active, + button.hw-key[aria-pressed="true"] +)::after{ + left:auto!important;right:0!important;top:3px!important;bottom:3px!important; + width:2px!important;height:auto!important; + background:linear-gradient(180deg,transparent,var(--am-key30-led) 38%, + var(--am-key30-led) 62%,transparent)!important; +} +.console-body .strip .switch-section .hw-switch-socket>.switch.on.mute{ + --am-key30-led:#ef6376;color:#ffe9ed!important; +} +.console-body .strip .switch-section .hw-switch-socket>.switch.on.solo{ + --am-key30-led:#f6d16b;color:#fff0c0!important; +} +.console-body .strip .switch-section .hw-switch-socket>.switch.on.cue{ + --am-key30-led:#78d3e9;color:#dffaff!important; +} +:is( + .command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section .hw-switch-socket>.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +):active:not(:disabled){ + transform:translateY(1px)!important; + box-shadow:inset 0 2px 1px #000a,inset 0 -1px 0 #cce5f116!important; +} +:is( + .command-bar button.tool,.command-bar summary.tool,.more-tools-panel button.tool, + .console-body .strip .switch-section .hw-switch-socket>.switch, + .identity-actions button.console-control,.plugin-footer button, + .route-choice-head button,.route-choice-option,button.hw-key +):focus-visible{outline:2px solid #80d5ed!important;outline-offset:2px!important} + + +/* V31 — FL-style suspended routing: actual OUT/IN/GAIN patch hardware TOP, + the flexible signal cables hang below under their own simulated weight. + The panel is strictly a GUI reference; don't move PAN, FX, M/S/PFL, faders. + Reorder only expanded compartments. Folded WIRE remains 23px icon-only. */ +.console-body.wire-routing-v15:not(.collapsed-send) .strip .wire-section{ + display:flex!important;flex-direction:column!important; + justify-content:flex-start!important; +} +.console-body.wire-routing-v15:not(.collapsed-send) .strip .wire-section .wire-tray{ + order:-2!important;flex-shrink:0!important; + border-top:0!important;border-bottom:1px solid #405965!important; +} +.console-body.wire-routing-v15:not(.collapsed-send) .strip .wire-section .wire-deck{ + order:0!important;flex:1 1 0!important;min-height:0!important; + background:#101f29!important;border-bottom:0!important; + box-shadow:inset 0 2px 4px #07131b6e!important; + padding:0!important; +} +.console-body.wire-routing-v15:not(.collapsed-send) .strip .wire-section .wire-deck-label, +.console-body.wire-routing-v15:not(.collapsed-send) .strip .wire-section .wire-deck-status, +.console-body.wire-routing-v15:not(.collapsed-send) .strip .wire-section .wire-deck-rail{ + display:none!important; +} + +/* Source port: https://codepen.io/praktikdan/pen/jbqBWm + "3D Buttons" by Dan Andersson, from Mikael Eidenberg's synth-button + artwork. Original gradient, rim, depth, hover, selected inset and + glowing blue separator are preserved. Geometry only is reduced to + the existing ArSonMix strip. MUTE/SOLO latch independently, unlike + CodePen's mutually-exclusive demo JS. PFL and other controls unchanged. */ +.console-body .strip .switch-section .codepen-buttons-wrapper{ + display:flex!important;align-items:stretch!important;position:relative!important; + flex:2 1 0!important;min-width:0!important; + height:calc(var(--switch-h) - 7px)!important;max-height:34px!important;min-height:24px!important; + border-radius:7px!important;background-color:black!important; + border:2px solid black!important;box-shadow:0 4px 8px rgba(0,0,0,.55)!important; + isolation:isolate!important;overflow:visible!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button{ + position:relative!important;z-index:1!important;float:left!important; + display:flex!important;align-items:center!important;justify-content:center!important; + flex:1 1 0!important;width:50%!important;min-width:0!important;height:100%!important; + min-height:0!important;max-height:none!important;padding:0!important;margin:0 1px!important; + background:#222!important;background-image:linear-gradient(#333,#222)!important; + text-align:center!important;border-radius:2px!important; + border:0!important;border-top:1px solid rgba(255,255,255,.25)!important; + border-left:1px solid rgba(255,255,255,.05)!important; + border-right:1px solid rgba(255,255,255,.05)!important; + box-shadow:inset 0 1px 0 rgba(0,0,0,.1)!important; + cursor:pointer!important;transform:none!important;filter:none!important; + transition:all .175s ease!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button:first-child{ + border-top-left-radius:5px!important;border-bottom-left-radius:5px!important;margin-left:0!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button:last-child{ + border-top-right-radius:5px!important;border-bottom-right-radius:5px!important;margin-right:0!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button:hover:not(.selected):not(:disabled){ + z-index:2!important;background-image:linear-gradient(#373737,#262626)!important; + box-shadow:inset 0 1px 0 rgba(0,0,0,.1),0 4px 16px rgba(0,0,0,.5)!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button .fa{ + position:relative!important;display:block!important;width:auto!important;pointer-events:none!important; + color:#424242!important;text-shadow:0 -1px 0 rgba(0,0,0,.75)!important; + font:400 10px/1 Roboto,"Segoe UI",Arial,sans-serif!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button.selected{ + z-index:3!important;cursor:pointer!important; + background-image:linear-gradient(#202020,#151515)!important; + border-top-color:rgba(0,0,0,0)!important; + border-left-color:rgba(0,0,0,.55)!important;border-right-color:rgba(0,0,0,.55)!important; + box-shadow:inset 0 1px 6px rgba(0,0,0,.5),0 10px 20px rgba(255,255,255,.06)!important; + transform:none!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button::before, +.console-body .strip .switch-section .codepen-buttons-wrapper>.button::after{ + content:none!important;display:none!important;border:0!important;box-shadow:none!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button.selected::before, +.console-body .strip .switch-section .codepen-buttons-wrapper>.button.selected::after{ + content:""!important;display:block!important;position:absolute!important; + top:0!important;bottom:auto!important;height:100%!important;width:1px!important; + background-image:linear-gradient(rgba(0,0,0,.25),rgba(2,165,238,.4),rgba(0,0,0,.25))!important; + border:0!important;box-shadow:none!important;pointer-events:none!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button.selected::before{ + left:-4px!important;right:auto!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button.selected::after{ + right:-4px!important;left:auto!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button:first-child.selected::before, +.console-body .strip .switch-section .codepen-buttons-wrapper>.button:last-child.selected::after{ + display:none!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button.selected .fa{ + color:white!important;text-shadow:0 0 10px rgba(2,165,238,.75)!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button.selected .fa::after{ + content:""!important;display:block!important;position:absolute!important; + bottom:-3px!important;left:0!important;width:100%!important;height:1px!important; + background-image:linear-gradient(to right,rgba(255,255,255,0),rgba(255,255,255,.045),rgba(255,255,255,0))!important; + pointer-events:none!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button:active:not(:disabled){ + transform:none!important; +} +.console-body .strip .switch-section .codepen-buttons-wrapper>.button:focus-visible{ + outline:2px solid #8cc5da!important;outline-offset:1px!important; +} +@media(prefers-reduced-motion:reduce){ + .console-body .strip .switch-section .codepen-buttons-wrapper>.button{transition:none!important} +} + + +/* V33 compact all-bank patch picker: native keyboard accessible, no overlay. */ +.mixer-title .wire-dest-picker{height:19px;min-width:118px;max-width:170px; + background:#172b34;color:#dcf0f5;border:1px solid #54717e;border-radius:3px; + font:500 10px/17px 'Segoe UI',Arial,sans-serif;padding:0 3px;cursor:pointer} +.mixer-title .wire-dest-picker:focus-visible{outline:1px solid #9ad2df;outline-offset:1px} +.mixer-title .wire-patch-source{color:#c0dfe8;font:600 10px/17px 'Segoe UI',Arial,sans-serif;white-space:nowrap} +/* V32 off-bank patch context: visible state, not extra operator chrome. */ +.mixer-title .wire-offbank-source{ + flex:none;max-width:215px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; + font:600 9px/14px 'Segoe UI',Arial,sans-serif;color:#d2f0e1; + background:#1e3b36;border:1px solid #507f71;border-radius:3px;padding:0 5px; + cursor:pointer; +} +.mixer-title .wire-offbank-source:hover,.mixer-title .wire-offbank-source:focus-visible{ + border-color:#91d0b7;color:white; +} +.mixer-title .wire-offbank-instruction{color:#bad0d7;font:500 9px/15px 'Segoe UI',Arial,sans-serif;overflow:hidden;text-overflow:ellipsis} +.routing-wire-overlay .wire-offbank-entry{pointer-events:none} + +/* V33 — Operator intent, tactile SEND and compact high-end console finish */ +.console-body .strip .wire-node-out:not(.is-source), +.console-body .strip .wire-node-in:not(.is-source):not(.is-linked){ + color:#687881!important;border-color:#364954!important;background:#1a2c36!important; + box-shadow:inset 0 1px 2px #07141c!important; +} +.console-body .strip .wire-node-out:not(.is-source) .wire-pin, +.console-body .strip .wire-node-in:not(.is-linked):not(.is-source) .wire-arrow{ + color:#677985!important;filter:none!important; +} +.console-body .strip .wire-node-out:hover:not(:disabled), +.console-body .strip .wire-node-in:hover:not(:disabled){border-color:#98adb7!important} +.console-body .strip .wire-tray .wire-pot:not(.is-idle){ + width:22px!important;min-width:22px!important;flex:0 0 22px!important; + height:24px!important;cursor:ns-resize!important;touch-action:none;user-select:none; +} +.console-body .strip .wire-tray .wire-pot:not(.is-idle)::before{ + content:""!important;inset:2px 1px!important;width:20px!important;height:20px!important; + background:radial-gradient(circle at 35% 25%,#a9b8bf,#647b86 48%,#314956 77%,#182e39)!important; + border:1px solid #8da4af!important;border-radius:50%!important; + box-shadow:inset 0 1px #e5f5ff66,inset 0 -2px 2px #0b1922,0 1px 1px #030b0e!important; +} +.console-body .strip .wire-tray .wire-pot:not(.is-idle)::after{ + width:2px!important;height:8px!important;top:6px!important;left:calc(50% - 1px)!important; + transform-origin:50% 9px!important;transform:rotate(var(--wire-deg,110deg))!important; + background:#ebf8fc!important;box-shadow:none!important; +} +.console-body .strip .wire-tray .wire-pot .wire-gain{ + position:absolute!important;inset:0!important;width:100%!important;height:100%!important; + opacity:0!important;cursor:ns-resize!important;touch-action:none!important; +} +.console-body .fader-travel .cap{ + width:30px!important;height:64px!important;background-size:30px 64px!important; +} +.command-bar{align-items:center!important;gap:5px!important} +.command-bar .tool,.command-bar .toolbar-select{white-space:nowrap;text-overflow:ellipsis} +.command-bar .toolbar-label{letter-spacing:.04em} +@media(max-width:1400px){.command-bar{gap:3px!important}.command-bar .tool{padding-inline:6px!important}} +/* Neutral dormant routing: existing connections remain in data, but no + bright LEDs until the operator explicitly engages the SEND patch zone. */ +.console-body:not(.wire-intent) .strip .wire-tray .wire-node-in, +.console-body:not(.wire-intent) .strip .wire-tray .wire-node-out{ + color:#6e7d85!important;border-color:#364854!important; + background:#192a34!important;filter:none!important; + box-shadow:inset 0 1px 2px #07131a!important; +} +.console-body:not(.wire-intent) .strip .wire-tray .wire-node-in *, +.console-body:not(.wire-intent) .strip .wire-tray .wire-node-out *{ + color:#70818b!important;filter:none!important; +} +.console-body:not(.wire-intent) .strip .wire-tray .wire-pot:not(:hover)::after{background:#9daeb5!important} + +/* V34 — Explicit WIRE arming. Mixer selection never lights routing hardware. */ +.console-body:not(.wire-intent) .strip .wire-node-out, +.console-body:not(.wire-intent) .strip .wire-node-in{filter:none!important} +.console-body .strip .wire-tray .wire-pot:not(.is-idle):focus-within{outline:1px solid #8ad5e3;outline-offset:2px} + +/* V35 exact SVG wire-pot, supplied knob-ICON.svg. One silhouette, no circular + overlay or second indicator: its original notch acts as the pointer. + UI selection cannot illuminate the knob; only an enabled WIRE edge can. */ +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot{ + background:transparent!important;border:0!important;box-shadow:none!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot.is-idle, +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot.is-readonly{ + opacity:1!important;pointer-events:none!important;cursor:default!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot.is-idle::before, +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot.is-active::before{ + content:""!important;display:block!important;position:absolute!important; + inset:2px 1px!important;width:20px!important;height:20px!important; + border:0!important;border-radius:0!important; + background:var(--wire-pot-fill,#4b535b)!important; + -webkit-mask-image:url("assets/knob-ICON.svg")!important; + mask-image:url("assets/knob-ICON.svg")!important; + -webkit-mask-position:center!important;mask-position:center!important; + -webkit-mask-size:contain!important;mask-size:contain!important; + -webkit-mask-repeat:no-repeat!important;mask-repeat:no-repeat!important; + transform-origin:center!important; + transform:rotate(calc(var(--wire-deg,45deg) - 45deg))!important; + box-shadow:none!important;filter:none!important;opacity:1!important; + pointer-events:none!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot::after{ + content:none!important;display:none!important; +} +.console-body.wire-routing-v15 .strip .wire-tray .wire-pot:not(.is-idle):not(.is-readonly){ + cursor:ns-resize!important;touch-action:none!important; +} +@media(prefers-reduced-motion:reduce){ + .console-body.wire-routing-v15 .strip .wire-tray .wire-pot::before{transition:none!important} +} + +/* Native production frontend: original approved console material; no simulated DSP. */ +body .status-bar .warning{color:#e2bd7d}body .strip [disabled]{cursor:not-allowed;opacity:.50}body .console-body .strip .meter-box .vu-tick span{left:7px;right:9px} diff --git a/web/console-native.html b/web/console-native.html new file mode 100644 index 000000000..e744fe799 --- /dev/null +++ b/web/console-native.html @@ -0,0 +1,97 @@ +ArSonMix — Native Live Console +
+
Mixer · Native ConsoleNATIVE MIXER · REAL PCM
+ +
+
Live MixerCH01 · click destination arrows10 audio tracks · 1 bus · master
+
+ +
+
+
+ + + + +
+
StoppedConnecting to native audio engine…PCM FROM NATIVE ENGINE ONLY
+
+ diff --git a/web/console-native.js b/web/console-native.js new file mode 100644 index 000000000..eb8fce7bd --- /dev/null +++ b/web/console-native.js @@ -0,0 +1,205 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// PRODUCTION GUI. No demo PCM, fake plugin catalog, or browser-authored audio graph. +// Render the approved single-console geometry from native accepted snapshots ONLY. +(() => { +'use strict'; +const api=window.__JUCE__?.backend; +const el=id=>document.getElementById(id); +const esc=x=>String(x??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); +const palette=['#1699cd','#b92e41','#cf6b1e','#b28c27','#34a544','#168762','#0e95c9','#066fa9','#7140b5','#b52893','#c32974','#586889']; +const pending=new Map(),lastValues=new Map(); +let snapshot=null,rows=[],bank=0,selected=null,serial=0,lastSignature='',native=!!(api?.emitEvent&&api?.addEventListener); +let controlsEnabled=false; +const announce=(message,problem=false)=>{const n=el('info');if(n){n.textContent=message;n.style.color=problem?'#e2a5a5':'';}}; +const opAvailable=op=>!!(snapshot?.productionCallbackLive? + snapshot.graph?.capabilities?.supportedOps?.includes(op): + snapshot?.legacyM4?.supportedOps?.includes(op)); +const liveLegacy=()=>snapshot?.legacyM4?.controlPlane==='LEGACY_M4_ORDINAL'&& + Array.isArray(snapshot.legacyM4?.acceptedChannels); +const channelId=id=>String(id); +const fmt=v=>{const n=Number(v);return Number.isFinite(n)?n.toFixed(1):'0.0'}; +function normalize(s){ + const graph=s?.graph,legacy=s?.legacyM4,actual=[]; + if(s?.productionCallbackLive&&Array.isArray(graph?.channels)&&graph.channels.length){ + for(const ch of graph.channels)actual.push({ + id:channelId(ch.id),name:String(ch.name||ch.role||'CHANNEL'),role:ch.role, + format:ch.processingFormat||'MONO',source:ch.source?.portId||'', + out:ch.primaryOutId||'',controls:ch.controls||{},fx:ch.inserts||[], + sends:ch.sends||[],legacy:false + }); + }else if(liveLegacy()){ + const list=legacy.acceptedChannels; + for(let i=0;ifilter==='all'||filter==='solo'&&!!r.controls.solo|| + filter==='audio'&&r.role==='INPUT'||filter==='bus'&&r.role==='GROUP'|| + filter==='fx'&&r.role==='FX_RETURN'); +} +function gain(v){const n=Number(v);return Number.isFinite(n)?Math.max(-60,Math.min(10,n)):-60} +function sourceOptions(row){ + const list=['']; + for(const e of snapshot?.device?.inputEndpoints||[]){ + if(!e.active)continue; + list.push(''); + } + return list.join(''); +} +function outputOptions(row){ + let opts=['']; + for(const d of snapshot?.graph?.destinations||[]) + if(d.role==='GROUP'||d.role==='MAIN')opts.push(''); + return opts.join(''); +} +function nativeStrip(r){ + const main=r.role==='MAIN',db=gain(r.controls.faderDb),pan=Number(r.controls.pan)||0; + const can=op=>opAvailable(op)&&native; + const act=(op,attrs='')=>' data-op="'+op+'" data-id="'+esc(r.id)+'"'+attrs+ + (can(op)?'':' disabled title="Requires native accepted operation"'); + const role=main?'master':r.role==='GROUP'?'bus':r.role==='FX_RETURN'?'fx':'audio'; + const color=palette[(rows.indexOf(r)+palette.length)%palette.length]; + const meterTick=[0,-6,-12,-18,-24,-36,-48,-60].map(v=>''+v+'').join(''); + const gainTick=[10,0,-6,-12,-24,-36,-48,-60].map(v=>''+v+'').join(''); + const format=String(r.format).toUpperCase()==='STEREO'?'STEREO':'MONO'; + const fx=(r.fx||[]).slice(0,8).map(slot=>{ + const token=esc(slot.instanceId||slot.id||''); + return '
'+ + '
'; + }).join(''); + return '
'+ + '
'+(main?'MASTER':esc(r.id))+''+esc(r.name)+'
'+ + '
IN / OUT
'+ + '
IN
'+ + '
OUT
'+ + '
'+fx+ + '
'+ + '
SEND'+esc((r.sends||[]).length)+' native sends
'+ + '
PAN'+Math.round(pan)+'
'+ + '
'+ + ''+ + ''+ + '
'+ + '
'+fmt(db)+' dBCLIP
'+ + '
'+ + (format==='MONO'?'':'
')+ + '
'+meterTick+'
'+ + '
'+ + '
'+ + '
'+gainTick+'
'+ + '
'+fmt(db)+'
'+ + '
'; +} +function render(){ + const list=listedRows(),max=Math.max(1,Math.ceil(list.length/8));bank=Math.min(bank,max-1); + const start=bank*8,visible=list.slice(start,start+8); + el('tracks').innerHTML=visible.map(nativeStrip).join(''); + const main=rows.find(r=>r.role==='MAIN'); + el('master').innerHTML=main?nativeStrip(main):''; + el('trackCount').textContent=rows.length+' NATIVE CHANNELS · '+(snapshot?.productionCallbackLive?'UNIVERSAL':'LEGACY M4 COMPAT'); + const selector=el('bankSelect');selector.innerHTML=Array.from({length:max},(_,i)=>'').join('');selector.value=String(bank); + el('bankPrev').disabled=bank===0;el('bankNext').disabled=bank>=max-1; + for(const [id,op] of [['addTrack','CREATE_CHANNEL'],['addBus','CREATE_GROUP'],['addFx','CREATE_FX_RETURN'],['clearCue','SET_CUE']]) + if(el(id))el(id).disabled=!snapshot?.productionCallbackLive||!opAvailable(op); + for(const id of ['saveScene','recallScene','sceneSafe','sofToggle','pluginsButton','group','ungroup','copy','paste','pluginScan','pluginImport','pluginAddPath','routeParallel','routeOnly','wireMaster','wireMode']) + if(el(id))el(id).disabled=true; + if(el('pluginBrowser'))el('pluginBrowser').hidden=true; + paintMeters(); +} +function paintMeters(){ + if(!snapshot)return; + const legacy=snapshot.legacyM4||{}; + for(const r of rows){ + const meter=document.querySelector('.strip[data-id="'+CSS.escape(r.id)+'"] .meter-box'); + if(!meter)continue; + const index=Number(r.id)-1; + const dynamic=snapshot.telemetry?.channelMeterRmsPeak?.[r.id]; + let left=r.legacy?Number(legacy.channelPeaksL?.[index]):Number(dynamic); + let right=r.legacy?Number(legacy.channelPeaksR?.[index]):Number(dynamic); + for(const [side,value] of [['left',left],['right',right]]){ + const node=meter.querySelector('.meter-fill.'+side); + if(!node)continue; + const amp=Number.isFinite(value)?Math.max(0,value):0; + const db=amp>0?20*Math.log10(amp):-60; + node.style.setProperty('--lit',Math.max(0,Math.min(100,(db+60)/60*100))+'%'); + } + } +} +function send(op,row,payload){ + if(!api||!snapshot){announce('NATIVE ENGINE NOT CONNECTED',true);return;} + if(!opAvailable(op)){announce(op+' NOT AVAILABLE IN INSTALLED AUDIO ENGINE',true);return;} + if(pending.size){announce('Awaiting prior native ACK',true);return;} + const graph=snapshot.graph||{},device=snapshot.device||{}; + const requestId='console-'+Date.now().toString(36)+'-'+(++serial).toString(36); + const envelope={requestId,deviceEpoch:String(device.epoch),baseGraphRevision:String(graph.revision), + baseRosterRevision:String(graph.rosterRevision),operation:op,targetChannelId:row.id,payload}; + if(row.legacy)envelope.legacyRoutingRevision=String(snapshot.legacyM4.routingRevision); + pending.set(requestId,{op,row:row.id}); + announce('PENDING · '+op+' · awaiting native ACK'); + api.emitEvent('arMixConsoleIntent',envelope); +} +function rowFor(id){return rows.find(x=>x.id===id);} +function submitNode(n){ + const row=rowFor(n.dataset.id),op=n.dataset.op; + if(!row||!op)return; + if(op==='SET_SOURCE')send(op,row,{portId:n.value,sourceFormat:'MONO'}); + else if(op==='SET_PROCESSING_FORMAT')send(op,row,{format:row.format==='MONO'?'STEREO':'MONO'}); + else if(op==='SET_PRIMARY_OUT')send(op,row,{destinationId:n.value}); + else if(op==='SET_FADER')send(op,row,{valueDb:Number(n.value)}); + else if(op==='SET_PAN')send(op,row,{value:Number(n.value)}); + else if(op==='SET_MUTE'||op==='SET_SOLO')send(op,row,{enabled:!row.controls[op==='SET_MUTE'?'mute':'solo']}); + else if(op==='OPEN_INSERT_EDITOR')send(op,row,{insertId:n.dataset.insert}); + else if(op==='SET_INSERT_BYPASS')send(op,row,{insertId:n.dataset.insert,bypassed:n.dataset.bypassed!=='true'}); +} +function accept(s){ + if(!s||s.schemaVersion!==6)return; + snapshot=s;rows=normalize(s); + const signature=JSON.stringify([rows.map(r=>[r.id,r.name,r.role,r.format,r.source,r.out,r.controls,r.fx]),s.legacyM4?.supportedOps,s.graph?.capabilities?.supportedOps]); + if(signature!==lastSignature){lastSignature=signature;render();}else paintMeters(); + el('transport').textContent=s.device?.outputArmed?'OUTPUT ARMED':'OUTPUT DISARMED'; + announce(rows.length?('NATIVE SNAPSHOT · '+rows.length+' accepted channels · '+(s.device?.backend||'DEVICE NOT READY')):'NATIVE ENGINE · No accepted PCM channels'); +} +function ack(a){ + const key=a?.requestId,op=pending.get(key); + if(!op)return; + pending.delete(key); + announce(a.status==='ACCEPTED'?op.op+' ACCEPTED · verifying native snapshot': + op.op+' REJECTED · '+(a.errorCode||'UNKNOWN'),a.status!=='ACCEPTED'); + // Never mutate GUI state from ACK alone; subsequent native snapshot is authoritative. +} +document.addEventListener('change',e=>{ + const n=e.target.closest('[data-op]'); + if(n)submitNode(n); + if(e.target.id==='bankSelect'){bank=Number(e.target.value)||0;render();} + if(e.target.id==='viewFilter'){bank=0;render();} + if(e.target.id==='densitySelect')document.querySelector('.console-body').dataset.density=e.target.value; +}); +document.addEventListener('click',e=>{ + const n=e.target.closest('button[data-op]'); + if(n)submitNode(n); + if(e.target.closest('#bankPrev')){bank=Math.max(0,bank-1);render();} + if(e.target.closest('#bankNext')){bank++;render();} + const section=e.target.closest('[data-section]'); + if(section){const n=section.dataset.section,body=document.querySelector('.console-body'); + body.classList.toggle('collapsed-'+n);section.setAttribute('aria-expanded',String(!body.classList.contains('collapsed-'+n)));} +}); +for(const id of ['wireView','wireMode','sofTarget'])if(el(id))el(id).disabled=true; +if(!native){announce('NATIVE JUCE BACKEND REQUIRED · NO SIMULATED AUDIO',true);return;} +api.addEventListener('arMixConsoleSnapshot',accept); +api.addEventListener('arMixConsoleAck',ack); +api.addEventListener('arMixStatus',s=>{if(s?.error)announce(String(s.error),true);}); +api.addEventListener('arMixNotice',s=>{if(s?.text)announce(String(s.text),!!s.error);}); +const start=()=>{api.emitEvent('arMixGuiReady',{protocol:1}); + api.emitEvent('arMixConsoleSubscribe',{protocol:'v6',requester:'native-console'}); +}; +if(document.fonts?.ready)document.fonts.ready.then(()=>requestAnimationFrame(start),()=>requestAnimationFrame(start)); +else requestAnimationFrame(start); +})(); \ No newline at end of file From d1716f3adbbd02722f165a4e4d001ef03783939a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 03:06:01 +0700 Subject: [PATCH 097/155] test(console): enforce native approved WebView2 root and repair CI artifact assertions Source authority now checks actual console-native.html/js, native BinaryData provider, real ACK/PCM meter consumer, and absence of retired ten-channel renderer. Correct prior CI test regex syntax so test suite can run, and keep integrated-release universal callback gate fail-closed. --- scripts/check_console_puzzle.mjs | 22 +++++++++++++++---- tests/ci_workflow_efficiency_test.mjs | 8 +++---- ...ative_artifact_packaging_contract_test.mjs | 9 ++++++++ 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/scripts/check_console_puzzle.mjs b/scripts/check_console_puzzle.mjs index ddadd4952..12cf08be3 100644 --- a/scripts/check_console_puzzle.mjs +++ b/scripts/check_console_puzzle.mjs @@ -12,8 +12,9 @@ const files={ guiTest:'tests/operator_console_v6_smoke.py', fat:'scripts/console_v6_fat_gate.mjs', fatTest:'tests/console_v6_fat_gate_test.mjs', - operatorHtml:'web/index.html', - operatorApp:'web/app.js', + operatorHtml:'web/console-native.html', + operatorApp:'web/console-native.js', + nativeEntry:'src/Main.cpp', cmake:'CMakeLists.txt' }; const release=process.argv.includes('--release'); @@ -33,6 +34,7 @@ const checks=[ ['GUI retired ten-strip demo removed', !/\bconst\s+raw\s*=\s*\[/.test(data.operatorApp) && !/\bconst\s+channels\s*=\s*raw\.map\s*\(/.test(data.operatorApp), + 'GUI #271: replace hard-coded 10-channel demo array with native accepted ChannelId roster'], ['GUI approved single Console is packaged, not retired multi-workspace shell', !/data-view=["']FX RACK["']/.test(data.operatorHtml) && @@ -44,9 +46,21 @@ const checks=[ /CREATE_CHANNEL/.test(data.gui) && (data.gui.includes('graph.channels') || data.gui.includes('graph?.channels')), 'ENGINE #266 + GUI #271: CREATE_CHANNEL native ACK then accepted graph.channels renders CH11+, no browser-created strips'], + ['Windows WebView2 root serves native approved Console, NOT legacy index', + /data = BinaryData::consolenative_html/.test(data.nativeEntry) && + /console-native\.css/.test(data.nativeEntry) && + /console-native\.js/.test(data.nativeEntry) && + !/AR MIX Studio UI-only demonstration/.test(data.operatorApp), + 'ENGINE #266: native / root must embed approved native operator Console and never the legacy fixed-ten HTML'], + ['Console listens to native ACK/snapshot and never fabricates metering', + /arMixConsoleSubscribe/.test(data.operatorApp) && + /arMixConsoleIntent/.test(data.operatorApp) && + /arMixConsoleAck/.test(data.operatorApp) && + /channelPeaksL/.test(data.operatorApp) && + !/Math\.sin/.test(data.operatorApp), + 'GUI #271: actual native event bus and PCM; no browser animated meters'], ['JUCE BinaryData embeds release-gated operator HTML and JS', - /web\/index\.html\s+web\/styles\.css/.test(data.cmake) && - /web\/app\.js/.test(data.cmake), + /web\/console-native\.html\s+web\/console-native\.css\s+web\/console-native\.js/.test(data.cmake), 'FAT #270: CMake BinaryData must embed audited Console HTML/JS'], ]; execFileSync(process.execPath,['--test','tests/console_v6_puzzle_seam_test.mjs'],{stdio:'inherit'}); diff --git a/tests/ci_workflow_efficiency_test.mjs b/tests/ci_workflow_efficiency_test.mjs index 48867dd77..9060bae9e 100644 --- a/tests/ci_workflow_efficiency_test.mjs +++ b/tests/ci_workflow_efficiency_test.mjs @@ -15,8 +15,8 @@ test('only an integrated product branch may upload a Windows mixer candidate',() assert.match(windows,/'web\/\*\*'/); assert.match(windows,/workflow_dispatch:/); assert.match(windows,/cancel-in-progress: true/); - assert.match(windows,/github\\.event_name == 'pull_request' && startsWith\\(github\\.head_ref, 'integration\\/product-'\\)/); - assert.match(windows,/ArSonMix-INTEGRATED-UNIVERSAL-CONSOLE-EXPERIMENTAL-NOT-HARDWARE-QUALIFIED/); + assert.ok(windows.includes("github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')")); + assert.ok(windows.includes('ArSonMix-INTEGRATED-UNIVERSAL-CONSOLE-EXPERIMENTAL-NOT-HARDWARE-QUALIFIED')); assert.doesNotMatch(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT/); assert.ok(!windows.includes("github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101'")); assert.ok(windows.indexOf('scripts/verify_native_windows_artifact.ps1') < @@ -47,8 +47,8 @@ test('retain current native audio and dearVR CTests during CI optimization',()=> } assert.match(windows,/ctest --test-dir build -C Release --output-on-failure/); assert.match(windows,/'scripts\/build_ui_css\.py'/); - assert.match(windows,/github\\.event_name == 'pull_request' && startsWith\\(github\\.head_ref, 'integration\\/product-'\\)/); - assert.match(windows,/ArSonMix-INTEGRATED-UNIVERSAL-CONSOLE-EXPERIMENTAL-NOT-HARDWARE-QUALIFIED/); + assert.ok(windows.includes("github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')")); + assert.ok(windows.includes('ArSonMix-INTEGRATED-UNIVERSAL-CONSOLE-EXPERIMENTAL-NOT-HARDWARE-QUALIFIED')); assert.doesNotMatch(windows,/ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT/); }); diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index 0d23dc4c7..269642c7b 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -137,11 +137,20 @@ test('FAT ZIP uses current single-APPLY physical first-sound guide',()=>{ test('retired 10CH UI cannot upload until a joined approved native Console exists',()=>{ const gate=read('scripts/check_console_puzzle.mjs'); + const native=read('src/Main.cpp'); + const gui=read('web/console-native.js'); + const html=read('web/console-native.html'); assert.match(gate,/GUI retired ten-strip demo removed/); assert.match(gate,/GUI approved single Console is packaged/); assert.match(gate,/GUI direct universal channel operation/); assert.match(gate,/data\.operatorHtml/); assert.match(gate,/CREATE_CHANNEL/); + assert.match(native,/BinaryData::consolenative_html/); + assert.match(gui,/arMixConsoleSubscribe/); + assert.match(gui,/arMixConsoleAck/); + assert.match(gui,/channelPeaksL/); + assert.match(html,/ArSonMix — Native Live Console/); + assert.doesNotMatch(html,/data-view="FX RACK"/); assert.match(workflow,/github\.event_name != 'pull_request' \|\| startsWith\(github\.head_ref, 'integration\/product-'\)/); const upload=workflow.split('uses: actions/upload-artifact@v4')[1]||''; assert.ok(upload.includes("github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')")); From c02769e88fc535ceb9b49170aab8dfc4ecd5345e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 03:08:11 +0700 Subject: [PATCH 098/155] test(native-console): verify new WebView2 entrypoint while preserving legacy migration assets Product source now opens approved Console instead of legacy index; tests must distinguish active WebView2 entrypoint from retained old HTML/JS compatibility sources. Assert source list includes both without quietly passing a legacy root. --- tests/native_artifact_packaging_contract_test.mjs | 3 ++- tests/reconciled_gui_engine_contract_test.mjs | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index 269642c7b..e7c609c34 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -106,7 +106,8 @@ test('latest BTN-180 GUI palette is an attested embedded native release requirem assert.ok(verify.includes('"'+token+'"'), 'native verified executable missing acceptance marker '+token); } assert.match(verify,/inset 5px 5px 2px -1px/); - assert.match(cmake,/web\/index\.html web\/styles\.css web\/plugin-ui\.css web\/app\.js web\/plugin-ui\.js web\/bridge\.js web\/monitor\.js/); + assert.match(cmake,/web\/index\.html web\/console-native\.html web\/console-native\.css web\/console-native\.js/); + assert.match(cmake,/web\/app\.js web\/plugin-ui\.js web\/bridge\.js web\/monitor\.js/); assert.match(nativeMain,/BinaryData::index_html/); assert.match(nativeMain,/BinaryData::bridge_js/); assert.match(nativeMain,/BinaryData::pluginui_js/); diff --git a/tests/reconciled_gui_engine_contract_test.mjs b/tests/reconciled_gui_engine_contract_test.mjs index d67b473fb..4919bf9a4 100644 --- a/tests/reconciled_gui_engine_contract_test.mjs +++ b/tests/reconciled_gui_engine_contract_test.mjs @@ -50,7 +50,7 @@ test('JUCE native resources track the approved calibrated GUI without maintainin const cpp=read('src/Main.cpp'); const sourceCss=read('web/styles-src/42-mixer-premium.css'); const standalone=read('AR-MIX-Live-FX-Host-Standalone-v0.3.html'); - // Verify legacy assets in original order, while allowing additive UI modules. + // Legacy migration assets remain embedded for history; live root MUST use approved Console. const assetList=cmake.match(/juce_add_binary_data\(ARMixAssets SOURCES\s+([^)]+)\)/)?.[1]; assert.ok(assetList,'native WebView2 source list missing'); const expected=['web/index.html','web/styles.css','web/plugin-ui.css','web/app.js', @@ -58,7 +58,12 @@ test('JUCE native resources track the approved calibrated GUI without maintainin const listed=assetList.trim().split(/\s+/); for(const asset of expected) assert.ok(listed.includes(asset),'missing WebView2 asset '+asset); assert.equal(new Set(listed).size,listed.length,'duplicate native WebView2 resource'); - for (const resource of ['index_html','styles_css','pluginui_css','app_js','pluginui_js','bridge_js','monitor_js']) { + for(const path of ['web/console-native.html','web/console-native.css','web/console-native.js']) + assert.ok(listed.includes(path),'approved native Console not embedded: '+path); + assert.match(cpp,/path == "\/" \|\| path == "\/index.html"/); + assert.match(cpp,/data = BinaryData::consolenative_html/); + assert.doesNotMatch(cpp,/data = BinaryData::index_html/); + for (const resource of ['consolenative_html','consolenative_css','consolenative_js','styles_css','pluginui_css','app_js','pluginui_js','bridge_js','monitor_js']) { assert.ok(cpp.includes('BinaryData::'+resource),resource+' missing from WebView provider'); } assert.ok(css.endsWith(sourceCss), 'native CSS must end with its authoritative calibration module'); From d597ea3229ef649b3e85868032964a3ccc2aaa12 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 03:09:07 +0700 Subject: [PATCH 099/155] fix(packaging): attest approved native Console source in Windows executable Manifest tracks native console HTML/CSS/JS hashes and active JUCE entrypoint; EXE verifier checks exact embedded source text and refuses wrong old index runtime even when old asset hashes match. Retain legacy compatibility as non-executed assets only. --- scripts/package_native_windows.ps1 | 9 ++++-- scripts/verify_native_windows_artifact.ps1 | 30 +++++++++++++++++++ ...ative_artifact_packaging_contract_test.mjs | 6 ++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/scripts/package_native_windows.ps1 b/scripts/package_native_windows.ps1 index 0b35cb7f8..534a6534c 100644 --- a/scripts/package_native_windows.ps1 +++ b/scripts/package_native_windows.ps1 @@ -77,7 +77,7 @@ Copy-Item -LiteralPath $fatGuide -Destination (Join-Path $OutputDir "HARDWARE_FA $manifest = [ordered]@{ schema = "arsonmix.native-artifact-provenance.v1" sourceCommit = $gitSha - gui = "10 SOURCE CHANNELS + STEREO MASTER (PR #73)" + gui = "APPROVED SINGLE LIVE CONSOLE · NATIVE SNAPSHOT ONLY · UNIVERSAL FEATURES GATED" engine = "R0B VERIFIED DIRECT 10CH PLUS FOUR AUX PREPARED NATIVE MIXER__HARDWARE_FAT_UNQUALIFIED" nativeDSP = "NATIVE_TEN_INPUT_CHANNELS_FOUR_DEDICATED_STEREO_AUX_RETURNS_MASTER__EXPLICIT_PATCH_ACK" storageMode = "PORTABLE_MARKER__USER_STUDIO_EMPTY_AT_RELEASE" @@ -93,6 +93,11 @@ $manifest = [ordered]@{ peFormat = "PE32+" peSubsystem = "WINDOWS_GUI (2)" exeSha256 = (Get-FileHash -LiteralPath $destination -Algorithm SHA256).Hash.ToLowerInvariant() + # Production runtime is the approved Console; legacy index is no longer the WebView2 root. + consoleNativeHtmlSha256 = (Get-FileHash -LiteralPath "web/console-native.html" -Algorithm SHA256).Hash.ToLowerInvariant() + consoleNativeCssSha256 = (Get-FileHash -LiteralPath "web/console-native.css" -Algorithm SHA256).Hash.ToLowerInvariant() + consoleNativeJsSha256 = (Get-FileHash -LiteralPath "web/console-native.js" -Algorithm SHA256).Hash.ToLowerInvariant() + activeGuiEntrypoint = "web/console-native.html__JUCE_BINARYDATA_ROOT" indexHtmlSha256 = (Get-FileHash -LiteralPath "web/index.html" -Algorithm SHA256).Hash.ToLowerInvariant() appJsSha256 = (Get-FileHash -LiteralPath "web/app.js" -Algorithm SHA256).Hash.ToLowerInvariant() stylesCssSha256 = (Get-FileHash -LiteralPath "web/styles.css" -Algorithm SHA256).Hash.ToLowerInvariant() @@ -100,7 +105,7 @@ $manifest = [ordered]@{ pluginUiJsSha256 = (Get-FileHash -LiteralPath "web/plugin-ui.js" -Algorithm SHA256).Hash.ToLowerInvariant() bridgeJsSha256 = (Get-FileHash -LiteralPath "web/bridge.js" -Algorithm SHA256).Hash.ToLowerInvariant() monitorJsSha256 = (Get-FileHash -LiteralPath "web/monitor.js" -Algorithm SHA256).Hash.ToLowerInvariant() - guiSource = "web/index.html + web/styles.css + web/plugin-ui.css + web/app.js + web/plugin-ui.js + web/bridge.js + web/monitor.js (JUCE BinaryData)" + guiSource = "web/console-native.html + web/console-native.css + web/console-native.js (JUCE BinaryData)" guiCalibration = "GAIN_10_TO_MINUS60_BLACK_DETENT_AT_38PX__VU_DBFS_INDEPENDENT_TICKS" fatStatus = "EXPERIMENTAL_NOT_HARDWARE_QUALIFIED" note = "No assertion of clean 0-FX sound, measured round-trip latency or native render-hardware XRUN." diff --git a/scripts/verify_native_windows_artifact.ps1 b/scripts/verify_native_windows_artifact.ps1 index 2641426bb..401172e57 100644 --- a/scripts/verify_native_windows_artifact.ps1 +++ b/scripts/verify_native_windows_artifact.ps1 @@ -33,6 +33,18 @@ if (@(Compare-Object -ReferenceObject $expected -DifferenceObject $actual).Count } $manifest = Get-Content -LiteralPath (Join-Path $OutputDir "BUILD_PROVENANCE.json") -Raw -Encoding UTF8 | ConvertFrom-Json +# The first truly approved Console runtime must be proven INSIDE the shipped EXE, +# not merely shipped alongside an old demo or hidden in unused assets. +if ($manifest.activeGuiEntrypoint -ne "web/console-native.html__JUCE_BINARYDATA_ROOT") { + throw "STALE PRODUCT GUI: active WebView2 entrypoint not approved" +} +$nativeSource = [System.IO.File]::ReadAllText( + (Resolve-Path -LiteralPath "src/Main.cpp").Path,[Text.Encoding]::UTF8) +if ($nativeSource -notmatch 'data = BinaryData::consolenative_html' -or + $nativeSource -match 'data = BinaryData::index_html') { + throw "STALE PRODUCT GUI: native / entrypoint still serves retired HTML" +} + # App-only ZIP does not ship an untracked dynamic WebView2Loader.dll. if ($manifest.webView2LoaderMode -ne "JUCE_WEBVIEW2_LOADER_STATIC_LINKED_V1" -or $manifest.guiStartupVerification -ne "WEBVIEW2_PREFLIGHT_AND_AR_MIX_GUI_READY_HANDSHAKE") { @@ -70,6 +82,9 @@ if ($LASTEXITCODE -ne 0 -or $sha -ne $manifest.sourceCommit) { # hashes recorded next to an unrelated executable. This catches packaging an # older GUI with the latest source files and avoids brittle marker-only checks. $resources = @( + @{Path="web/console-native.html"; Hash=$manifest.consoleNativeHtmlSha256}, + @{Path="web/console-native.css"; Hash=$manifest.consoleNativeCssSha256}, + @{Path="web/console-native.js"; Hash=$manifest.consoleNativeJsSha256}, @{Path="web/index.html"; Hash=$manifest.indexHtmlSha256}, @{Path="web/app.js"; Hash=$manifest.appJsSha256}, @{Path="web/styles.css"; Hash=$manifest.stylesCssSha256}, @@ -91,6 +106,21 @@ foreach ($item in $resources) { throw "STALE NATIVE GUI: exact JUCE BinaryData resource absent from EXE: $($item.Path)" } } +# Require the source-owned native Console transport and approved layout, +# not a perfect legacy-source hash match promoted as the wrong product. +foreach ($marker in @( + "ArSonMix — Native Live Console", + "class=\"console-body", + "arMixConsoleSubscribe", + "arMixConsoleIntent", + "arMixConsoleAck", + "channelPeaksL", + "NATIVE JUCE BACKEND REQUIRED" +)) { + if ($embeddedText.IndexOf($marker,[StringComparison]::Ordinal) -lt 0) { + throw "STALE PRODUCT GUI: native Console runtime marker absent from EXE: $marker" + } +} # Assert current approved calibration is present inside the actual shipped binary. if ($manifest.guiCalibration -ne "GAIN_10_TO_MINUS60_BLACK_DETENT_AT_38PX__VU_DBFS_INDEPENDENT_TICKS") { throw "GUI calibration release contract is missing" diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index e7c609c34..14c1ac455 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -83,15 +83,17 @@ test('physical hardware FAT documents verified 10CH and dedicated 4 AUX native m }); test('release proves exact calibrated GUI bytes are embedded in the executable, not just copied beside it', () => { - for (const field of ['indexHtmlSha256','appJsSha256','stylesCssSha256','pluginUiCssSha256','pluginUiJsSha256','bridgeJsSha256','monitorJsSha256','guiCalibration']) { + for (const field of ['consoleNativeHtmlSha256','consoleNativeCssSha256','consoleNativeJsSha256','activeGuiEntrypoint','indexHtmlSha256','appJsSha256','stylesCssSha256','pluginUiCssSha256','pluginUiJsSha256','bridgeJsSha256','monitorJsSha256','guiCalibration']) { assert.ok(packaging.includes(field+' = '), 'provenance missing '+field); assert.ok(verify.includes('manifest.'+field), 'verifier missing '+field); } - for (const file of ['web/index.html','web/app.js','web/styles.css','web/plugin-ui.css','web/plugin-ui.js','web/bridge.js','web/monitor.js']) { + for (const file of ['web/console-native.html','web/console-native.css','web/console-native.js','web/index.html','web/app.js','web/styles.css','web/plugin-ui.css','web/plugin-ui.js','web/bridge.js','web/monitor.js']) { assert.ok(verify.includes('Path="'+file+'"'), 'native resource not checked: '+file); } assert.match(verify,/IndexOf\(\$sourceText, \[StringComparison\]::Ordinal\)/); assert.match(verify,/STALE NATIVE GUI: exact JUCE BinaryData resource absent from EXE/); + assert.match(verify,/STALE PRODUCT GUI: active WebView2 entrypoint not approved/); + assert.match(verify,/STALE PRODUCT GUI: native Console runtime marker absent from EXE/); for (const marker of ['gain-scale-travel','vu-scale-travel','meter-signal-area','fader-travel']) { assert.ok(verify.includes('"'+marker+'"'), 'calibration marker absent: '+marker); } From 6da9044289ca0b5db17c85bc385bcfcb019d2866 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 03:09:47 +0700 Subject: [PATCH 100/155] fix(windows): quote native console HTML marker correctly in PowerShell release audit --- scripts/verify_native_windows_artifact.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/verify_native_windows_artifact.ps1 b/scripts/verify_native_windows_artifact.ps1 index 401172e57..a0733fc47 100644 --- a/scripts/verify_native_windows_artifact.ps1 +++ b/scripts/verify_native_windows_artifact.ps1 @@ -110,7 +110,7 @@ foreach ($item in $resources) { # not a perfect legacy-source hash match promoted as the wrong product. foreach ($marker in @( "ArSonMix — Native Live Console", - "class=\"console-body", + 'class="console-body', "arMixConsoleSubscribe", "arMixConsoleIntent", "arMixConsoleAck", From 999c59e028535988651f46242e348fa4c7032c4d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 03:12:18 +0700 Subject: [PATCH 101/155] feat(console): connect approved GUI toolbar to real ASIO/WASAPI setup and output ARM The new live Console now opens native device setup and safely arms/mutes hardware via real JUCE monitor action and ACK, rather than leaving the operator unable to configure audio. Dynamic +CHANNEL remains fail-closed until native admission. --- web/console-native.html | 5 +++++ web/console-native.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/web/console-native.html b/web/console-native.html index e744fe799..e5b61bf88 100644 --- a/web/console-native.html +++ b/web/console-native.html @@ -2,6 +2,11 @@
Mixer · Native ConsoleNATIVE MIXER · REAL PCM
'+meterTick+'
'+ '
'+ - '
'+ + ''+ '
'+gainTick+'
'+ '
'+fmt(db)+'
'+ ''; @@ -122,6 +126,8 @@ function render(){ const selector=el('bankSelect');selector.innerHTML=Array.from({length:max},(_,i)=>'').join('');selector.value=String(bank); el('bankPrev').disabled=bank===0;el('bankNext').disabled=bank>=max-1; if(el('nativeAddAudio'))el('nativeAddAudio').disabled=!(opAvailable('CREATE_CHANNEL')||opAvailable('NATIVE_CREATE_CHANNEL')); + if(el('nativeGroup'))el('nativeGroup').disabled=!(opAvailable('NATIVE_CREATE_GROUP_SELECTED')&&selectedIds.size>0&&!snapshot?.device?.outputArmed); + if(el('nativeReturn'))el('nativeReturn').disabled=true; for(const [id,op] of [['addTrack','CREATE_CHANNEL'],['addBus','CREATE_GROUP'],['addFx','CREATE_FX_RETURN'],['clearCue','SET_CUE']]) if(el(id))el(id).disabled=!snapshot?.productionCallbackLive||!opAvailable(op); for(const id of ['saveScene','recallScene','sceneSafe','sofToggle','pluginsButton','group','ungroup','copy','paste','pluginScan','pluginImport','pluginAddPath','routeParallel','routeOnly','wireMaster','wireMode']) @@ -179,6 +185,9 @@ function submitNode(n){ else if(op==='SET_SOURCE')send(op,row,{portId:n.value,sourceFormat:'MONO'}); else if(op==='SET_PROCESSING_FORMAT')send(op,row,{format:row.format==='MONO'?'STEREO':'MONO'}); else if(op==='SET_PRIMARY_OUT')send(op,row,{destinationId:n.value}); + else if(op==='NATIVE_SET_BUS_MIX')send(op,row,{ + gain:Math.pow(10,Math.max(-60,Math.min(10,Number(n.value)))/20), + pan:(Number(row.controls.pan)||0)/100}); else if(op==='SET_FADER')send(op,row,{valueDb:Number(n.value)}); else if(op==='SET_PAN')send(op,row,{value:Number(n.value)}); else if(op==='SET_MUTE'||op==='SET_SOLO')send(op,row,{enabled:!row.controls[op==='SET_MUTE'?'mute':'solo']}); @@ -188,6 +197,7 @@ function submitNode(n){ function accept(s){ if(!s||s.schemaVersion!==6)return; snapshot=s;rows=normalize(s); + const alive=new Set(rows.map(r=>r.id));for(const id of selectedIds)if(!alive.has(id))selectedIds.delete(id); const signature=JSON.stringify([rows.map(r=>[r.id,r.name,r.role,r.format,r.source,r.out,r.controls,r.fx]), s.device?.epoch,s.device?.inputEndpoints,s.legacyM4?.supportedOps,s.legacyM4?.nativeBus?.supportedOps,s.graph?.capabilities?.supportedOps]); if(signature!==lastSignature){lastSignature=signature;render();}else paintMeters(); @@ -215,6 +225,19 @@ document.addEventListener('change',e=>{ if(e.target.id==='densitySelect')document.querySelector('.console-body').dataset.density=e.target.value; }); document.addEventListener('click',e=>{ + const chosen=e.target.closest('[data-select-channel]'); + if(chosen){ + const id=chosen.dataset.selectChannel,row=rowFor(id); + if(row?.role==='INPUT'){ + if(!e.ctrlKey&&!e.shiftKey)selectedIds.clear(); + if(selectedIds.has(id))selectedIds.delete(id);else selectedIds.add(id); + document.querySelectorAll('[data-select-channel]').forEach(x=>{ + x.closest('.strip')?.classList.toggle('selected',selectedIds.has(x.dataset.selectChannel)); + x.setAttribute('aria-pressed',String(selectedIds.has(x.dataset.selectChannel))); + }); + if(el('nativeGroup'))el('nativeGroup').disabled=!(opAvailable('NATIVE_CREATE_GROUP_SELECTED')&&selectedIds.size&&!snapshot?.device?.outputArmed); + } + } const n=e.target.closest('button[data-op]'); if(n)submitNode(n); if(e.target.closest('#bankPrev')){bank=Math.max(0,bank-1);render();} @@ -238,6 +261,13 @@ document.getElementById('nativeOutput')?.addEventListener('click',()=>{ api.emitEvent('arMixAction',args); announce(!armed?'REQUESTING NATIVE OUTPUT ARM':'REQUESTING OUTPUT MUTE'); }); +document.getElementById('nativeGroup')?.addEventListener('click',()=>{ + if(!native||!opAvailable('NATIVE_CREATE_GROUP_SELECTED')||!selectedIds.size)return; + if(snapshot?.device?.outputArmed){announce('MUTE OUTPUT before native Group structure edit',true);return;} + const selected=[...selectedIds].filter(id=>rowFor(id)?.role==='INPUT'); + if(selected.length)send('NATIVE_CREATE_GROUP_SELECTED',{id:'0',legacy:false}, + {name:'Group '+(rows.filter(r=>r.role==='GROUP').length+1),selectedChannelIds:selected,sendGain:.25}); +}); document.getElementById('nativeAddAudio')?.addEventListener('click',()=>{ if(!native)return; const name='Channel '+(rows.length+1),op=opAvailable('CREATE_CHANNEL')? From a9d29aa543219f6f2a67040c16fa5531aff2cc37 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 03:22:13 +0700 Subject: [PATCH 107/155] fix(console): enforce channel-role controls and truthful native BUS port display Only INPUT channels expose physical IN; native MAIN/Group/FX buses show actual accepted routing instead of fake editable hardware pin selections. Do not send legacy ordinal fader operations to native MAIN or FX returns. Name new input strips by input count, not bus count. --- web/console-native.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/web/console-native.js b/web/console-native.js index af0e7b437..1e957c014 100644 --- a/web/console-native.js +++ b/web/console-native.js @@ -79,6 +79,9 @@ function outputOptions(row){ function nativeStrip(r){ const main=r.role==='MAIN',db=gain(r.controls.faderDb),pan=Number(r.controls.pan)||0; const can=op=>opAvailable(op)&&native&& + !((r.role!=='INPUT')&&['SET_SOURCE','NATIVE_PATCH_CHANNEL','SET_PROCESSING_FORMAT'].includes(op))&& + !(r.role==='MAIN'&&['SET_FADER','SET_PAN','SET_MUTE','SET_SOLO'].includes(op))&& + !(r.role==='FX_RETURN'&&['SET_FADER','SET_PAN','SET_MUTE','SET_SOLO'].includes(op))&& !(snapshot?.legacyM4?.nativeBus?.structural&& (op==='SET_PRIMARY_OUT'||op==='SET_PROCESSING_FORMAT')); const act=(op,attrs='')=>' data-op="'+op+'" data-id="'+esc(r.id)+'"'+attrs+ @@ -96,8 +99,14 @@ function nativeStrip(r){ return '
'+ ''+ '
IN / OUT
'+ - '
IN
'+ - '
OUT
'+ + '
IN'+ + (r.role==='INPUT'?'': + ''+(main?'SUM':'BUS RECEIVE')+'')+'
'+ + '
OUT'+ + (r.nativeScoped?''+esc( + snapshot?.legacyM4?.nativeBus?.channels?.find(x=>String(x.id)===r.out)?.name||r.out||'MAIN')+'': + '')+ + '
'+ '
'+fx+ '
'+ '
SEND'+esc((r.sends||[]).length)+' native sends
'+ @@ -270,7 +279,7 @@ document.getElementById('nativeGroup')?.addEventListener('click',()=>{ }); document.getElementById('nativeAddAudio')?.addEventListener('click',()=>{ if(!native)return; - const name='Channel '+(rows.length+1),op=opAvailable('CREATE_CHANNEL')? + const name='Channel '+(rows.filter(r=>r.role==='INPUT').length+1),op=opAvailable('CREATE_CHANNEL')? 'CREATE_CHANNEL':opAvailable('NATIVE_CREATE_CHANNEL')?'NATIVE_CREATE_CHANNEL':null; if(op)send(op,{id:'0',legacy:false},{name,format:'MONO'}); }); From b94c506bd6f0c2e37c707f410c53f0a748076056 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 03:26:30 +0700 Subject: [PATCH 108/155] fix(engine): disambiguate dynamic ChannelEdit from legacy LiveDryRoutingLab edit type MSVC caught unqualified ChannelEdit in new CH11 control-thread admission. Explicit armix::mixer::ChannelEdit + span resolves the actual roster protocol without changing existing M4 ChannelEdit/FX semantics. --- src/LiveDryRoutingLab.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index e20af4e95..ea65c11ee 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1234,20 +1234,20 @@ class LiveDryRoutingLab final { reply.error="NATIVE_MAIN_NOT_FOUND";return reply; } const ChannelId mainId=main->id; - ChannelEdit add; - add.kind=ChannelEdit::Kind::add;add.role=ChannelRole::input; + armix::mixer::ChannelEdit add; + add.kind=armix::mixer::ChannelEdit::Kind::add;add.role=ChannelRole::input; add.format=format;add.text=name; add.position=static_cast(main-existing.begin()); auto created=roster.edit(expectedRosterRevision, - std::span(&add,1)); + std::span(&add,1)); if(!created.ok()||created.createdIds.size()!=1) { reply.error="CHANNEL_ROSTER_ADMISSION_REJECTED";return reply; } - ChannelEdit primary; - primary.kind=ChannelEdit::Kind::setPrimaryOutput; + armix::mixer::ChannelEdit primary; + primary.kind=armix::mixer::ChannelEdit::Kind::setPrimaryOutput; primary.id=created.createdIds.front();primary.target=mainId; const auto connected=roster.edit(roster.revision(), - std::span(&primary,1)); + std::span(&primary,1)); if(!connected.ok()) { reply.error="CHANNEL_MAIN_ROUTING_REJECTED";return reply; } From 2f783cb36428a983342fa7cde5da7355a9eb1370 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 03:36:27 +0700 Subject: [PATCH 109/155] feat(engine): live CH11+ fader/PAN/MUTE/SOLO and native ChannelId transport tests Add bounded native per-input PCM controls for newly created ChannelIds, maintain roster readback, protect M4 ordinal ownership, wire Console controls with current epoch and roster ACK. Extend injected JUCE bridge C++ test double and end-to-end command tests for dynamic channel create, patch, gain and mute/solo. Fix MSVC template instantiation failure caused by new bus ops. --- src/ConsoleLiveBridgeV6.h | 39 ++++++++++++++ src/LiveAudioEngine.h | 16 ++++++ src/LiveDryRoutingLab.h | 34 ++++++++++++- tests/live_channel_fx_graph_test.cpp | 76 ++++++++++++++++++++++++++++ web/console-native.js | 21 ++++++-- 5 files changed, 181 insertions(+), 5 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 9dbd82f67..ed8a10940 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -622,6 +622,45 @@ class LiveConsoleBridgeV6 final { } } } + else if(operation=="NATIVE_SET_CHANNEL_MIX"|| + operation=="NATIVE_SET_CHANNEL_MUTE_SOLO"){ + std::uint64_t id=0; + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),id)||!id) + error="INVALID_DYNAMIC_INPUT_ID"; + else if(operation=="NATIVE_SET_CHANNEL_MIX"){ + const auto g=payload.getProperty("gain",juce::var()); + const auto p=payload.getProperty("pan",juce::var()); + if(!(g.isDouble()||g.isInt())|| + !(p.isDouble()||p.isInt())) + error="INVALID_DYNAMIC_MIX_VALUE"; + else { + const auto gain=static_cast(g); + const auto pan=static_cast(p); + if(!std::isfinite(gain)||gain<0.||gain>4.|| + !std::isfinite(pan)||pan< -1.||pan>1.) + error="INVALID_DYNAMIC_MIX_VALUE"; + else { + applied=engine.setNativeInputMix( + requestedEpoch,nativeRev, + armix::mixer::ChannelId{id}, + static_cast(gain),static_cast(pan)); + if(!applied)error="DYNAMIC_INPUT_MIX_REJECTED"; + } + } + }else{ + const auto m=payload.getProperty("mute",juce::var()); + const auto s=payload.getProperty("solo",juce::var()); + if(!m.isBool()||!s.isBool()) + error="INVALID_DYNAMIC_MUTE_SOLO"; + else { + applied=engine.setNativeInputMuteSolo( + requestedEpoch,nativeRev, + armix::mixer::ChannelId{id}, + static_cast(m),static_cast(s)); + if(!applied)error="DYNAMIC_INPUT_MUTE_SOLO_REJECTED"; + } + } + } else if(operation=="NATIVE_SET_BUS_MIX") { std::uint64_t target=0; const auto rawGain=payload.getProperty("gain",juce::var()); diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 5fe48f008..fd283f31f 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1305,6 +1305,22 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback return dryRoutingLab_.patchNativeInputSource( epoch,pcmRevision,rosterRevision,channel,left,right,stereo,true); } + bool setNativeInputMix(std::uint64_t epoch,std::uint64_t rev, + armix::mixer::ChannelId id,float gain,float pan) noexcept { + if(independent_.active()||!directFence_.permitted()|| + routeReconfiguring_.load(std::memory_order_acquire)|| + diagnosticRoute_.load(std::memory_order_acquire)!= + armix::diagnostics::Route::normal)return false; + return dryRoutingLab_.setNativeInputMix(epoch,rev,id,gain,pan); + } + bool setNativeInputMuteSolo(std::uint64_t epoch,std::uint64_t rev, + armix::mixer::ChannelId id,bool mute,bool solo) noexcept { + if(independent_.active()||!directFence_.permitted()|| + routeReconfiguring_.load(std::memory_order_acquire)|| + diagnosticRoute_.load(std::memory_order_acquire)!= + armix::diagnostics::Route::normal)return false; + return dryRoutingLab_.setNativeInputMuteSolo(epoch,rev,id,mute,solo); + } bool nativeBusTopologyLive() const noexcept { return dryRoutingLab_.nativeBusTopologyLive(); } diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index ea65c11ee..be01c5b32 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1361,6 +1361,36 @@ class LiveDryRoutingLab final { reply.error="NATIVE_SOURCE_PREPARE_FAILED";return reply; } } + // Live dynamic-input controls: one canonical ChannelId PCM callback, + // no M4 ordinal alias, vendor reload or RT thread allocation. + bool setNativeInputMix(std::uint64_t epochValue,std::uint64_t revision, + armix::mixer::ChannelId id,float gain,float pan) noexcept { + if(!nativeStructureLive_||!channelIdPhysicalPcmActive()|| + epochValue!=epoch()||revision!=nativeAccepted_.pcmRevision|| + !std::isfinite(gain)||gain<0.f||gain>4.f|| + !std::isfinite(pan)||pan< -1.f||pan>1.f)return false; + for(const auto original:nativeAccepted_.graph.ids.inputs) + if(original==id)return false; + const auto* channel=nativeAccepted_.graph.roster.find(id); + if(!channel||channel->role!=armix::mixer::ChannelRole::input)return false; + if(!nativePublisher_.setChannelMix(epochValue,revision,id,gain,pan)) + return false; + return nativeAccepted_.graph.roster.rememberLiveMix(id,gain,pan); + } + bool setNativeInputMuteSolo(std::uint64_t epochValue,std::uint64_t revision, + armix::mixer::ChannelId id, + bool mute,bool solo) noexcept { + if(!nativeStructureLive_||!channelIdPhysicalPcmActive()|| + epochValue!=epoch()||revision!=nativeAccepted_.pcmRevision)return false; + for(const auto original:nativeAccepted_.graph.ids.inputs) + if(original==id)return false; + const auto* channel=nativeAccepted_.graph.roster.find(id); + if(!channel||channel->role!=armix::mixer::ChannelRole::input)return false; + if(!nativePublisher_.setChannelMuteSolo( + epochValue,revision,id,mute,solo))return false; + return nativeAccepted_.graph.roster.rememberLiveMuteSolo(id,mute,solo); + } + bool nativeBusTopologyLive() const noexcept { return nativeStructureLive_ && channelIdPhysicalPcmActive(); } @@ -1401,7 +1431,9 @@ class LiveDryRoutingLab final { // can be prepared for its new ChannelId; do not advertise it. for(const char* op: {"NATIVE_CREATE_GROUP_SELECTED", "NATIVE_REMOVE_BUS","NATIVE_SET_BUS_MIX", - "NATIVE_CREATE_CHANNEL","NATIVE_PATCH_CHANNEL"}) + "NATIVE_CREATE_CHANNEL","NATIVE_PATCH_CHANNEL", + "NATIVE_SET_CHANNEL_MIX", + "NATIVE_SET_CHANNEL_MUTE_SOLO"}) allowed.add(juce::var(juce::String(op))); state->setProperty("supportedOps",juce::var(allowed)); juce::Array rows; diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 202512f2c..7a98bb183 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -937,6 +937,35 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { }; int commits=0; int liveMixes=0; + int nativeInputCreates=0,nativeInputPatches=0; + int nativeInputMixes=0,nativeInputToggles=0; + Report createNativeInputChannel(std::uint64_t ep,std::uint64_t pcm, + std::uint64_t roster,const std::string& name, + ProcessingFormat format){ + assert(ep==9007199254740993ULL&&pcm==3&&roster==4); + assert(name=="CH11"&&format==ProcessingFormat::mono); + ++nativeInputCreates; + return {true,{20},4,6,""}; + } + Report patchNativeInputSource(std::uint64_t ep,std::uint64_t pcm, + std::uint64_t roster,ChannelId id,int left,int right,bool stereo){ + assert(ep==9007199254740993ULL&&pcm==3&&roster==4); + assert(id.value==20&&left==2&&right==-1&&!stereo); + ++nativeInputPatches; + return {true,{},4,4,""}; + } + bool setNativeInputMix(std::uint64_t ep,std::uint64_t rev, + ChannelId id,float gain,float pan){ + assert(ep==9007199254740993ULL&&rev==3); + assert(id.value==20&&near(gain,.5f)&&near(pan,0.f)); + ++nativeInputMixes;return true; + } + bool setNativeInputMuteSolo(std::uint64_t ep,std::uint64_t rev, + ChannelId id,bool mute,bool solo){ + assert(ep==9007199254740993ULL&&rev==3); + assert(id.value==20&&mute&&!solo); + ++nativeInputToggles;return true; + } bool setNativeBusMix(std::uint64_t ep,std::uint64_t rev, ChannelId id,float gain,float pan) { assert(ep==9007199254740993ULL&&rev==3); @@ -972,6 +1001,53 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { command->setProperty("payload",juce::var(payload.release())); return juce::var(command.release()); }; + // Real installed bridge functions must compile against mock control writer: + // native ChannelId input creation, physical source patch and bounded + // scalar controls each preserve opaque request IDs and accepted rev. + auto create=makeBusIntent("native:ch11:1"); + create.getDynamicObject()->setProperty("operation","NATIVE_CREATE_CHANNEL"); + auto inputPayload=std::make_unique(); + inputPayload->setProperty("name","CH11"); + inputPayload->setProperty("format","MONO"); + create.getDynamicObject()->setProperty( + "payload",juce::var(inputPayload.release())); + auto inputAck=bridge.processNativeBusIntent(create,snap,busControl); + assert(inputAck.getProperty("status","").toString()=="ACCEPTED"); + assert(inputAck.getProperty("createdChannelId","").toString()=="20"); + assert(busControl.nativeInputCreates==1); + auto patch=makeBusIntent("native:ch11:2"); + patch.getDynamicObject()->setProperty("operation","NATIVE_PATCH_CHANNEL"); + patch.getDynamicObject()->setProperty("targetChannelId","20"); + auto patchPayload=std::make_unique(); + patchPayload->setProperty("physicalLeft",2); + patchPayload->setProperty("physicalRight",-1); + patchPayload->setProperty("sourceFormat","MONO"); + patch.getDynamicObject()->setProperty("payload",juce::var(patchPayload.release())); + inputAck=bridge.processNativeBusIntent(patch,snap,busControl); + assert(inputAck.getProperty("status","").toString()=="ACCEPTED"); + assert(busControl.nativeInputPatches==1); + auto inputMix=makeBusIntent("native:ch11:3"); + inputMix.getDynamicObject()->setProperty("operation","NATIVE_SET_CHANNEL_MIX"); + inputMix.getDynamicObject()->setProperty("targetChannelId","20"); + auto controlPayload=std::make_unique(); + controlPayload->setProperty("gain",.5); + controlPayload->setProperty("pan",0.0); + inputMix.getDynamicObject()->setProperty( + "payload",juce::var(controlPayload.release())); + inputAck=bridge.processNativeBusIntent(inputMix,snap,busControl); + assert(inputAck.getProperty("status","").toString()=="ACCEPTED"); + assert(busControl.nativeInputMixes==1); + auto inputToggle=makeBusIntent("native:ch11:4"); + inputToggle.getDynamicObject()->setProperty( + "operation","NATIVE_SET_CHANNEL_MUTE_SOLO"); + inputToggle.getDynamicObject()->setProperty("targetChannelId","20"); + auto togglePayload=std::make_unique(); + togglePayload->setProperty("mute",true);togglePayload->setProperty("solo",false); + inputToggle.getDynamicObject()->setProperty( + "payload",juce::var(togglePayload.release())); + inputAck=bridge.processNativeBusIntent(inputToggle,snap,busControl); + assert(inputAck.getProperty("status","").toString()=="ACCEPTED"); + assert(busControl.nativeInputToggles==1); auto nativeAck=bridge.processNativeBusIntent( makeBusIntent("native:bus:1"),snap,busControl); assert(nativeAck.getProperty("status","").toString()=="ACCEPTED"); diff --git a/web/console-native.js b/web/console-native.js index 1e957c014..12c959b1d 100644 --- a/web/console-native.js +++ b/web/console-native.js @@ -110,17 +110,17 @@ function nativeStrip(r){ '
'+fx+ '
'+ '
SEND'+esc((r.sends||[]).length)+' native sends
'+ - '
PAN'+Math.round(pan)+'
'+ + '
PAN'+Math.round(pan)+'
'+ '
'+ - ''+ - ''+ + ''+ + ''+ '
'+ '
'+fmt(db)+' dBCLIP
'+ '
'+ (format==='MONO'?'':'
')+ '
'+meterTick+'
'+ '
'+ - '
'+ + '
'+ '
'+gainTick+'
'+ '
'+fmt(db)+'
'+ '
'; @@ -197,6 +197,19 @@ function submitNode(n){ else if(op==='NATIVE_SET_BUS_MIX')send(op,row,{ gain:Math.pow(10,Math.max(-60,Math.min(10,Number(n.value)))/20), pan:(Number(row.controls.pan)||0)/100}); + else if(op==='NATIVE_SET_CHANNEL_MIX'){ + const v=n.dataset.mixField; + const fader=v==='fader'?Number(n.value):Number(row.controls.faderDb); + const pan=v==='pan'?Number(n.value):Number(row.controls.pan); + send(op,row,{gain:Math.pow(10,Math.max(-60,Math.min(10,fader||0))/20), + pan:Math.max(-1,Math.min(1,(pan||0)/100))}); + } + else if(op==='NATIVE_SET_CHANNEL_MUTE_SOLO'){ + const type=n.dataset.toggle; + if(type==='mute'||type==='solo') + send(op,row,{mute:type==='mute'?!row.controls.mute:!!row.controls.mute, + solo:type==='solo'?!row.controls.solo:!!row.controls.solo}); + } else if(op==='SET_FADER')send(op,row,{valueDb:Number(n.value)}); else if(op==='SET_PAN')send(op,row,{value:Number(n.value)}); else if(op==='SET_MUTE'||op==='SET_SOLO')send(op,row,{enabled:!row.controls[op==='SET_MUTE'?'mute':'solo']}); From a679e5a5c9d6beef4c42413004566bb1d9f75724 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:07:48 +0700 Subject: [PATCH 110/155] feat(console): bury retired GUI resources and attest native CH11 Console EXE Compile and serve ONLY the live approved Console HTML/CSS/JS in JUCE BinaryData. Eliminate old fixed-ten HTML/JS/CSS from production PE (keep source/tests for compatibility), fix verified ZIP attestation that incorrectly insisted on embedded retired index.html, rename experimental artifact, and preserve native PCM/ACK/ChannelId contracts and exact SHA. Rebuild strict packaging tests around shipped Console bytes and true hardware FAT qualification. --- CMakeLists.txt | 2 +- scripts/check_console_puzzle.mjs | 8 +- scripts/package_native_windows.ps1 | 15 +- scripts/verify_native_windows_artifact.ps1 | 59 ++--- src/Main.cpp | 27 +- ...ative_artifact_packaging_contract_test.mjs | 234 ++++++------------ 6 files changed, 111 insertions(+), 234 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1686c2623..bc729b04f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ juce_add_gui_app(ARMixConsole NEEDS_CURL FALSE) juce_add_binary_data(ARMixAssets SOURCES - web/index.html web/console-native.html web/console-native.css web/console-native.js web/styles.css web/plugin-ui.css web/app.js web/plugin-ui.js web/bridge.js web/monitor.js web/mixer-io.js web/mixer-io.css web/mixer-layout.js web/mixer-layout.css web/assets/audio-interface.svg) + web/console-native.html web/console-native.css web/console-native.js) target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h src/VstOrbitController.h engine/core/MixerRoutingPlan.h engine/core/ChannelRoutingContract.h engine/core/ChannelSendPlan.h engine/core/AuxBusPlan.h engine/core/PreparedMixerBlock.h engine/core/MasterOutputMonoPolicy.h engine/core/LiveChannelFxGraph.h engine/core/NativeDryRouteCommand.h engine/core/RealtimeRoutePublisher.h engine/device/LiveInputPortRegistry.h src/LiveDryRoutingLab.h engine/core/OrbitPhase.h engine/core/OrbitControlPolicy.h engine/core/OrbitMotion.h engine/core/OrbitDistanceMapping.h engine/core/DearVrPolarPolicy.h src/PluginCatalog.h src/FactoryFxRegistry.h src/PluginVault.h src/PortableWorkspace.h src/StudioBackup.h src/DiagnosticsRecorder.h src/StereoPan.h src/NativePresetArchive.h src/NativeShowSchema.h src/NativeDryShowRecall.h src/VstBusLayout.h src/LiveGraphHandoff.h src/DiagnosticTone.h engine/core/RealtimeHealthHistogram.h engine/core/CallbackCadenceEvidence.h engine/diagnostics/CrackleEvidenceWindow.h engine/device/AdaptiveClockBridge.h engine/device/AudioProfilePolicy.h engine/device/PeriodCapabilityEvidence.h engine/device/SessionLifecycle.h engine/device/WasapiCapabilityProbe.h engine/device/JuceIndependentClockDevice.h engine/device/LiveSecondaryOutputDevice.h engine/core/LiveOutputRouteGate.h engine/core/NativeRenderAuthority.h engine/device/ClockBridgeSizing.h engine/device/IndependentStreamFormatFence.h engine/device/DirectRestoreBackoff.h engine/device/IndependentStreamWatchdog.h engine/device/BridgeContinuityGate.h engine/device/EndpointIdentityPolicy.h engine/device/WasapiEndpointIdentityGuard.h engine/device/AsioStartupPolicy.h engine/device/AsioPriorityDeviceManager.h engine/device/JuceActivePortSnapshot.h engine/device/AsioRegistrationPolicy.h engine/device/AsioRegistryIdentityProbe.h engine/device/DirectRouteFence.h) target_compile_definitions(ARMixConsole PRIVATE diff --git a/scripts/check_console_puzzle.mjs b/scripts/check_console_puzzle.mjs index 12cf08be3..05f93ba9d 100644 --- a/scripts/check_console_puzzle.mjs +++ b/scripts/check_console_puzzle.mjs @@ -59,9 +59,11 @@ const checks=[ /channelPeaksL/.test(data.operatorApp) && !/Math\.sin/.test(data.operatorApp), 'GUI #271: actual native event bus and PCM; no browser animated meters'], - ['JUCE BinaryData embeds release-gated operator HTML and JS', - /web\/console-native\.html\s+web\/console-native\.css\s+web\/console-native\.js/.test(data.cmake), - 'FAT #270: CMake BinaryData must embed audited Console HTML/JS'], + ['JUCE BinaryData embeds ONLY release-gated native Console', + /web\/console-native\.html\s+web\/console-native\.css\s+web\/console-native\.js/.test(data.cmake) && + !/web\/index\.html|web\/app\.js|web\/monitor\.js/.test(data.cmake) && + !/BinaryData::index_html|BinaryData::app_js/.test(data.nativeEntry), + 'FAT #270: bundle approved Console only; bury obsolete ten-strip GUI'], ]; execFileSync(process.execPath,['--test','tests/console_v6_puzzle_seam_test.mjs'],{stdio:'inherit'}); const blockers=checks.filter(x=>!x[1]); diff --git a/scripts/package_native_windows.ps1 b/scripts/package_native_windows.ps1 index 534a6534c..7ec20f6d0 100644 --- a/scripts/package_native_windows.ps1 +++ b/scripts/package_native_windows.ps1 @@ -59,7 +59,7 @@ if ($LASTEXITCODE -ne 0 -or $gitSha -notmatch '^[0-9a-f]{40}$') { throw "Cannot attest packaged source Git commit" } New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null -$exeName = "ArSonMix-GUI10CH-P012-Windows-x64.exe" +$exeName = "ArSonMix-NativeConsole-CH11-EXPERIMENTAL-Windows-x64.exe" $destination = Join-Path $OutputDir $exeName Copy-Item -LiteralPath $app -Destination $destination -Force $readme = "README.md" @@ -78,8 +78,8 @@ $manifest = [ordered]@{ schema = "arsonmix.native-artifact-provenance.v1" sourceCommit = $gitSha gui = "APPROVED SINGLE LIVE CONSOLE · NATIVE SNAPSHOT ONLY · UNIVERSAL FEATURES GATED" - engine = "R0B VERIFIED DIRECT 10CH PLUS FOUR AUX PREPARED NATIVE MIXER__HARDWARE_FAT_UNQUALIFIED" - nativeDSP = "NATIVE_TEN_INPUT_CHANNELS_FOUR_DEDICATED_STEREO_AUX_RETURNS_MASTER__EXPLICIT_PATCH_ACK" + engine = "CHANNELID_CH11_NATIVE_PCM__LEGACY_10CH4AUX_COMPAT__HARDWARE_FAT_UNQUALIFIED" + nativeDSP = "NATIVE_CHANNELID_CH11_DYNAMIC_INPUT__10CH4AUX_COMPAT_FALLBACK__NOT_FULL_UNIVERSAL" storageMode = "PORTABLE_MARKER__USER_STUDIO_EMPTY_AT_RELEASE" guiExeBytes = $appBytes guiExeMinimumBytes = $minimumGuiExeBytes @@ -98,14 +98,9 @@ $manifest = [ordered]@{ consoleNativeCssSha256 = (Get-FileHash -LiteralPath "web/console-native.css" -Algorithm SHA256).Hash.ToLowerInvariant() consoleNativeJsSha256 = (Get-FileHash -LiteralPath "web/console-native.js" -Algorithm SHA256).Hash.ToLowerInvariant() activeGuiEntrypoint = "web/console-native.html__JUCE_BINARYDATA_ROOT" - indexHtmlSha256 = (Get-FileHash -LiteralPath "web/index.html" -Algorithm SHA256).Hash.ToLowerInvariant() - appJsSha256 = (Get-FileHash -LiteralPath "web/app.js" -Algorithm SHA256).Hash.ToLowerInvariant() - stylesCssSha256 = (Get-FileHash -LiteralPath "web/styles.css" -Algorithm SHA256).Hash.ToLowerInvariant() - pluginUiCssSha256 = (Get-FileHash -LiteralPath "web/plugin-ui.css" -Algorithm SHA256).Hash.ToLowerInvariant() - pluginUiJsSha256 = (Get-FileHash -LiteralPath "web/plugin-ui.js" -Algorithm SHA256).Hash.ToLowerInvariant() - bridgeJsSha256 = (Get-FileHash -LiteralPath "web/bridge.js" -Algorithm SHA256).Hash.ToLowerInvariant() - monitorJsSha256 = (Get-FileHash -LiteralPath "web/monitor.js" -Algorithm SHA256).Hash.ToLowerInvariant() guiSource = "web/console-native.html + web/console-native.css + web/console-native.js (JUCE BinaryData)" + nativeConsoleOnly = $true + retiredUiEmbedded = $false guiCalibration = "GAIN_10_TO_MINUS60_BLACK_DETENT_AT_38PX__VU_DBFS_INDEPENDENT_TICKS" fatStatus = "EXPERIMENTAL_NOT_HARDWARE_QUALIFIED" note = "No assertion of clean 0-FX sound, measured round-trip latency or native render-hardware XRUN." diff --git a/scripts/verify_native_windows_artifact.ps1 b/scripts/verify_native_windows_artifact.ps1 index a0733fc47..4d1e267a4 100644 --- a/scripts/verify_native_windows_artifact.ps1 +++ b/scripts/verify_native_windows_artifact.ps1 @@ -7,7 +7,7 @@ Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $expected = @( - "ArSonMix-GUI10CH-P012-Windows-x64.exe", + "ArSonMix-NativeConsole-CH11-EXPERIMENTAL-Windows-x64.exe", "BUILD_PROVENANCE.json", "HARDWARE_FAT_GUIDE.md", "README.md", @@ -35,7 +35,8 @@ if (@(Compare-Object -ReferenceObject $expected -DifferenceObject $actual).Count $manifest = Get-Content -LiteralPath (Join-Path $OutputDir "BUILD_PROVENANCE.json") -Raw -Encoding UTF8 | ConvertFrom-Json # The first truly approved Console runtime must be proven INSIDE the shipped EXE, # not merely shipped alongside an old demo or hidden in unused assets. -if ($manifest.activeGuiEntrypoint -ne "web/console-native.html__JUCE_BINARYDATA_ROOT") { +if ($manifest.activeGuiEntrypoint -ne "web/console-native.html__JUCE_BINARYDATA_ROOT" -or + $manifest.nativeConsoleOnly -ne $true -or $manifest.retiredUiEmbedded -ne $false) { throw "STALE PRODUCT GUI: active WebView2 entrypoint not approved" } $nativeSource = [System.IO.File]::ReadAllText( @@ -50,8 +51,8 @@ if ($manifest.webView2LoaderMode -ne "JUCE_WEBVIEW2_LOADER_STATIC_LINKED_V1" -or $manifest.guiStartupVerification -ne "WEBVIEW2_PREFLIGHT_AND_AR_MIX_GUI_READY_HANDSHAKE") { throw "Missing Windows WebView2 startup / static loader provenance" } -if ($manifest.nativeDSP -ne "NATIVE_TEN_INPUT_CHANNELS_FOUR_DEDICATED_STEREO_AUX_RETURNS_MASTER__EXPLICIT_PATCH_ACK") { - throw "Native mixer routing provenance is not the current 10CH/4AUX production graph" +if ($manifest.nativeDSP -ne "NATIVE_CHANNELID_CH11_DYNAMIC_INPUT__10CH4AUX_COMPAT_FALLBACK__NOT_FULL_UNIVERSAL") { + throw "Native mixer routing provenance is not the admitted ChannelId/compatibility graph" } if ($manifest.storageMode -ne "PORTABLE_MARKER__USER_STUDIO_EMPTY_AT_RELEASE") { throw "Public ZIP missing portable workspace mode provenance" @@ -61,7 +62,7 @@ if ($portableMarker -ne "ARSONMIX_PORTABLE_WORKSPACE_V1") { throw "Invalid porta if (Test-Path -LiteralPath (Join-Path $OutputDir "Studio")) { throw "Public artifact MUST NOT bundle user-specific plugins, presets or sessions" } -$exePath = Join-Path $OutputDir "ArSonMix-GUI10CH-P012-Windows-x64.exe" +$exePath = Join-Path $OutputDir "ArSonMix-NativeConsole-CH11-EXPERIMENTAL-Windows-x64.exe" $bytes = [System.IO.File]::ReadAllBytes((Resolve-Path -LiteralPath $exePath).Path) if ($bytes.Length -lt 4MB) { throw "REJECT: suspiciously small executable ($($bytes.Length) bytes)" } if ($bytes.Length -ne $manifest.guiExeBytes) { throw "Mismatch: actual EXE size and recorded size" } @@ -85,13 +86,7 @@ $resources = @( @{Path="web/console-native.html"; Hash=$manifest.consoleNativeHtmlSha256}, @{Path="web/console-native.css"; Hash=$manifest.consoleNativeCssSha256}, @{Path="web/console-native.js"; Hash=$manifest.consoleNativeJsSha256}, - @{Path="web/index.html"; Hash=$manifest.indexHtmlSha256}, - @{Path="web/app.js"; Hash=$manifest.appJsSha256}, - @{Path="web/styles.css"; Hash=$manifest.stylesCssSha256}, - @{Path="web/plugin-ui.css"; Hash=$manifest.pluginUiCssSha256}, - @{Path="web/plugin-ui.js"; Hash=$manifest.pluginUiJsSha256}, - @{Path="web/bridge.js"; Hash=$manifest.bridgeJsSha256}, - @{Path="web/monitor.js"; Hash=$manifest.monitorJsSha256} + ) $embeddedText = [Text.Encoding]::UTF8.GetString($bytes) foreach ($item in $resources) { @@ -125,29 +120,23 @@ foreach ($marker in @( if ($manifest.guiCalibration -ne "GAIN_10_TO_MINUS60_BLACK_DETENT_AT_38PX__VU_DBFS_INDEPENDENT_TICKS") { throw "GUI calibration release contract is missing" } -# Marker checks below supplement, not replace, full resource byte correspondence. +# Check only the ACTIVE Console and native audio/ACK controls. Old UI +# marker strings MUST NOT be required or reintroduced as bundled resources. foreach ($marker in @( - "function openChannelIdentity", # latest mixer channel editor - 'class="master-analysis"', # native-compatible master analyzer - "--ari-master-cap", # rose/silver MASTER styling - "gain-scale-travel", # calibrated +10..-60 dB scale - "vu-scale-travel", # independent dBFS meter ruler - "meter-signal-area", # VU activity region distinct from CLIP LED - "fader-travel", # PNG black detent in 38px inset travel - "function syncNativeMixerControls", # JUCE WebView bridge - "arMixGuiReady", # Native GUI JS ready handshake - "WEBVIEW2_GUI_READY_TIMEOUT", # Visible failure, never a blank IE page - "AUDIO_GLITCH_WINDOW", # engine P0-12 compiled diagnostics - "--b180-on-mute", # current harmonized BTN-180 palette - "--b180-on-solo", # MUTE / SOLO lightness calibration - "--b180-on-stereo", # STEREO blue lightness calibration - "--b180-on-green", # native device-connected green - "inset 5px 5px 2px -1px", # owner-approved hardware button shadow - "gain-scale-travel", # calibrated fader detent - "function syncNativeMixerControls" # latest native GUI state bridge + "arMixGuiReady", + "arMixConsoleSubscribe", + "arMixConsoleIntent", + "arMixConsoleSnapshot", + "arMixConsoleAck", + "nativeAddAudio", + "NATIVE_PATCH_CHANNEL", + "NATIVE_SET_CHANNEL_MIX", + "NATIVE_SET_CHANNEL_MUTE_SOLO", + "WEBVIEW2_GUI_READY_TIMEOUT", + "AUDIO_GLITCH_WINDOW" )) { - if ($embeddedText.IndexOf($marker, [StringComparison]::Ordinal) -lt 0) { - throw "Compiled GUI/engine marker absent from shipped EXE: $marker" + if ($embeddedText.IndexOf($marker,[StringComparison]::Ordinal) -lt 0) { + throw "NATIVE CONSOLE CONTRACT missing from shipped EXE: $marker" } } @@ -183,7 +172,7 @@ try { if (@(Compare-Object -ReferenceObject $expectedZipFiles -DifferenceObject $names).Count -ne 0) { throw "ZIP does not contain exactly the verified distribution files" } - $entry = $zip.GetEntry("ArSonMix-GUI10CH-P012-Windows-x64.exe") + $entry = $zip.GetEntry("ArSonMix-NativeConsole-CH11-EXPERIMENTAL-Windows-x64.exe") if ($null -eq $entry -or $entry.Length -ne $bytes.Length) { throw "Wrong/truncated GUI executable inside ZIP" } @@ -215,7 +204,7 @@ try { } Write-Host "FAT_RELEASE_ACCEPTED: source=$sha GUI_WIN64_PE32+=2" Write-Host "FAT_RELEASE_ACCEPTED: exeBytes=$($bytes.Length) testZipBytes=$archiveBytes sha256=$appHash" - Write-Host "FAT_RELEASE_ACCEPTED: full embedded GUI HTML/CSS/JS/bridge/monitor + calibrated VU/fader matched exactly" + Write-Host "FAT_RELEASE_ACCEPTED: only Console HTML/CSS/JS embedded; legacy GUI excluded" Write-Host "FAT_RELEASE_ACCEPTED: P0-12 and static WebView2 startup contract verified" } finally { if (Test-Path -LiteralPath $archivePath) { Remove-Item -LiteralPath $archivePath -Force } diff --git a/src/Main.cpp b/src/Main.cpp index 0c18647f5..9429d1f0a 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -54,32 +54,7 @@ std::optional assetFor (const juce::String& { data = BinaryData::consolenative_css; size = BinaryData::consolenative_cssSize; mime = "text/css"; } else if (path == "/console-native.js") { data = BinaryData::consolenative_js; size = BinaryData::consolenative_jsSize; mime = "text/javascript"; } - else if (path == "/styles.css") - { data = BinaryData::styles_css; size = BinaryData::styles_cssSize; mime = "text/css"; } - else if (path == "/app.js") - { data = BinaryData::app_js; size = BinaryData::app_jsSize; mime = "text/javascript"; } - // JUCE 8.0.15 BinaryData strips hyphens from generated identifiers: - // "plugin-ui.js" -> pluginui_js, "plugin-ui.css" -> pluginui_css. - // Asset HTTP paths retain their hyphenated original names. - // JUCE BinaryData strips dashes from the source filename: plugin-ui.js -> pluginui_js. - else if (path == "/plugin-ui.js") - { data = BinaryData::pluginui_js; size = BinaryData::pluginui_jsSize; mime = "text/javascript"; } - else if (path == "/plugin-ui.css") - { data = BinaryData::pluginui_css; size = BinaryData::pluginui_cssSize; mime = "text/css"; } - else if (path == "/bridge.js") - { data = BinaryData::bridge_js; size = BinaryData::bridge_jsSize; mime = "text/javascript"; } - else if (path == "/monitor.js") - { data = BinaryData::monitor_js; size = BinaryData::monitor_jsSize; mime = "text/javascript"; } - else if (path == "/mixer-io.js") - { data = BinaryData::mixerio_js; size = BinaryData::mixerio_jsSize; mime = "text/javascript"; } - else if (path == "/mixer-io.css") - { data = BinaryData::mixerio_css; size = BinaryData::mixerio_cssSize; mime = "text/css"; } - else if (path == "/assets/audio-interface.svg") - { data = BinaryData::audiointerface_svg; size = BinaryData::audiointerface_svgSize; mime = "image/svg+xml"; } - else if (path == "/mixer-layout.js") - { data = BinaryData::mixerlayout_js; size = BinaryData::mixerlayout_jsSize; mime = "text/javascript"; } - else if (path == "/mixer-layout.css") - { data = BinaryData::mixerlayout_css; size = BinaryData::mixerlayout_cssSize; mime = "text/css"; } + // No archived ten-strip UI resource can be served by the production WebView2. else return std::nullopt; juce::WebBrowserComponent::Resource resource; diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index 0f477635e..4cd39d235 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -1,174 +1,90 @@ // SPDX-License-Identifier: AGPL-3.0-only -// Prevent packaging a native test executable as the GUI application again. -// Exact PE and source SHA verification happens at package time on Windows. +// The release artefact MUST be the exact native Console, never the retired fixed-ten HTML. import test from 'node:test'; import assert from 'node:assert/strict'; import {readFileSync} from 'node:fs'; -const read = path => readFileSync(path, 'utf8'); -const workflow = read('.github/workflows/p1-windows.yml'); -const packaging = read('scripts/package_native_windows.ps1'); -const verify = read('scripts/verify_native_windows_artifact.ps1'); -const nativeMain = read('src/Main.cpp'); -const cmake = read('CMakeLists.txt'); -const fat = read('docs/HARDWARE_FAT_GUI10_ENGINE_P012_20261027.md'); +const read=p=>readFileSync(p,'utf8'); +const cmake=read('CMakeLists.txt'); +const main=read('src/Main.cpp'); +const packageScript=read('scripts/package_native_windows.ps1'); +const verify=read('scripts/verify_native_windows_artifact.ps1'); +const workflow=read('.github/workflows/p1-windows.yml'); +const consoleHtml=read('web/console-native.html'); +const consoleJs=read('web/console-native.js'); +const name='ArSonMix-NativeConsole-CH11-EXPERIMENTAL-Windows-x64.exe'; -test('native FAT artifact picks an EXACT JUCE GUI target path, never wildcard test EXEs', () => { - assert.match(cmake, /juce_add_gui_app\(ARMixConsole/); - assert.match(cmake, /PRODUCT_NAME "AR MIX Studio"/); - assert.match(packaging, /ARMixConsole_artefacts\/Release\/AR MIX Studio\.exe/); - assert.match(packaging, /Missing JUCE GUI executable at expected target/); - assert.doesNotMatch(workflow, /Get-ChildItem -Path build -Filter/); - assert.doesNotMatch(workflow, /Select-Object -First 1/); - assert.match(workflow, /scripts\/package_native_windows\.ps1/); +test('only the approved Console resources are compiled/served by JUCE',()=>{ + assert.match(cmake,/juce_add_gui_app\(ARMixConsole/); + assert.match(cmake,/web\/console-native\.html web\/console-native\.css web\/console-native\.js/); + assert.doesNotMatch(cmake,/web\/index\.html|web\/app\.js|web\/monitor\.js/); + assert.match(main,/BinaryData::consolenative_html/); + assert.match(main,/BinaryData::consolenative_css/); + assert.match(main,/BinaryData::consolenative_js/); + assert.doesNotMatch(main,/BinaryData::index_html|BinaryData::app_js|BinaryData::monitor_js/); + assert.match(main,/withResourceProvider \(assetFor\)/); + assert.match(consoleHtml,/ArSonMix — Native Live Console/); + assert.doesNotMatch(consoleHtml,/data-view="FX RACK"/); + assert.doesNotMatch(consoleJs,/\bconst\s+channels\s*=\s*raw\.map/); }); -test('native FAT artifact proves AMD64 PE32+ WINDOWS GUI, rejects console-subsystem tests', () => { - assert.match(packaging, /0x8664/); - assert.match(packaging, /0x020b/); - assert.match(packaging, /\$subsystem -ne 2/); - assert.match(packaging, /a test console EXE is NOT the app/); - assert.match(packaging, /exeSha256/); - assert.match(packaging, /sourceCommit/); - assert.match(packaging, /appJsSha256/); - assert.match(packaging, /stylesCssSha256/); - assert.match(packaging, /BUILD_PROVENANCE\.json/); - assert.match(packaging, /HARDWARE_FAT_GUIDE\.md/); - assert.match(packaging, /EXPERIMENTAL_NOT_HARDWARE_QUALIFIED/); +test('actual single Console uses native snapshot ACK, real PCM and dynamic ChannelId',()=>{ + for(const value of ['arMixConsoleSubscribe','arMixConsoleIntent','arMixConsoleSnapshot','arMixConsoleAck','channelPeaksL','nativeAddAudio','NATIVE_PATCH_CHANNEL','NATIVE_SET_CHANNEL_MIX','NATIVE_SET_CHANNEL_MUTE_SOLO']) { + assert.ok(consoleJs.includes(value)||consoleHtml.includes(value),'missing native operator flow '+value); + } + assert.match(consoleJs,/graph\?\.channels|graph\.channels/); + assert.doesNotMatch(consoleJs,/Math\.sin\(/); }); -test('production Windows workflow rejects a tiny 648KB zip, test EXE, or missing GUI/engine runtime data', () => { - assert.match(packaging, /minimumGuiExeBytes = 4MB/); - assert.match(verify, /\$bytes\.Length -lt 4MB/); - assert.match(verify, /\$archiveBytes -lt 2MB/); - assert.match(verify, /Compress-Archive/); - assert.match(verify, /ZipFile\]::OpenRead/); - assert.match(verify, /ComputeHash\(\$stream\)/); - assert.match(verify, /manifest\.sourceCommit/); - assert.match(verify, /manifest\.appJsSha256/); - assert.match(verify, /manifest\.stylesCssSha256/); - for (const marker of [ - 'function openChannelIdentity', - 'class="master-analysis"', - '--ari-master-cap', - 'function syncNativeMixerControls', - 'AUDIO_GLITCH_WINDOW', - ]) { - assert.ok(verify.includes(marker), 'release audit must search compiled artifact for '+marker); - } - assert.match(nativeMain, /BinaryData::app_js/); - assert.match(nativeMain, /BinaryData::styles_css/); - assert.match(nativeMain, /withResourceProvider \(assetFor\)/); - assert.match(workflow, /Independently verify release ZIP and embedded GUI\/engine before upload/); - assert.match(workflow, /scripts\/verify_native_windows_artifact\.ps1/); - assert.ok(workflow.indexOf('scripts/verify_native_windows_artifact.ps1') < - workflow.indexOf('uses: actions/upload-artifact@v4')); +test('package is a real PE32+ x64 GUI, not a console test binary or old 10CH artifact',()=>{ + assert.match(cmake,/PRODUCT_NAME "AR MIX Studio"/); + assert.match(packageScript,/ARMixConsole_artefacts\/Release\/AR MIX Studio\.exe/); + for(const marker of ['0x8664','0x020b','minimumGuiExeBytes = 4MB','$subsystem -ne 2','exeSha256','sourceCommit','EXPERIMENTAL_NOT_HARDWARE_QUALIFIED','BUILD_PROVENANCE.json','HARDWARE_FAT_GUIDE.md']) + assert.ok(packageScript.includes(marker),'package field missing '+marker); + assert.ok(packageScript.includes(name)&&verify.includes(name)); + assert.ok(!packageScript.includes('ArSonMix-GUI10CH-P012-Windows-x64.exe')); + assert.match(packageScript,/nativeConsoleOnly = \$true/); + assert.match(packageScript,/retiredUiEmbedded = \$false/); + assert.match(verify,/manifest\.nativeConsoleOnly/); + assert.match(verify,/manifest\.retiredUiEmbedded/); + assert.match(packageScript,/NATIVE_CHANNELID_CH11_DYNAMIC_INPUT__10CH4AUX_COMPAT_FALLBACK__NOT_FULL_UNIVERSAL/); + assert.match(verify,/NATIVE_CHANNELID_CH11_DYNAMIC_INPUT__10CH4AUX_COMPAT_FALLBACK__NOT_FULL_UNIVERSAL/); }); -test('physical hardware FAT documents verified 10CH and dedicated 4 AUX native mixer without claiming hardware qualification', () => { - // Published provenance must reflect the REAL post-B3 native engine, - // while keeping hardware 0-FX crackle FAT explicitly unqualified. - assert.match(packaging,/NATIVE_TEN_INPUT_CHANNELS_FOUR_DEDICATED_STEREO_AUX_RETURNS_MASTER__EXPLICIT_PATCH_ACK/); - assert.match(packaging,/HARDWARE_FAT_UNQUALIFIED/); - assert.match(verify,/NATIVE_TEN_INPUT_CHANNELS_FOUR_DEDICATED_STEREO_AUX_RETURNS_MASTER__EXPLICIT_PATCH_ACK/); - assert.doesNotMatch(verify,/NATIVE_10CH_4AUX__EXPLICIT_PHYSICAL_INPUT_PATCH__MAIN_LR_OUTPUT_ONLY/); - assert.doesNotMatch(packaging,/CHANNEL_1_ONLY__REMAINING_9_GUI_CHANNELS_NOT_REAL_AUDIO/); - assert.match(fat, /native 10CH \+ 4 AUX/i); - assert.match(fat, /UNPATCHED \/ SILENT/i); - assert.match(fat, /APPLY ROUTING/); - assert.match(fat, /CLEAR PATCH/); - assert.match(fat, /Experimental; not yet qualified for professional live audio/i); - assert.match(fat, /OUTPUT_ONLY_TONE/); - assert.match(fat, /CAPTURE_ONLY/); - assert.match(fat, /DRY_THROUGH/); - assert.match(fat, /44,100 Hz/); - assert.match(fat, /48,000 Hz/); - assert.match(fat, /RENDER_HARDWARE_XRUN=UNAVAILABLE_THROUGH_JUCE/); +test('release verifier hashes ALL active GUI bytes inside actual EXE and ZIP',()=>{ + for(const f of ['consoleNativeHtmlSha256','consoleNativeCssSha256','consoleNativeJsSha256','activeGuiEntrypoint']) { + assert.ok(packageScript.includes(f+' = ')); + assert.ok(verify.includes('manifest.'+f)); + } + for(const file of ['web/console-native.html','web/console-native.css','web/console-native.js']) + assert.ok(verify.includes('Path="'+file+'"')); + for(const old of ['Path="web/index.html"','Path="web/app.js"','Path="web/monitor.js"']) + assert.ok(!verify.includes(old),'retired asset still required in distribution '+old); + for(const marker of ['STALE NATIVE GUI: exact JUCE BinaryData resource absent from EXE','IndexOf($sourceText, [StringComparison]::Ordinal)','ZipFile]::OpenRead','ComputeHash($stream)','manifest.sourceCommit','manifest.exeSha256','WEBVIEW2_GUI_READY_TIMEOUT','AUDIO_GLITCH_WINDOW']) + assert.ok(verify.includes(marker),'archive or binary attestation missing: '+marker); + assert.match(verify,/\$bytes\.Length -lt 4MB/); + assert.match(verify,/\$archiveBytes -lt 2MB/); + assert.match(verify,/Get-FileHash/); }); - -test('release proves exact calibrated GUI bytes are embedded in the executable, not just copied beside it', () => { - for (const field of ['consoleNativeHtmlSha256','consoleNativeCssSha256','consoleNativeJsSha256','activeGuiEntrypoint','indexHtmlSha256','appJsSha256','stylesCssSha256','pluginUiCssSha256','pluginUiJsSha256','bridgeJsSha256','monitorJsSha256','guiCalibration']) { - assert.ok(packaging.includes(field+' = '), 'provenance missing '+field); - assert.ok(verify.includes('manifest.'+field), 'verifier missing '+field); - } - for (const file of ['web/console-native.html','web/console-native.css','web/console-native.js','web/index.html','web/app.js','web/styles.css','web/plugin-ui.css','web/plugin-ui.js','web/bridge.js','web/monitor.js']) { - assert.ok(verify.includes('Path="'+file+'"'), 'native resource not checked: '+file); - } - assert.match(verify,/IndexOf\(\$sourceText, \[StringComparison\]::Ordinal\)/); - assert.match(verify,/STALE NATIVE GUI: exact JUCE BinaryData resource absent from EXE/); - assert.match(verify,/STALE PRODUCT GUI: active WebView2 entrypoint not approved/); - assert.match(verify,/STALE PRODUCT GUI: native Console runtime marker absent from EXE/); - for (const marker of ['gain-scale-travel','vu-scale-travel','meter-signal-area','fader-travel']) { - assert.ok(verify.includes('"'+marker+'"'), 'calibration marker absent: '+marker); - } - assert.match(packaging,/GAIN_10_TO_MINUS60_BLACK_DETENT_AT_38PX__VU_DBFS_INDEPENDENT_TICKS/); -}); - -test('latest BTN-180 GUI palette is an attested embedded native release requirement', () => { - const current=read('web/styles-src/20-button-180.css'); - const integrated=read('web/styles.css'); - for(const token of ['--b180-on-mute','--b180-on-solo','--b180-on-stereo','--b180-on-green']) { - assert.ok(current.includes(token) && integrated.includes(token),token); - assert.ok(verify.includes('"'+token+'"'), 'native verified executable missing acceptance marker '+token); - } - assert.match(verify,/inset 5px 5px 2px -1px/); - assert.match(cmake,/web\/index\.html web\/console-native\.html web\/console-native\.css web\/console-native\.js/); - assert.match(cmake,/web\/app\.js web\/plugin-ui\.js web\/bridge\.js web\/monitor\.js/); - assert.match(nativeMain,/BinaryData::consolenative_html/); - assert.doesNotMatch(nativeMain,/BinaryData::index_html/); - assert.match(nativeMain,/BinaryData::bridge_js/); - assert.match(nativeMain,/BinaryData::pluginui_js/); - assert.match(nativeMain,/BinaryData::pluginui_css/); -}); - -test('native startup requires static WebView2 loader and JS-backed UI readiness', () => { - const monitor=read('web/monitor.js'); - assert.match(cmake,/JUCE_USE_WIN_WEBVIEW2_WITH_STATIC_LINKING=1/); - assert.match(cmake,/NEEDS_WEBVIEW2 TRUE/); - assert.match(nativeMain,/WebBrowserComponent::areOptionsSupported \(webViewOptions\(\)\)/); - assert.match(nativeMain,/WEBVIEW2_GUI_READY_TIMEOUT/); - assert.match(nativeMain,/withEventListener \("arMixGuiReady"/); - assert.doesNotMatch(nativeMain,/pageFinishedLoading \(const juce::String&\) override \{ loaded = true; \}/); - assert.match(monitor,/api\.emitEvent\("arMixGuiReady"/); - assert.match(packaging,/webView2LoaderMode = "JUCE_WEBVIEW2_LOADER_STATIC_LINKED_V1"/); - assert.match(verify,/manifest\.webView2LoaderMode/); - assert.match(verify,/WEBVIEW2_GUI_READY_TIMEOUT/); - assert.match(fat,/Microsoft Edge WebView2 Runtime/); +test('native startup uses WebView2 readiness and producer-owned output controls',()=>{ + assert.match(cmake,/NEEDS_WEBVIEW2 TRUE/); + assert.match(cmake,/JUCE_USE_WIN_WEBVIEW2_WITH_STATIC_LINKING=1/); + assert.match(main,/WebBrowserComponent::areOptionsSupported \(webViewOptions\(\)\)/); + assert.match(main,/withEventListener \("arMixGuiReady"/); + assert.match(main,/WEBVIEW2_GUI_READY_TIMEOUT/); + assert.match(consoleJs,/api\.emitEvent\('arMixGuiReady'/); }); - -test('FAT ZIP uses current single-APPLY physical first-sound guide',()=>{ - const quick=read('docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md'); - assert.match(packaging,/FIRST_SOUND_FAT_QUICKSTART_20261101\.md/); - for(const entry of ['10 input channels + 4 AUX','OUTPUT_ONLY_TONE','CAPTURE_ONLY','COPY FULL REPORT','30 minutes','no separate manual START AUDIO']) - assert.ok(quick.includes(entry),entry); -}); - -test('retired 10CH UI cannot upload until a joined approved native Console exists',()=>{ - const gate=read('scripts/check_console_puzzle.mjs'); - const native=read('src/Main.cpp'); - const gui=read('web/console-native.js'); - const html=read('web/console-native.html'); - assert.match(gate,/GUI retired ten-strip demo removed/); - assert.match(gate,/GUI approved single Console is packaged/); - assert.match(gate,/GUI direct universal channel operation/); - assert.match(gate,/data\.operatorHtml/); - assert.match(gate,/CREATE_CHANNEL/); - assert.match(native,/BinaryData::consolenative_html/); - assert.match(gui,/arMixConsoleSubscribe/); - assert.match(gui,/arMixConsoleAck/); - assert.match(gui,/channelPeaksL/); - assert.match(html,/ArSonMix — Native Live Console/); - assert.doesNotMatch(html,/data-view="FX RACK"/); - assert.match(workflow,/github\.event_name != 'pull_request' \|\| startsWith\(github\.head_ref, 'integration\/product-'\)/); +test('CI validates exact HEAD before upload and cannot ship ENGINE-only old GUI',()=>{ + assert.match(workflow,/ref: \$\{\{ github\.event_name == 'pull_request' && github\.event\.pull_request\.head\.sha \|\| github\.sha \}\}/); + assert.match(workflow,/ENGINE_EXACT_SOURCE_SHA_VERIFIED/); + assert.match(workflow,/ctest --test-dir build -C Release --output-on-failure/); + assert.match(workflow,/scripts\/package_native_windows\.ps1/); + assert.match(workflow,/scripts\/verify_native_windows_artifact\.ps1/); const upload=workflow.split('uses: actions/upload-artifact@v4')[1]||''; - assert.ok(upload.includes("github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')")); + assert.ok(upload.includes("startsWith(github.head_ref, 'integration/product-')")); assert.ok(!upload.includes('milestone/m5-universal-channelid-vst3-lease-migration-20261101')); - assert.ok(!upload.includes('ArSonMix-ENGINE-10CH4AUX-EXPERIMENTAL-Hardware-FAT-Windows-x64')); - assert.match(upload,/if-no-files-found: error/); - assert.ok(workflow.indexOf('ctest --test-dir build -C Release --output-on-failure'){ - const shaRef="ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"; - assert.ok(workflow.includes(shaRef)); - assert.match(workflow,/ENGINE SOURCE SHA MISMATCH/); - assert.match(packaging,/\$gitSha = \(\& git rev-parse HEAD\)\.Trim\(\)/); - assert.match(verify,/manifest\.sourceCommit/); +test('physical crackle remains unqualified until independent 0FX/1FX FAT',()=>{ + const guide=read('docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md'); + for(const marker of ['OUTPUT_ONLY_TONE','CAPTURE_ONLY','DRY_THROUGH_0FX','30 minutes','44,100','48,000']) + assert.ok(guide.includes(marker),'hardware FAT guide missing '+marker); + assert.match(packageScript,/HARDWARE_FAT_UNQUALIFIED/); + assert.match(packageScript,/EXPERIMENTAL_NOT_HARDWARE_QUALIFIED/); }); From d2b00f8de73919ed55e3decb70366a769abefc7b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:08:56 +0700 Subject: [PATCH 111/155] test(gui): separate archived IO matrix regression from shipped Console assets Preserve and test historical expert I/O editor code as source but assert it is NOT compiled/served by Windows JUCE, which now owns only the real Console. Keep physical device inventory and patch asset regressions. --- tests/mixer_io_operator_contract_test.mjs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/mixer_io_operator_contract_test.mjs b/tests/mixer_io_operator_contract_test.mjs index f019319ad..7f49e37ad 100644 --- a/tests/mixer_io_operator_contract_test.mjs +++ b/tests/mixer_io_operator_contract_test.mjs @@ -33,15 +33,17 @@ test('MS3A MAIN physical output patch stages through existing muted native route assert.match(monitor,/routingDryApply/); assert.doesNotMatch(gui,/audioSelectDevice|setCurrentAudioDeviceType/); }); -test('native device inventory and packaged WebView2 assets are wired',()=>{ +test('archived IO expert editor retains source fixtures, while the approved Console alone is shipped',()=>{ assert.match(main,/action == "audioDeviceInventory"/); assert.match(main,/getAvailableDeviceTypes\(\)/); assert.match(main,/arMixAudioDeviceInventory/); for(const f of ['mixer-io.js','mixer-io.css']){ - assert.ok(html.includes(f)); - assert.ok(cmake.includes('web/'+f)); - assert.ok(main.includes('/'+f)); + assert.ok(html.includes(f), 'archival expert editor source still intact '+f); + assert.ok(!cmake.includes('web/'+f), 'abandoned UI must not be compiled into product '+f); + assert.ok(!main.includes('BinaryData::mixerio_'), 'abandoned UI cannot be served'); } + assert.match(cmake,/web\/console-native\.html web\/console-native\.css web\/console-native\.js/); + assert.match(main,/BinaryData::consolenative_html/); }); test('G3 inline AUX sends mutate only one native routing draft with bounded PRE/POST semantics',()=>{ @@ -156,8 +158,8 @@ test('IO-MATRIX uses only verified pins, dual-step stereo draft and native ACK w assert.match(gui,/\.dataset\.ioRowMode/); assert.match(css,/\.arIOMatrixCell\[data-assigned="true"\]/); assert.doesNotMatch(css,/backdrop-filter\s*:|filter\s*:\s*blur/); - assert.match(main,/assets\/audio-interface\.svg/); - assert.match(cmake,/web\/assets\/audio-interface\.svg/); + assert.ok(read('web/assets/audio-interface.svg').includes('{ From 755fd9f3d8254a3d417bbb9de6ec532173ef2fa3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:10:24 +0700 Subject: [PATCH 112/155] test: retire only obsolete WebView asset packaging contracts Retain detailed source-level tests for archived mixer shell and plugin picker, but assert neither is linked into the native executable. Production JUCE binary has exactly approved console-native HTML/CSS/JS; no alternate retired frontend. --- tests/mixer_shell_contract_test.mjs | 9 +++++---- tests/plugin_ui_contract_test.mjs | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/mixer_shell_contract_test.mjs b/tests/mixer_shell_contract_test.mjs index b0eed7c43..fa09776db 100644 --- a/tests/mixer_shell_contract_test.mjs +++ b/tests/mixer_shell_contract_test.mjs @@ -16,14 +16,15 @@ test('mixer shell is a presentation module, not a second audio engine',()=>{ assert.doesNotMatch(css,/\[data-io-mode="(?:ROUTE|SENDS)"\]\{--ar-upper-height:/); assert.doesNotMatch(script,/routingDryApply|createPluginInstance|AudioContext|processBlock|setInterval|requestAnimationFrame/); }); -test('new shell resources are in the exact native WebView2 asset list',()=>{ +test('retired shell keeps its source regression but cannot be served by native Console',()=>{ const cmake=read('CMakeLists.txt'),main=read('src/Main.cpp'),html=read('web/index.html'); for(const name of ['mixer-layout.js','mixer-layout.css']){ - assert.ok(cmake.includes('web/'+name),name+' not packaged'); - assert.ok(main.includes('"/'+name+'"'),name+' not served'); - assert.ok(html.includes(name),name+' not referenced'); + assert.ok(html.includes(name),name+' archival layout missing'); + assert.ok(!cmake.includes('web/'+name),name+' incorrectly bundled in product'); + assert.ok(!main.includes('"/'+name+'"'),name+' legacy GUI still served'); } assert.ok(html.indexOf('mixer-io.js'){ diff --git a/tests/plugin_ui_contract_test.mjs b/tests/plugin_ui_contract_test.mjs index bd5391df3..d26646658 100644 --- a/tests/plugin_ui_contract_test.mjs +++ b/tests/plugin_ui_contract_test.mjs @@ -90,12 +90,13 @@ test('Windows Explorer pickers are separate, SafePointer guarded and have explic assert.ok(native.includes('action == "'+action+'"')); }); -test('asset registration and no blur/focus thrash in native plugin UI',()=>{ +test('archived plugin picker source stays covered but cannot silently replace Console UI',()=>{ for(const f of ['plugin-ui.js','plugin-ui.css']){ assert.ok(index.includes(f)); - assert.ok(cmake.includes('web/'+f)); - assert.ok(native.includes('"/'+f+'"')); + assert.ok(!cmake.includes('web/'+f)); + assert.ok(!native.includes('"/'+f+'"')); } + assert.match(cmake,/web\/console-native\.html web\/console-native\.css web\/console-native\.js/); assert.ok(bridge.includes('pluginUi.updatePickerRows(')); assert.ok(bridge.includes('renderPickerResults(); // Preserve search input, caret, focus')); assert.ok(bridge.includes('iconSvg("close")')); From da9e7e329550744bb11d9893d95a55154bc22c40 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:13:09 +0700 Subject: [PATCH 113/155] test(console): remove obsolete embedded GUI assumptions in native release suite Keep archived UI and standalone visual calibration regression untouched, but assert exact three-file native Console-only BinaryData. Preserve physical #15 0FX/1FX evidence checks using terminology present in FAT guide. --- ...ative_artifact_packaging_contract_test.mjs | 2 +- tests/reconciled_gui_engine_contract_test.mjs | 52 ++++++++----------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index 4cd39d235..621e0586a 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -83,7 +83,7 @@ test('CI validates exact HEAD before upload and cannot ship ENGINE-only old GUI' }); test('physical crackle remains unqualified until independent 0FX/1FX FAT',()=>{ const guide=read('docs/FIRST_SOUND_FAT_QUICKSTART_20261101.md'); - for(const marker of ['OUTPUT_ONLY_TONE','CAPTURE_ONLY','DRY_THROUGH_0FX','30 minutes','44,100','48,000']) + for(const marker of ['OUTPUT_ONLY_TONE','CAPTURE_ONLY','0FX normal','30 minutes','44,100','48,000']) assert.ok(guide.includes(marker),'hardware FAT guide missing '+marker); assert.match(packageScript,/HARDWARE_FAT_UNQUALIFIED/); assert.match(packageScript,/EXPERIMENTAL_NOT_HARDWARE_QUALIFIED/); diff --git a/tests/reconciled_gui_engine_contract_test.mjs b/tests/reconciled_gui_engine_contract_test.mjs index 4919bf9a4..5ad0b49e8 100644 --- a/tests/reconciled_gui_engine_contract_test.mjs +++ b/tests/reconciled_gui_engine_contract_test.mjs @@ -45,33 +45,27 @@ test('full engine capabilities preserved',()=>{ assert.match(bridge,/arMixNativePresetLoaded/); }); -test('JUCE native resources track the approved calibrated GUI without maintaining a second mixer implementation', () => { - const cmake=read('CMakeLists.txt'); - const cpp=read('src/Main.cpp'); - const sourceCss=read('web/styles-src/42-mixer-premium.css'); - const standalone=read('AR-MIX-Live-FX-Host-Standalone-v0.3.html'); - // Legacy migration assets remain embedded for history; live root MUST use approved Console. - const assetList=cmake.match(/juce_add_binary_data\(ARMixAssets SOURCES\s+([^)]+)\)/)?.[1]; - assert.ok(assetList,'native WebView2 source list missing'); - const expected=['web/index.html','web/styles.css','web/plugin-ui.css','web/app.js', - 'web/plugin-ui.js','web/bridge.js','web/monitor.js','web/mixer-io.js','web/mixer-io.css']; - const listed=assetList.trim().split(/\s+/); - for(const asset of expected) assert.ok(listed.includes(asset),'missing WebView2 asset '+asset); - assert.equal(new Set(listed).size,listed.length,'duplicate native WebView2 resource'); - for(const path of ['web/console-native.html','web/console-native.css','web/console-native.js']) - assert.ok(listed.includes(path),'approved native Console not embedded: '+path); - assert.match(cpp,/path == "\/" \|\| path == "\/index.html"/); - assert.match(cpp,/data = BinaryData::consolenative_html/); - assert.doesNotMatch(cpp,/data = BinaryData::index_html/); - for (const resource of ['consolenative_html','consolenative_css','consolenative_js','styles_css','pluginui_css','app_js','pluginui_js','bridge_js','monitor_js']) { - assert.ok(cpp.includes('BinaryData::'+resource),resource+' missing from WebView provider'); - } - assert.ok(css.endsWith(sourceCss), 'native CSS must end with its authoritative calibration module'); - assert.ok(standalone.includes(''), 'Pages/standalone CSS drift'); - assert.ok(standalone.includes(''), 'Pages/standalone JS drift'); - for (const cls of ['gain-scale-travel','vu-scale-travel','meter-signal-area','fader-travel']) { - assert.ok(app.includes(cls)||sourceCss.includes(cls), 'calibration module missing '+cls); - } - assert.match(app,/const levelToTop=db=>/); - assert.match(app,/distance:Math\.max\(24,r\.height-77\)/); +test('JUCE executable embeds ONLY the approved native Console while archived preview assets remain source-tested',()=>{ + const cmake=read('CMakeLists.txt'),cpp=read('src/Main.cpp'); + const nativeHtml=read('web/console-native.html'),nativeJs=read('web/console-native.js'); + const sourceCss=read('web/styles-src/42-mixer-premium.css'); + const standalone=read('AR-MIX-Live-FX-Host-Standalone-v0.3.html'); + const assetList=cmake.match(/juce_add_binary_data\(ARMixAssets SOURCES\s+([^)]+)\)/)?.[1]; + assert.ok(assetList,'native resource list missing'); + const listed=assetList.trim().split(/\s+/); + assert.deepEqual(listed,['web/console-native.html','web/console-native.css','web/console-native.js']); + assert.match(cpp,/path == "\/" \|\| path == "\/index\.html"/); + assert.match(cpp,/data = BinaryData::consolenative_html/); + assert.match(cpp,/BinaryData::consolenative_css/); + assert.match(cpp,/BinaryData::consolenative_js/); + assert.doesNotMatch(cpp,/BinaryData::index_html|BinaryData::app_js|BinaryData::monitor_js/); + assert.match(nativeHtml,/ArSonMix — Native Live Console/); + assert.match(nativeJs,/arMixConsoleSubscribe/); + assert.match(nativeJs,/arMixConsoleAck/); + assert.match(nativeJs,/channelPeaksL/); + assert.ok(css.endsWith(sourceCss),'archived visual CSS source integrity lost'); + assert.ok(standalone.includes(''),'Pages standalone CSS drift'); + assert.ok(standalone.includes(''),'Pages standalone script drift'); + for(const cls of ['gain-scale-travel','vu-scale-travel','meter-signal-area','fader-travel']) + assert.ok(app.includes(cls)||sourceCss.includes(cls),'historical calibration lost '+cls); }); From 41ecd7d5801e52be04a0e9abaaee39eef5cb06b9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:15:44 +0700 Subject: [PATCH 114/155] feat(console): create stereo ChannelIds and patch only verified physical L/R pins Offer MONO/STEREO at +CHANNEL, disarm-gate topology edits, auto-bank only after native accepted ACK/snapshot. Support physical stereo source selection from two independently verified active driver pins; reject same-pin, stale, unverified endpoints. Native accepted ChannelId source snapshot now preserves right port identity. Add native UI stereo regression to Chromium and Windows CI. --- .github/workflows/p1-windows.yml | 1 + .github/workflows/ui-smoke.yml | 2 +- src/LiveDryRoutingLab.h | 7 +++ tests/console_native_stereo_operator_test.mjs | 37 +++++++++++ web/console-native.html | 3 +- web/console-native.js | 62 +++++++++++++++---- 6 files changed, 98 insertions(+), 14 deletions(-) create mode 100644 tests/console_native_stereo_operator_test.mjs diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 73b0cfc4a..9bb57a503 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -115,6 +115,7 @@ jobs: 'tests/independent_clock_adapter_contract_test.mjs' 'tests/direct_restore_recovery_contract_test.mjs' 'tests/native_artifact_packaging_contract_test.mjs' + 'tests/console_native_stereo_operator_test.mjs' 'tests/portable_workspace_contract_test.mjs' 'tests/plugin_vault_contract_test.mjs' 'tests/plugin_ui_contract_test.mjs' diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index bb1fd7746..475638a5f 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -65,7 +65,7 @@ jobs: node --check web/plugin-ui.js node --check web/mixer-io.js node --check web/mixer-layout.js - node --test tests/gui_workflow_contract_test.mjs tests/plugin_ui_contract_test.mjs tests/ci_workflow_efficiency_test.mjs tests/fx_drag_reorder_contract_test.mjs tests/mixer_io_operator_contract_test.mjs tests/mixer_shell_contract_test.mjs + node --test tests/gui_workflow_contract_test.mjs tests/plugin_ui_contract_test.mjs tests/ci_workflow_efficiency_test.mjs tests/fx_drag_reorder_contract_test.mjs tests/mixer_io_operator_contract_test.mjs tests/mixer_shell_contract_test.mjs tests/console_native_stereo_operator_test.mjs - name: Validate approved GUI checkpoint and single publisher run: python tests/gui_baseline_lock_test.py - name: Validate smart audio architecture handoff contract diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index be01c5b32..18822d60a 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1471,6 +1471,13 @@ class LiveDryRoutingLab final { const auto pin=enabledPorts_[source.inputL].load(std::memory_order_relaxed); physical->setProperty("portId","in:"+juce::String(pin)); } + // Preserve BOTH actual physical pins on native readback, not + // just the left pin. The GUI may not invent the right channel. + if(source.stereo && source.inputR>=0 && + source.inputRsetProperty("portIdRight","in:"+juce::String(right)); + } physical->setProperty("sourceFormat",source.stereo?"STEREO":"MONO"); row->setProperty("source",juce::var(physical.release())); break; diff --git a/tests/console_native_stereo_operator_test.mjs b/tests/console_native_stereo_operator_test.mjs new file mode 100644 index 000000000..22d8d75a8 --- /dev/null +++ b/tests/console_native_stereo_operator_test.mjs @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Regression against real accepted physical pin identity + native ChannelId GUI. +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {readFileSync} from 'node:fs'; +const js=readFileSync('web/console-native.js','utf8'); +const html=readFileSync('web/console-native.html','utf8'); +const native=readFileSync('src/LiveDryRoutingLab.h','utf8'); +const bridge=readFileSync('src/ConsoleLiveBridgeV6.h','utf8'); +test('Create Channel selects real mono/stereo processing format before native ACK',()=>{ + assert.match(html,/id="nativeChannelFormat"/); + assert.match(html,/']; - for(const e of snapshot?.device?.inputEndpoints||[]){ - if(!e.active)continue; - list.push(''); - } + const endpoints=(snapshot?.device?.inputEndpoints||[]).filter(e=> + e.active && Number.isInteger(e.port) && e.port>=0 && typeof e.id==='string'); + const list=['']; + // A stereo physical patch is NEVER synthesized from a neighbouring + // ordinal. Both named pins MUST be in the current accepted device mask. + if(row.nativeScoped && row.format==='STEREO'){ + for(let i=0;i'+ + 'L '+esc(l.label||l.id)+' / R '+esc(r.label||r.id)+''); + } + }else for(const e of endpoints) + list.push(''); return list.join(''); } function outputOptions(row){ @@ -83,7 +96,8 @@ function nativeStrip(r){ !(r.role==='MAIN'&&['SET_FADER','SET_PAN','SET_MUTE','SET_SOLO'].includes(op))&& !(r.role==='FX_RETURN'&&['SET_FADER','SET_PAN','SET_MUTE','SET_SOLO'].includes(op))&& !(snapshot?.legacyM4?.nativeBus?.structural&& - (op==='SET_PRIMARY_OUT'||op==='SET_PROCESSING_FORMAT')); + (op==='SET_PRIMARY_OUT'||op==='SET_PROCESSING_FORMAT'))&& + !(snapshot?.device?.outputArmed && op==='NATIVE_PATCH_CHANNEL'); const act=(op,attrs='')=>' data-op="'+op+'" data-id="'+esc(r.id)+'"'+attrs+ (can(op)?'':' disabled title="Requires native accepted operation"'); const role=main?'master':r.role==='GROUP'?'bus':r.role==='FX_RETURN'?'fx':'audio'; @@ -127,6 +141,10 @@ function nativeStrip(r){ } function render(){ const list=listedRows(),max=Math.max(1,Math.ceil(list.length/8));bank=Math.min(bank,max-1); + if(focusNewChannel){ + const pos=list.map(r=>r.role).lastIndexOf('INPUT'); + if(pos>=0){bank=Math.floor(pos/8);focusNewChannel=false;} + } const start=bank*8,visible=list.slice(start,start+8); el('tracks').innerHTML=visible.map(nativeStrip).join(''); const main=rows.find(r=>r.role==='MAIN'); @@ -134,7 +152,9 @@ function render(){ el('trackCount').textContent=rows.length+' NATIVE CHANNELS · '+(snapshot?.productionCallbackLive?'UNIVERSAL':'LEGACY M4 COMPAT'); const selector=el('bankSelect');selector.innerHTML=Array.from({length:max},(_,i)=>'').join('');selector.value=String(bank); el('bankPrev').disabled=bank===0;el('bankNext').disabled=bank>=max-1; - if(el('nativeAddAudio'))el('nativeAddAudio').disabled=!(opAvailable('CREATE_CHANNEL')||opAvailable('NATIVE_CREATE_CHANNEL')); + const createCap=opAvailable('CREATE_CHANNEL')||opAvailable('NATIVE_CREATE_CHANNEL'); + if(el('nativeAddAudio'))el('nativeAddAudio').disabled=!native||!createCap||!!snapshot?.device?.outputArmed; + if(el('nativeChannelFormat'))el('nativeChannelFormat').disabled=!native||!createCap||!!snapshot?.device?.outputArmed; if(el('nativeGroup'))el('nativeGroup').disabled=!(opAvailable('NATIVE_CREATE_GROUP_SELECTED')&&selectedIds.size>0&&!snapshot?.device?.outputArmed); if(el('nativeReturn'))el('nativeReturn').disabled=true; for(const [id,op] of [['addTrack','CREATE_CHANNEL'],['addBus','CREATE_GROUP'],['addFx','CREATE_FX_RETURN'],['clearCue','SET_CUE']]) @@ -188,8 +208,22 @@ function submitNode(n){ const row=rowFor(n.dataset.id),op=n.dataset.op; if(!row||!op)return; if(op==='NATIVE_PATCH_CHANNEL'){ - const pin=snapshot?.device?.inputEndpoints?.find(x=>x.id===n.value); - if(pin)send(op,row,{physicalLeft:pin.port,physicalRight:-1,sourceFormat:'MONO'}); + const allowed=(snapshot?.device?.inputEndpoints||[]).filter(x=> + x.active && Number.isInteger(x.port) && x.port>=0); + if(!n.value)return; + if(row.format==='STEREO'){ + const match=/^pair:([0-9]+):([0-9]+)$/.exec(n.value); + if(!match){announce('Choose two verified stereo input pins',true);return;} + const l=Number(match[1]),r=Number(match[2]); + if(l===r||!allowed.some(x=>x.port===l)||!allowed.some(x=>x.port===r)){ + announce('STEREO PATCH REJECTED · both distinct pins must be active',true);return; + } + send(op,row,{physicalLeft:l,physicalRight:r,sourceFormat:'STEREO'}); + }else{ + const pin=allowed.find(x=>x.id===n.value); + if(pin)send(op,row,{physicalLeft:pin.port,physicalRight:-1,sourceFormat:'MONO'}); + else announce('MONO PATCH REJECTED · input no longer active',true); + } } else if(op==='SET_SOURCE')send(op,row,{portId:n.value,sourceFormat:'MONO'}); else if(op==='SET_PROCESSING_FORMAT')send(op,row,{format:row.format==='MONO'?'STEREO':'MONO'}); @@ -235,6 +269,8 @@ function ack(a){ const key=a?.requestId,op=pending.get(key); if(!op)return; pending.delete(key); + if(a.status==='ACCEPTED' && (op.op==='NATIVE_CREATE_CHANNEL'||op.op==='CREATE_CHANNEL')) + focusNewChannel=true; // navigate only after the next accepted native snapshot announce(a.status==='ACCEPTED'?op.op+' ACCEPTED · verifying native snapshot': op.op+' REJECTED · '+(a.errorCode||'UNKNOWN'),a.status!=='ACCEPTED'); // Never mutate GUI state from ACK alone; subsequent native snapshot is authoritative. @@ -292,9 +328,11 @@ document.getElementById('nativeGroup')?.addEventListener('click',()=>{ }); document.getElementById('nativeAddAudio')?.addEventListener('click',()=>{ if(!native)return; + if(snapshot?.device?.outputArmed){announce('MUTE OUTPUT before creating a channel',true);return;} const name='Channel '+(rows.filter(r=>r.role==='INPUT').length+1),op=opAvailable('CREATE_CHANNEL')? 'CREATE_CHANNEL':opAvailable('NATIVE_CREATE_CHANNEL')?'NATIVE_CREATE_CHANNEL':null; - if(op)send(op,{id:'0',legacy:false},{name,format:'MONO'}); + const format=el('nativeChannelFormat')?.value==='STEREO'?'STEREO':'MONO'; + if(op)send(op,{id:'0',legacy:false},{name,format}); }); for(const id of ['wireView','wireMode','sofTarget'])if(el(id))el(id).disabled=true; if(!native){announce('NATIVE JUCE BACKEND REQUIRED · NO SIMULATED AUDIO',true);return;} From 28eb0f56fa478a53a30073e15316e4795740c0f9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:17:50 +0700 Subject: [PATCH 115/155] fix(console): inline approved PAN knob SVG for offline native Windows WebView Both knob CSS masks previously requested an unserved external asset, causing missing artwork in native EXE. Embed the existing approved reference SVG in CSS and regress against missing asset paths. Preserve one native Console source/renderer. --- tests/native_artifact_packaging_contract_test.mjs | 7 +++++++ web/console-native.css | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index 621e0586a..d0b1fe94c 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -47,6 +47,13 @@ test('package is a real PE32+ x64 GUI, not a console test binary or old 10CH art assert.match(packageScript,/NATIVE_CHANNELID_CH11_DYNAMIC_INPUT__10CH4AUX_COMPAT_FALLBACK__NOT_FULL_UNIVERSAL/); assert.match(verify,/NATIVE_CHANNELID_CH11_DYNAMIC_INPUT__10CH4AUX_COMPAT_FALLBACK__NOT_FULL_UNIVERSAL/); }); +test('native Console embeds both PAN knob masks without unserved artwork',()=>{ + const css=read('web/console-native.css'); + assert.ok((css.match(/data:image\/svg\+xml,%3Csvg/g)||[]).length===2); + assert.doesNotMatch(css,/url\(\s*['"]?assets\//); + assert.doesNotMatch(css,/url\(\s*['"]?\.\.\//); +}); + test('release verifier hashes ALL active GUI bytes inside actual EXE and ZIP',()=>{ for(const f of ['consoleNativeHtmlSha256','consoleNativeCssSha256','consoleNativeJsSha256','activeGuiEntrypoint']) { assert.ok(packageScript.includes(f+' = ')); diff --git a/web/console-native.css b/web/console-native.css index 01f842030..92b348352 100644 --- a/web/console-native.css +++ b/web/console-native.css @@ -3790,8 +3790,8 @@ html * ,html *::before,html *::after{ inset:2px 1px!important;width:20px!important;height:20px!important; border:0!important;border-radius:0!important; background:var(--wire-pot-fill,#4b535b)!important; - -webkit-mask-image:url("assets/knob-ICON.svg")!important; - mask-image:url("assets/knob-ICON.svg")!important; + -webkit-mask-image:url("data:image/svg+xml,%3Csvg%20version%3D%221.2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%20800%22%20width%3D%22800%22%20height%3D%22800%22%3E%0A%09%3Cstyle%3E%0A%09%09.s0%20%7B%20fill%3A%20%23000000%20%7D%20%0A%09%3C%2Fstyle%3E%0A%09%3Cg%3E%0A%09%09%3Cg%3E%0A%09%09%09%3Cg%3E%0A%09%09%09%09%3Cpath%20class%3D%22s0%22%20d%3D%22m436.84%20436.84c-10.09%2010.09-23.34%2015.16-36.59%2015.16-13.25%200-26.49-5.07-36.59-15.16-20.23-20.24-20.23-52.94%200-73.18l253.11-253.11c-60.49-45.33-135.27-72.55-216.52-72.55-199.7%200-362.25%20162.5-362.25%20362.25%200%20199.75%20162.55%20362.25%20362.25%20362.25%20199.71%200%20362.25-162.5%20362.25-362.25%200-81.25-27.22-156.03-72.55-216.53z%22%2F%3E%0A%09%09%09%3C%2Fg%3E%0A%09%09%3C%2Fg%3E%0A%09%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A")!important; + mask-image:url("data:image/svg+xml,%3Csvg%20version%3D%221.2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%20800%22%20width%3D%22800%22%20height%3D%22800%22%3E%0A%09%3Cstyle%3E%0A%09%09.s0%20%7B%20fill%3A%20%23000000%20%7D%20%0A%09%3C%2Fstyle%3E%0A%09%3Cg%3E%0A%09%09%3Cg%3E%0A%09%09%09%3Cg%3E%0A%09%09%09%09%3Cpath%20class%3D%22s0%22%20d%3D%22m436.84%20436.84c-10.09%2010.09-23.34%2015.16-36.59%2015.16-13.25%200-26.49-5.07-36.59-15.16-20.23-20.24-20.23-52.94%200-73.18l253.11-253.11c-60.49-45.33-135.27-72.55-216.52-72.55-199.7%200-362.25%20162.5-362.25%20362.25%200%20199.75%20162.55%20362.25%20362.25%20362.25%20199.71%200%20362.25-162.5%20362.25-362.25%200-81.25-27.22-156.03-72.55-216.53z%22%2F%3E%0A%09%09%09%3C%2Fg%3E%0A%09%09%3C%2Fg%3E%0A%09%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A")!important; -webkit-mask-position:center!important;mask-position:center!important; -webkit-mask-size:contain!important;mask-size:contain!important; -webkit-mask-repeat:no-repeat!important;mask-repeat:no-repeat!important; From 78081300faa5c4f5763a44f4f788bfa57416853d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:22:04 +0700 Subject: [PATCH 116/155] feat(engine): real CH11+ and Group post-fader PCM metering in native Console Collect bounded ChannelId native meter taps from the sole existing realtime graph render, preserve peak envelopes across chunking, publish real accepted roster-index L/R values to nativeBus snapshot, and show them in the one Console. No browser synthetic audio, no second callback, no heap on audio thread; gate meter readback by active device epoch and clear on fail-silent. Add regression coverage. --- src/LiveDryRoutingLab.h | 37 ++++++++++++++++++- tests/console_native_stereo_operator_test.mjs | 13 +++++++ web/console-native.js | 12 ++++-- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 18822d60a..0669139fe 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1437,6 +1437,10 @@ class LiveDryRoutingLab final { allowed.add(juce::var(juce::String(op))); state->setProperty("supportedOps",juce::var(allowed)); juce::Array rows; + // Meter taps come from the SAME realtime ChannelId renderer, in + // accepted roster order. No JS guesses or second DSP render. + const bool pcmMeterValid=nativeMeterEpoch_.load(std::memory_order_acquire)==epoch(); + std::size_t meterIndex=0; for(const auto& ch:routing->channels) { auto row=std::make_unique(); row->setProperty("id",juce::String(std::to_string(ch.id.value))); @@ -1462,6 +1466,16 @@ class LiveDryRoutingLab final { } row->setProperty("primaryOutput", juce::String(std::to_string(ch.primaryOutput.value))); + if(pcmMeterValid && meterIndexsetProperty("peakL",static_cast( + nativeMeterPeaksL_[meterIndex].load(std::memory_order_relaxed))); + row->setProperty("peakR",static_cast( + nativeMeterPeaksR_[meterIndex].load(std::memory_order_relaxed))); + } else { + row->setProperty("peakL",0.); + row->setProperty("peakR",0.); + } + ++meterIndex; // Actual committed physical patches. Expose the verified original // physical pin, not the reordered callback ordinal. for(const auto& source:nativeAccepted_.graph.request.sources) { @@ -1520,6 +1534,7 @@ class LiveDryRoutingLab final { void disable() noexcept { channelIdPcmEpoch_.store(0,std::memory_order_release); + nativeMeterEpoch_.store(0,std::memory_order_release); nativeStructureLive_=false; nativePublisher_.unpublish(); // CONTROL-only; audio lease retires safely nativeAccepted_=armix::mixer::UnifiedLegacyAccepted{}; @@ -1602,6 +1617,7 @@ class LiveDryRoutingLab final { // erase aliased JUCE/driver input PCM before the CH strips consume it. // Every failed/unpatched/MUTED route still uses this fail-silent gate. const auto silence=[&]() noexcept { + nativeMeterEpoch_.store(0,std::memory_order_release); if(!outputs)return; for(int c=0;c perChannelPeaks{}; std::array perChannelPeaksL{},perChannelPeaksR{}; + // Bounded realtime meter scratch for all accepted ChannelIds, not + // only the original ten. No allocation or graph iteration on AUDIO. + std::array nativeMaxL{},nativeMaxR{}; std::array perAuxPeaks{}; for(int offset=0;offset tapsL{},tapsR{}; + std::array tapsL{},tapsR{}; const auto noExtraFx=[](armix::mixer::ChannelId,float*,float*,int) noexcept {}; processed=nativePublisher_.render( generation,shifted.data(),inputCount, @@ -1722,6 +1741,10 @@ class LiveDryRoutingLab final { monitorL?monitorL+offset:nullptr, monitorR?monitorR+offset:nullptr,tapsL,tapsR); if(processed) { + for(std::size_t ch=0;ch fxReused_{0}; std::array,count> channelPeaks_{}; std::array,count> channelPeaksL_{},channelPeaksR_{}; + // Constant-memory native post-fader meters; capacity affects only + // telemetry, not how many channels the audio graph can admit. + static constexpr std::size_t nativeMeterCapacity=128; + std::array,nativeMeterCapacity> nativeMeterPeaksL_{},nativeMeterPeaksR_{}; + std::atomic nativeMeterEpoch_{0}; // Exclusive render-producer state. Bounded fade starts from the exact // previously output sample, preventing a topology switch discontinuity. static constexpr int rampFrames=256; diff --git a/tests/console_native_stereo_operator_test.mjs b/tests/console_native_stereo_operator_test.mjs index 22d8d75a8..3a5ee9b1c 100644 --- a/tests/console_native_stereo_operator_test.mjs +++ b/tests/console_native_stereo_operator_test.mjs @@ -35,3 +35,16 @@ test('accepted snapshot carries correct mono/stereo patch and no invented signal assert.match(js,/NATIVE JUCE BACKEND REQUIRED/); assert.doesNotMatch(js,/new AudioContext|AudioWorklet|Math\.sin\(/); }); + +test('CH11 and dynamic GROUP meters consume post-fader native PCM taps',()=>{ + const js=readFileSync('web/console-native.js','utf8'); + const native=readFileSync('src/LiveDryRoutingLab.h','utf8'); + assert.match(js,/nativeScoped\?Number\(r\.measuredL\)/); + assert.match(js,/nativeScoped\?Number\(r\.measuredR\)/); + assert.match(native,/nativePublisher_\.render\(/); + assert.match(native,/nativeMaxL\[ch\]/); + assert.match(native,/nativeMeterPeaksL_\[meterIndex\]/); + assert.match(native,/row->setProperty\("peakL"/); + assert.match(native,/nativeMeterEpoch_\.store\(0,std::memory_order_release\)/); + assert.doesNotMatch(js,/new AudioContext|AudioWorklet|Math\.sin\(/); +}); diff --git a/web/console-native.js b/web/console-native.js index c868cb967..6630cb0d9 100644 --- a/web/console-native.js +++ b/web/console-native.js @@ -52,7 +52,8 @@ function normalize(s){ patch?.portId||'',out:String(ch.primaryOutput||''), controls:{faderDb:20*Math.log10(Math.max(Number(ch.fader)||0,1e-6)), pan:(Number(ch.pan)||0)*100,mute:!!ch.mute,solo:!!ch.solo}, - fx:[],sends:ch.parallelSends||[],legacy:false,nativeScoped:true}); + fx:[],sends:ch.parallelSends||[],legacy:false,nativeScoped:true, + measuredL:ch.peakL,measuredR:ch.peakR}); } } return actual; @@ -172,8 +173,12 @@ function paintMeters(){ if(!meter)continue; const index=Number(r.id)-1; const dynamic=snapshot.telemetry?.channelMeterRmsPeak?.[r.id]; - let left=r.legacy?Number(legacy.channelPeaksL?.[index]):Number(dynamic); - let right=r.legacy?Number(legacy.channelPeaksR?.[index]):Number(dynamic); + // Additional CH11+/GROUP/BUS meters are native post-fader PCM taps + // published under accepted nativeBus ChannelIds, NOT fabricated levels. + let left=r.legacy?Number(legacy.channelPeaksL?.[index]): + r.nativeScoped?Number(r.measuredL):Number(dynamic); + let right=r.legacy?Number(legacy.channelPeaksR?.[index]): + r.nativeScoped?Number(r.measuredR):Number(dynamic); for(const [side,value] of [['left',left],['right',right]]){ const node=meter.querySelector('.meter-fill.'+side); if(!node)continue; @@ -256,6 +261,7 @@ function accept(s){ const alive=new Set(rows.map(r=>r.id));for(const id of selectedIds)if(!alive.has(id))selectedIds.delete(id); const signature=JSON.stringify([rows.map(r=>[r.id,r.name,r.role,r.format,r.source,r.out,r.controls,r.fx]), s.device?.epoch,s.device?.inputEndpoints,s.legacyM4?.supportedOps,s.legacyM4?.nativeBus?.supportedOps,s.graph?.capabilities?.supportedOps]); + // Audio metering is a cheap targeted paint, never a full Console DOM rebuild. if(signature!==lastSignature){lastSignature=signature;render();}else paintMeters(); el('transport').textContent=s.device?.outputArmed?'OUTPUT ARMED':'OUTPUT DISARMED'; if(el('nativeOutput')){ From f5c42ae9668098e93b04dcd4e935645d39792e4d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:31:36 +0700 Subject: [PATCH 117/155] perf(console): replace quadratic stereo input enumeration with verified L/R selects Large ASIO input masks formerly generated N*(N-1) options per strip. Render two independently selectable native L/R ports in linear O(N), issue one native stereo routing ACK only when both distinct pins exist in the active verified mask; keep correct readback from accepted native ChannelId source. Add regression. --- tests/console_native_stereo_operator_test.mjs | 14 +++-- web/console-native.css | 4 ++ web/console-native.js | 61 +++++++++++-------- 3 files changed, 49 insertions(+), 30 deletions(-) diff --git a/tests/console_native_stereo_operator_test.mjs b/tests/console_native_stereo_operator_test.mjs index 3a5ee9b1c..45b2a31dc 100644 --- a/tests/console_native_stereo_operator_test.mjs +++ b/tests/console_native_stereo_operator_test.mjs @@ -18,20 +18,24 @@ test('Create Channel selects real mono/stereo processing format before native AC assert.match(bridge,/operation=="NATIVE_CREATE_CHANNEL"/); assert.match(bridge,/format=="STEREO"\?armix::mixer::ProcessingFormat::stereo/); }); -test('stereo patch requires two distinct active native physical pins',()=>{ - assert.match(js,/row\.nativeScoped && row\.format==='STEREO'/); - assert.match(js,/i===j\|\|l\.port===r\.port/); - assert.match(js,/pair:.*l\.port/); +test('two independently verified stereo pin selectors scale linearly',()=>{ + assert.match(js,/function stereoSourceMarkup\(row,attr\)/); + assert.match(js,/for\(const p of pins\)list\.push/); + assert.match(js,/data-stereo-side/); + assert.doesNotMatch(js,/for\(let i=0;i=0/); assert.match(native,/setProperty\("portIdRight"/); assert.match(native,/enabledPorts_\[source\.inputR\]/); + const css=readFileSync('web/console-native.css','utf8'); + assert.match(css,/\.native-stereo-pair\{display:flex/); + assert.match(css,/min-width:0/); }); test('accepted snapshot carries correct mono/stereo patch and no invented signal',()=>{ assert.match(js,/patch\?\.portIdRight/); - assert.match(js,/row\.source===value/); + assert.match(js,/current===p\.port/); assert.match(js,/NATIVE JUCE BACKEND REQUIRED/); assert.doesNotMatch(js,/new AudioContext|AudioWorklet|Math\.sin\(/); }); diff --git a/web/console-native.css b/web/console-native.css index 92b348352..4544c1a26 100644 --- a/web/console-native.css +++ b/web/console-native.css @@ -3812,3 +3812,7 @@ html * ,html *::before,html *::after{ /* Native production frontend: original approved console material; no simulated DSP. */ body .status-bar .warning{color:#e2bd7d}body .strip [disabled]{cursor:not-allowed;opacity:.50}body .console-body .strip .meter-box .vu-tick span{left:7px;right:9px} + +/* Native hardware stereo input: linear-size independent L/R selectors. */ +.native-stereo-pair{display:flex;gap:3px;flex:1;min-width:0;max-width:100%} +.native-stereo-pair>.route-select{flex:1 1 0;min-width:0;width:50%;max-width:50%;font-size:9px} diff --git a/web/console-native.js b/web/console-native.js index 6630cb0d9..f92b23f2a 100644 --- a/web/console-native.js +++ b/web/console-native.js @@ -64,24 +64,32 @@ function listedRows(){const filter=el('viewFilter')?.value||'all'; filter==='fx'&&r.role==='FX_RETURN'); } function gain(v){const n=Number(v);return Number.isFinite(n)?Math.max(-60,Math.min(10,n)):-60} -function sourceOptions(row){ - const endpoints=(snapshot?.device?.inputEndpoints||[]).filter(e=> +function verifiedInputs(){ + return (snapshot?.device?.inputEndpoints||[]).filter(e=> e.active && Number.isInteger(e.port) && e.port>=0 && typeof e.id==='string'); - const list=['']; - // A stereo physical patch is NEVER synthesized from a neighbouring - // ordinal. Both named pins MUST be in the current accepted device mask. - if(row.nativeScoped && row.format==='STEREO'){ - for(let i=0;i'+ - 'L '+esc(l.label||l.id)+' / R '+esc(r.label||r.id)+''); - } - }else for(const e of endpoints) - list.push('']; + for(const e of verifiedInputs()) + opts.push(''); - return list.join(''); + return opts.join(''); +} +// O(active pins), NOT O(pins^2): two independent compact native selectors +// avoid generating tens of thousands of options for large ASIO interfaces. +// Only a verified distinct L+R pair may dispatch one atomic native patch. +function stereoSourceMarkup(row,attr){ + const pins=verifiedInputs(),pair=/^pair:([0-9]+):([0-9]+)$/.exec(row.source||''); + const selected=side=>pair?(side==='L'?Number(pair[1]):Number(pair[2])):-1; + const portOptions=side=>{ + const current=selected(side),list=['']; + for(const p of pins)list.push(''); + return list.join(''); + }; + return '
'+ + ''+ + '
'; } function outputOptions(row){ let opts=['']; @@ -115,7 +123,9 @@ function nativeStrip(r){ ''+ '
IN / OUT
'+ '
IN'+ - (r.role==='INPUT'?'': + (r.role==='INPUT'?(r.nativeScoped&&format==='STEREO'? + stereoSourceMarkup(r,side=>act('NATIVE_PATCH_CHANNEL',' data-stereo-side="'+side+'"')): + ''): ''+(main?'SUM':'BUS RECEIVE')+'')+'
'+ '
OUT'+ (r.nativeScoped?''+esc( @@ -213,18 +223,19 @@ function submitNode(n){ const row=rowFor(n.dataset.id),op=n.dataset.op; if(!row||!op)return; if(op==='NATIVE_PATCH_CHANNEL'){ - const allowed=(snapshot?.device?.inputEndpoints||[]).filter(x=> - x.active && Number.isInteger(x.port) && x.port>=0); - if(!n.value)return; - if(row.format==='STEREO'){ - const match=/^pair:([0-9]+):([0-9]+)$/.exec(n.value); - if(!match){announce('Choose two verified stereo input pins',true);return;} - const l=Number(match[1]),r=Number(match[2]); + const allowed=verifiedInputs(); + if(n.dataset.stereoSide && row.format==='STEREO'){ + const strip=n.closest('.strip'),lText=strip?.querySelector('[data-stereo-side="L"]')?.value; + const rText=strip?.querySelector('[data-stereo-side="R"]')?.value; + if(!lText||!rText){announce('Select both verified L and R pins',false);return;} + const lMatch=/^in:([0-9]+)$/.exec(lText),rMatch=/^in:([0-9]+)$/.exec(rText); + if(!lMatch||!rMatch){announce('Invalid stereo device pin',true);return;} + const l=Number(lMatch[1]),r=Number(rMatch[1]); if(l===r||!allowed.some(x=>x.port===l)||!allowed.some(x=>x.port===r)){ announce('STEREO PATCH REJECTED · both distinct pins must be active',true);return; } send(op,row,{physicalLeft:l,physicalRight:r,sourceFormat:'STEREO'}); - }else{ + }else if(row.format==='MONO'){ const pin=allowed.find(x=>x.id===n.value); if(pin)send(op,row,{physicalLeft:pin.port,physicalRight:-1,sourceFormat:'MONO'}); else announce('MONO PATCH REJECTED · input no longer active',true); From 8e09656a4b74147c925d00e797138f44b520e70f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:33:09 +0700 Subject: [PATCH 118/155] fix(release): repair native Console PowerShell resource verifier parser Windows compiled the correct native Console and passed all 54/54 CTests, but post-package verifier syntax failed on a trailing comma after the last resource hash. Remove invalid comma; keep full source-to-EXE embedded-byte verification and add guard against reintroducing the syntax error. --- scripts/verify_native_windows_artifact.ps1 | 3 +-- tests/native_artifact_packaging_contract_test.mjs | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/verify_native_windows_artifact.ps1 b/scripts/verify_native_windows_artifact.ps1 index 4d1e267a4..bbe7a234e 100644 --- a/scripts/verify_native_windows_artifact.ps1 +++ b/scripts/verify_native_windows_artifact.ps1 @@ -85,8 +85,7 @@ if ($LASTEXITCODE -ne 0 -or $sha -ne $manifest.sourceCommit) { $resources = @( @{Path="web/console-native.html"; Hash=$manifest.consoleNativeHtmlSha256}, @{Path="web/console-native.css"; Hash=$manifest.consoleNativeCssSha256}, - @{Path="web/console-native.js"; Hash=$manifest.consoleNativeJsSha256}, - + @{Path="web/console-native.js"; Hash=$manifest.consoleNativeJsSha256} ) $embeddedText = [Text.Encoding]::UTF8.GetString($bytes) foreach ($item in $resources) { diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index d0b1fe94c..f4893fec7 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -54,6 +54,12 @@ test('native Console embeds both PAN knob masks without unserved artwork',()=>{ assert.doesNotMatch(css,/url\(\s*['"]?\.\.\//); }); +test('native PowerShell release verifier has no trailing expression after last resource',()=>{ + const resources=verify.slice(verify.indexOf('$resources = @('),verify.indexOf('$embeddedText =',verify.indexOf('$resources = @('))); + assert.match(resources,/Hash=\$manifest\\.consoleNativeJsSha256\}\s*\\)/); + assert.doesNotMatch(resources,/Hash=\$manifest\\.consoleNativeJsSha256\}\s*,\s*\\)/); +}); + test('release verifier hashes ALL active GUI bytes inside actual EXE and ZIP',()=>{ for(const f of ['consoleNativeHtmlSha256','consoleNativeCssSha256','consoleNativeJsSha256','activeGuiEntrypoint']) { assert.ok(packageScript.includes(f+' = ')); From 2e18bf274b24b725a08ac6b560f5ef084be17cc9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:33:40 +0700 Subject: [PATCH 119/155] test(release): use parser-safe literal assertions for PowerShell hash list Make the regression independent of brittle regex escapes; ensure source ends with final native JS hash and no extra comma. --- tests/native_artifact_packaging_contract_test.mjs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/native_artifact_packaging_contract_test.mjs b/tests/native_artifact_packaging_contract_test.mjs index f4893fec7..fc34f51e2 100644 --- a/tests/native_artifact_packaging_contract_test.mjs +++ b/tests/native_artifact_packaging_contract_test.mjs @@ -54,10 +54,13 @@ test('native Console embeds both PAN knob masks without unserved artwork',()=>{ assert.doesNotMatch(css,/url\(\s*['"]?\.\.\//); }); -test('native PowerShell release verifier has no trailing expression after last resource',()=>{ - const resources=verify.slice(verify.indexOf('$resources = @('),verify.indexOf('$embeddedText =',verify.indexOf('$resources = @('))); - assert.match(resources,/Hash=\$manifest\\.consoleNativeJsSha256\}\s*\\)/); - assert.doesNotMatch(resources,/Hash=\$manifest\\.consoleNativeJsSha256\}\s*,\s*\\)/); +test('native PowerShell resource list ends without a trailing comma',()=>{ + const start=verify.indexOf('$resources = @('); + const end=verify.indexOf('$embeddedText =',start); + assert.ok(start>=0&&end>start,'native resource list missing'); + const resources=verify.slice(start,end); + assert.ok(resources.includes('Hash=$manifest.consoleNativeJsSha256}'),'native JS hash missing'); + assert.ok(!resources.includes('Hash=$manifest.consoleNativeJsSha256},'),'trailing comma causes PowerShell ParserError'); }); test('release verifier hashes ALL active GUI bytes inside actual EXE and ZIP',()=>{ From 6cb6d0d27a94d22685d5e365360b2c5b68834e39 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:50:03 +0700 Subject: [PATCH 120/155] feat(engine): stage genuine VST3 insert ownership on dynamic ChannelIds Prepare native catalog VST3 outside callback; transactional one-roster/FX-lease/PCM commit, stable JUCE instance identity, zero-latency/layout/epoch admission, bounded 8 slot rack, control-only editor and RT atomic bypass. Publish inserts from real owned graph and test reuse/rollback/duplicate rejection. Pending GUI intent integration before branch update. --- engine/core/DynamicChannelFxLeaseBank.h | 34 +++++++ src/LiveAudioEngine.h | 68 ++++++++++++++ src/LiveDryRoutingLab.h | 114 +++++++++++++++++++++++- tests/live_channel_fx_graph_test.cpp | 18 ++++ 4 files changed, 233 insertions(+), 1 deletion(-) diff --git a/engine/core/DynamicChannelFxLeaseBank.h b/engine/core/DynamicChannelFxLeaseBank.h index 68b44c7a6..46c29f4f8 100644 --- a/engine/core/DynamicChannelFxLeaseBank.h +++ b/engine/core/DynamicChannelFxLeaseBank.h @@ -208,6 +208,40 @@ class DynamicChannelFxLeaseBank final { return prepare(epoch,revision,retained,destination,prior.external_); } + // CONTROL thread: publish a newly instantiated vendor insert on an + // independently owned ChannelId, retaining old leases/state/tails. + // This does NOT call a vendor or allocate from the audio callback. + static Fault appendOwned(std::uint64_t epoch,std::uint64_t revision, + const DynamicChannelFxLeaseBank& prior,ChannelId target, + ProcessingFormat format,Lease plugin, + DynamicChannelFxLeaseBank& destination) { + if(!epoch||epoch!=prior.epoch_||revision<=prior.revision_) + return Fault::invalidEpoch; + if(!target.value)return Fault::emptyId; + if(!plugin||!plugin->processor)return Fault::emptyLease; + if(prior.external_.id==target)return Fault::invalidExternalLease; + std::vector list; + list.reserve(prior.rows_.size()+1); + bool found=false; + for(const auto& row:prior.rows_) { + Assignment a;a.id=row.id;a.format=row.format; + a.inserts.reserve(row.count+(row.id==target?1:0)); + for(std::size_t i=0;i=maxInserts)return Fault::tooManyInserts; + if(row.format!=format)return Fault::invalidBusLayout; + a.inserts.push_back(plugin);found=true; + } + list.push_back(std::move(a)); + } + if(!found) { + Assignment a;a.id=target;a.format=format; + a.inserts.push_back(std::move(plugin)); + list.push_back(std::move(a)); + } + return prepare(epoch,revision,list,destination,prior.external_); + } + // Process each M4 VST exactly once at its target ChannelId. CPU work is // proportional to that node's FX rack, not every Channel in the session. // Call only on the native audio thread after epoch/revision graph admission. diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index fd283f31f..994c8cae2 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1273,6 +1273,74 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback epoch,pcmRevision,rosterRevision,role,selected, name,gain,remove,true); } + // User-owned VST3 on a true dynamic ChannelId. Instantiation/scan/layout + // work is CONTROL only; the callback receives an immutable fx lease. + LiveDryRoutingLab::NativeBusResult installNativeVst3( + std::uint64_t ep,std::uint64_t pcmRevision, + std::uint64_t rosterRevision,armix::mixer::ChannelId id, + const juce::String& path,int uid,const juce::String& catalogId) { + LiveDryRoutingLab::NativeBusResult fail{}; + fail.error="NATIVE_VST3_HOST_UNAVAILABLE"; + auto* device=deviceManager_.getCurrentAudioDevice(); + if(independent_.active()||!attached_||!device|| + !directFence_.permitted()||!allOutputsDisarmed()|| + handoff_.busy()||fxMovePhase_.load(std::memory_order_acquire)!=0|| + routeReconfiguring_.load(std::memory_order_acquire)|| + diagnosticRoute_.load(std::memory_order_acquire)!= + armix::diagnostics::Route::normal)return fail; + if(ep!=deviceStartCount_.load(std::memory_order_acquire)) + {fail.error="NATIVE_VST3_DEVICE_CHANGED";return fail;} + const auto rate=device->getCurrentSampleRate(); + const int frames=juce::jmax(32,device->getCurrentBufferSizeSamples()); + if(!(rate>0.)||frames>LiveDryRoutingLab::Block::hardFrameLimit) + {fail.error="NATIVE_VST3_UNSUPPORTED_DEVICE_QUANTUM";return fail;} + auto* fmt=formats_.getFormat(0); + if(!fmt||!fmt->fileMightContainThisPluginType(path)) + {fail.error="NATIVE_VST3_MODULE_NOT_FOUND";return fail;} + try { + juce::OwnedArray descriptions; + fmt->findAllTypesForFile(descriptions,path); + juce::PluginDescription* chosen=nullptr; + for(auto* item:descriptions) + if(item&&item->uniqueId==uid&&!item->isInstrument) + {chosen=item;break;} + if(!chosen){fail.error="NATIVE_VST3_IDENTITY_NOT_FOUND";return fail;} + juce::String pluginError; + auto instance=formats_.createPluginInstance(*chosen,rate, + frames,pluginError); + if(!instance){fail.error="NATIVE_VST3_CREATE_FAILED";return fail;} + const auto layout=armix::vst::prepareStereoEffectLayout(*instance); + if(layout.isNotEmpty()){ + fail.error="NATIVE_VST3_INCOMPATIBLE_STEREO_LAYOUT";return fail; + } + instance->prepareToPlay(rate,frames); + if(instance->getLatencySamples()!=0) { + fail.error="NATIVE_VST3_REQUIRES_PDC";return fail; + } + auto lease=std::make_shared< + armix::mixer::LiveChannelFxGraph::FxInstance>( + std::move(instance),catalogId,chosen->name, + LiveDryRoutingLab::Block::hardFrameLimit); + return dryRoutingLab_.attachNativeInsert(ep,pcmRevision, + rosterRevision,id,catalogId,std::move(lease),true); + } catch(...) { + fail.error="NATIVE_VST3_VENDOR_PREPARE_FAILED";return fail; + } + } + bool bypassNativeVst3(std::uint64_t epoch,std::uint64_t revision, + armix::mixer::ChannelId id,std::size_t slot, + const juce::String& token,bool bypass) noexcept { + return dryRoutingLab_.bypassNativeInsert(epoch,revision,id,slot, + token,bypass); + } + armix::mixer::LiveChannelFxGraph::InstanceLease leaseNativeVst3Editor( + std::uint64_t epoch,std::uint64_t revision, + armix::mixer::ChannelId id,std::size_t slot, + const juce::String& token) const noexcept { + return dryRoutingLab_.leaseNativeInsertEditor( + epoch,revision,id,slot,token); + } + LiveDryRoutingLab::NativeBusResult createNativeInputChannel( std::uint64_t epoch,std::uint64_t pcmRevision, std::uint64_t rosterRevision,const std::string& name, diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 0669139fe..6ba25498a 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1108,6 +1108,101 @@ class LiveDryRoutingLab final { std::uint64_t pcmRevision=0,rosterRevision=0; const char* error="NATIVE_GRAPH_NOT_READY"; }; + // A real VST3 instance is prepared in LiveAudioEngine on CONTROL before + // this call. ChannelId roster, actual processor lease and the one PCM + // renderer commit as ONE accepted native revision. Previous sound/owner + // survives plugin validation, routing or publication failure. + NativeBusResult attachNativeInsert( + std::uint64_t expectedEpoch,std::uint64_t expectedPcmRevision, + std::uint64_t expectedRosterRevision,armix::mixer::ChannelId target, + const juce::String& catalogId, + armix::mixer::DynamicChannelFxLeaseBank::Lease processor, + bool outputsDisarmed=false) { + using namespace armix::mixer; + NativeBusResult out{}; + out.pcmRevision=nativeAccepted_.pcmRevision; + out.rosterRevision=nativeAccepted_.graph.roster.revision(); + if(!channelIdPhysicalPcmActive()||!ready()|| + expectedEpoch!=epoch()||nativeAccepted_.deviceEpoch!=expectedEpoch|| + !nativeAccepted_.fxOwners||!processor||!processor->processor|| + expectedPcmRevision!=nativeAccepted_.pcmRevision|| + expectedRosterRevision!=nativeAccepted_.graph.roster.revision()) + return out; + if(!outputsDisarmed) {out.error="OUTPUT_MUST_BE_DISARMED";return out;} + const auto* current=nativeAccepted_.graph.roster.find(target); + if(!current || (current->role!=ChannelRole::input && + current->role!=ChannelRole::group)) { + out.error="NATIVE_INSERT_TARGET_UNAVAILABLE";return out; + } + // The fixed 10 CH/4 AUX rack remains owned by M4/Show while migrating. + // Never replace or double-render one of its vendor instances. + for(const auto id:nativeAccepted_.graph.ids.inputs) + if(id==target){out.error="M4_INSERT_USE_EXISTING_RACK";return out;} + if(originalM4Aux(target)){ + out.error="M4_INSERT_USE_EXISTING_RACK";return out; + } + if(catalogId.isEmpty()||catalogId.getNumBytesAsUTF8()>256) { + out.error="INVALID_VST3_CATALOG_ID";return out; + } + try { + auto next=nativeAccepted_.graph.roster; + ChannelEdit add;add.kind=ChannelEdit::Kind::addInsertReference; + add.id=target;add.text=catalogId.toStdString(); + const std::array edits{add}; + if(!next.edit(expectedRosterRevision,edits).ok()) { + out.error="NATIVE_INSERT_CAPACITY_REJECTED";return out; + } + DynamicChannelFxLeaseBank prepared; + const auto fault=DynamicChannelFxLeaseBank::appendOwned( + expectedEpoch,expectedPcmRevision+1,*nativeAccepted_.fxOwners, + target,current->format,std::move(processor),prepared); + if(fault!=DynamicChannelFxLeaseBank::Fault::none) { + out.error="NATIVE_VST3_LEASE_PREPARE_REJECTED";return out; + } + auto owner=std::make_shared( + std::move(prepared)); + DynamicNativeSessionPublisher::FxPlan fx; + fx.owner=std::static_pointer_cast(owner); + fx.context=owner.get(); + fx.render=+[](void* ctx,ChannelId id,float* l,float* r,int n) noexcept{ + (*static_cast(ctx))(id,l,r,n); + }; + fx.deviceEpoch=expectedEpoch; + fx.graphRevision=expectedPcmRevision+1; + const auto published=nativePublisher_.commit( + next,nativeAccepted_.graph.request,expectedPcmRevision, + expectedEpoch,epoch(),true,std::move(fx)); + if(!published.ok()) { + out.error="NATIVE_VST3_PCM_COMMIT_REJECTED";return out; + } + nativeAccepted_.graph.roster=std::move(next); + nativeAccepted_.fxOwners=std::move(owner); + nativeAccepted_.pcmRevision=published.revision; + nativeStructureLive_=true; // M4 Show cannot represent new inserts. + nativeMeterEpoch_.store(0,std::memory_order_release); + out.accepted=true;out.error=""; + out.pcmRevision=published.revision; + out.rosterRevision=nativeAccepted_.graph.roster.revision(); + out.created=target; + return out; + } catch(...) { + out.error="NATIVE_VST3_ADMISSION_FAILED";return out; + } + } + bool bypassNativeInsert(std::uint64_t epochAtEdit,std::uint64_t pcmRevision, + armix::mixer::ChannelId target,std::size_t slot, + const juce::String& token,bool bypass) noexcept { + return nativeAccepted_.setFxBypass(nativePublisher_,epochAtEdit, + pcmRevision,target,slot,token,bypass); + } + armix::mixer::DynamicChannelFxLeaseBank::Lease leaseNativeInsertEditor( + std::uint64_t epochAtEdit,std::uint64_t pcmRevision, + armix::mixer::ChannelId target,std::size_t slot, + const juce::String& token) const noexcept { + return nativeAccepted_.leaseFxEditor(nativePublisher_,epochAtEdit, + pcmRevision,target,slot,token); + } + NativeBusResult editNativeBus(std::uint64_t expectedEpoch, std::uint64_t expectedPcmRevision, std::uint64_t expectedRosterRevision, @@ -1433,7 +1528,9 @@ class LiveDryRoutingLab final { "NATIVE_REMOVE_BUS","NATIVE_SET_BUS_MIX", "NATIVE_CREATE_CHANNEL","NATIVE_PATCH_CHANNEL", "NATIVE_SET_CHANNEL_MIX", - "NATIVE_SET_CHANNEL_MUTE_SOLO"}) + "NATIVE_SET_CHANNEL_MUTE_SOLO", + "NATIVE_LOAD_INSERT","NATIVE_SET_INSERT_BYPASS", + "NATIVE_OPEN_INSERT_EDITOR"}) allowed.add(juce::var(juce::String(op))); state->setProperty("supportedOps",juce::var(allowed)); juce::Array rows; @@ -1466,6 +1563,21 @@ class LiveDryRoutingLab final { } row->setProperty("primaryOutput", juce::String(std::to_string(ch.primaryOutput.value))); + juce::Array liveInserts; + const auto fxCount=nativeAccepted_.fxOwners->insertCount(ch.id); + for(std::size_t slot=0;slotownerForControl( + ch.id,slot); + if(!lease||!*lease)continue; + auto item=std::make_unique(); + item->setProperty("instanceId",(*lease)->instanceId); + item->setProperty("id",(*lease)->catalogId); + item->setProperty("name",(*lease)->name); + item->setProperty("bypassed",(*lease)->bypassRequested.load( + std::memory_order_relaxed)); + liveInserts.add(juce::var(item.release())); + } + row->setProperty("inserts",juce::var(liveInserts)); if(pcmMeterValid && meterIndexsetProperty("peakL",static_cast( nativeMeterPeaksL_[meterIndex].load(std::memory_order_relaxed))); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 7a98bb183..c4f222e86 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -172,6 +172,24 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { Bank::Fault::none); assert(bank.lanes()==4&&bank.insertCount(ch11)==1&& bank.insertCount(bus)==1&&bank.insertCount(ret)==1); + // Production control transaction appends a NEW real vendor instance + // to CH11 without touching original CH1, Group or FX Return owners. + Bank expanded; + auto second=newFx(1.25f,"ch11-second-vst3"); + assert(Bank::appendOwned(epoch,3,bank,ch11,ProcessingFormat::mono, + second,expanded)==Bank::Fault::none); + assert(expanded.insertCount(ch11)==2); + assert(expanded.insertCount(ch1)==bank.insertCount(ch1)); + assert((*expanded.ownerForControl(ch11,0))->instanceId== + (*bank.ownerForControl(ch11,0))->instanceId); + assert((*expanded.ownerForControl(ch11,1))->instanceId==second->instanceId); + assert(Bank::appendOwned(epoch,2,bank,ch11,ProcessingFormat::mono, + second,expanded)==Bank::Fault::invalidEpoch); + assert(expanded.revision()==3); + assert(Bank::appendOwned(epoch,4,expanded,ch11,ProcessingFormat::mono, + second,bank)==Bank::Fault::duplicateInstance); + assert(bank.revision()==2); // rollback left original accepted rack intact + assert(bank.ownerForControl(ch1,0)&& (*bank.ownerForControl(ch1,0))->instanceId== original->insertInstanceId(0,0)); From 6cb754411fd4ab5f45ae6006a0788472a929baad Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:51:37 +0700 Subject: [PATCH 121/155] feat(native): connect catalog-approved VST3 load, bypass and vendor editor to one ChannelId PCM owner Route native plugin gestures through same revision/epoch/replay-protected ConsoleIntent ACK publisher; resolve only JUCE-scanned catalog entries on message thread, never browser paths. Insert swaps the single FX lease/PCM snapshot, bypass is atomic and editor receives the real prepared vendor instance. --- src/ConsoleLiveBridgeV6.h | 23 ++++++++++- src/Main.cpp | 81 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 100 insertions(+), 4 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index ed8a10940..b0ba65c15 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -539,10 +539,11 @@ class LiveConsoleBridgeV6 final { // changes, and readback comes from the newly accepted PCM publisher. // This is deliberately a SEPARATE legacyM4.nativeBus namespace rather // than claiming that universal CH11/WIRE/SHOW is available. - template + template juce::var processNativeBusIntent(const juce::var& intent, const juce::var& snapshot, - Engine& engine,bool ioBusy=false) { + Engine& engine,bool ioBusy, + NativeFxAction&& onNativeFx) { const auto req=intent.getProperty("requestId",juce::var()); const auto request=req.isString()?req.toString():juce::String(); const auto key=request.toStdString(); @@ -622,6 +623,24 @@ class LiveConsoleBridgeV6 final { } } } + else if(operation=="NATIVE_LOAD_INSERT" || + operation=="NATIVE_SET_INSERT_BYPASS" || + operation=="NATIVE_OPEN_INSERT_EDITOR") { + std::uint64_t target=0; + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),target) || + !target)error="INVALID_NATIVE_VST3_TARGET_ID"; + else { + // Native catalog ownership and VST3 instance preparation + // happen exclusively on the JUCE control thread. + const auto response=onNativeFx( + operation,armix::mixer::ChannelId{target},payload, + requestedEpoch,nativeRev,rosterRev); + applied=response.accepted; + if(!applied)error=response.error; + else {nativeRev=response.pcmRevision; + rosterRev=response.rosterRevision;} + } + } else if(operation=="NATIVE_SET_CHANNEL_MIX"|| operation=="NATIVE_SET_CHANNEL_MUTE_SOLO"){ std::uint64_t id=0; diff --git a/src/Main.cpp b/src/Main.cpp index 9429d1f0a..e505f085b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -204,7 +204,10 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr // ChannelId LIVE status before the M5 production cutover. if (args.getProperty("protocol","").toString()!="v6") return; consoleSubscribed_=true; - if (browser_.loaded) emitNativeConsoleSnapshot(engine_.status()); + if (browser_.loaded) { + emitNativeConsoleSnapshot(engine_.status()); + emitCatalog(); // native scanned catalog, never demo JSON + } }) .withEventListener ("arMixConsoleIntent", [this] (juce::var args) { // S1: actual installed JUCE production path, never a @@ -218,7 +221,81 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if(op.startsWith("NATIVE_")) ack=consoleBridge_.processNativeBusIntent( args,snapshot,engine_, - nativeShowBusy_||studioBackupBusy_); + nativeShowBusy_||studioBackupBusy_, + [this](const juce::String& operation, + armix::mixer::ChannelId channel, + const juce::var& payload,std::uint64_t epoch, + std::uint64_t pcmRev,std::uint64_t rosterRev) + ->LiveDryRoutingLab::NativeBusResult { + LiveDryRoutingLab::NativeBusResult reply{}; + reply.pcmRevision=pcmRev; + reply.rosterRevision=rosterRev; + if(nativeShowBusy_||studioBackupBusy_|| + engine_.isGraphSwitchPending()) { + reply.error="NATIVE_VST3_CONTROL_BUSY";return reply; + } + if(operation=="NATIVE_LOAD_INSERT"){ + const auto catalogId=payload.getProperty( + "catalogId",{}).toString(); + const auto* entry=catalog_.find(catalogId); + if(!entry || entry->key()!=catalogId) { + reply.error="NATIVE_VST3_NOT_SCANNED";return reply; + } + closePluginEditor(); + return engine_.installNativeVst3( + epoch,pcmRev,rosterRev,channel, + entry->path,entry->uid,entry->key()); + } + const auto slot=payload.getProperty("slot",juce::var()); + const auto token=payload.getProperty("instanceId", + juce::var()); + if(!slot.isInt()||static_cast(slot)<0|| + static_cast(slot)>=LiveDryRoutingLab::maxFxPerLane|| + !token.isString()||token.toString().isEmpty()) { + reply.error="NATIVE_VST3_SLOT_OR_TOKEN_INVALID"; + return reply; + } + const auto index=static_cast( + static_cast(slot)); + if(operation=="NATIVE_SET_INSERT_BYPASS"){ + const auto value=payload.getProperty( + "bypassed",juce::var()); + if(!value.isBool()){ + reply.error="NATIVE_VST3_BYPASS_INVALID"; + return reply; + } + reply.accepted=engine_.bypassNativeVst3( + epoch,pcmRev,channel,index, + token.toString(),static_cast(value)); + reply.error=reply.accepted?"":"NATIVE_VST3_STALE_BYPASS"; + return reply; + } + if(operation=="NATIVE_OPEN_INSERT_EDITOR"){ + const auto lease=engine_.leaseNativeVst3Editor( + epoch,pcmRev,channel,index,token.toString()); + if(!lease||!lease->processor){ + reply.error="NATIVE_VST3_STALE_EDITOR";return reply; + } + try { + auto* vendor=lease->processor->createEditorIfNeeded(); + if(!vendor){ + reply.error="NATIVE_VST3_NO_EDITOR";return reply; + } + closePluginEditor(); + routedEditorOwner_=lease; + routedEditorEpoch_=static_cast(epoch); + editorWindow_=std::make_unique( + lease->processor->getName(),vendor); + reply.accepted=true;reply.error=""; + return reply; + }catch(...){ + closePluginEditor(); + reply.error="NATIVE_VST3_EDITOR_FAILED";return reply; + } + } + reply.error="UNSUPPORTED_NATIVE_VST3_ACTION"; + return reply; + }); else ack=consoleBridge_.processProductionIntent( args,snapshot,engine_, [this](int lane,int slot,std::uint64_t epoch, From 628d1cf006a87c133aab80ce2bb2d027a5f1ece7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:53:25 +0700 Subject: [PATCH 122/155] feat(console): wire scanned native VST3 catalog and CH11 insert rack to real host F8 displays JUCE-scanned catalog only; dynamic ChannelId add queues NATIVE_LOAD_INSERT through native ACK and accepted snapshot, vendor instance/editor/bypass are real lease objects. Scanner runs on native worker. Preserve old M4 visual/readback paths but never load a browser fake. Test actual source/owner wiring in both Windows and Chromium. --- .github/workflows/p1-windows.yml | 1 + .github/workflows/ui-smoke.yml | 2 +- ...console_native_vst3_host_contract_test.mjs | 40 +++++++ web/console-native.js | 108 ++++++++++++++++-- 4 files changed, 143 insertions(+), 8 deletions(-) create mode 100644 tests/console_native_vst3_host_contract_test.mjs diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 9bb57a503..5984efce9 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -116,6 +116,7 @@ jobs: 'tests/direct_restore_recovery_contract_test.mjs' 'tests/native_artifact_packaging_contract_test.mjs' 'tests/console_native_stereo_operator_test.mjs' + 'tests/console_native_vst3_host_contract_test.mjs' 'tests/portable_workspace_contract_test.mjs' 'tests/plugin_vault_contract_test.mjs' 'tests/plugin_ui_contract_test.mjs' diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 475638a5f..6273b9c6b 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -65,7 +65,7 @@ jobs: node --check web/plugin-ui.js node --check web/mixer-io.js node --check web/mixer-layout.js - node --test tests/gui_workflow_contract_test.mjs tests/plugin_ui_contract_test.mjs tests/ci_workflow_efficiency_test.mjs tests/fx_drag_reorder_contract_test.mjs tests/mixer_io_operator_contract_test.mjs tests/mixer_shell_contract_test.mjs tests/console_native_stereo_operator_test.mjs + node --test tests/gui_workflow_contract_test.mjs tests/plugin_ui_contract_test.mjs tests/ci_workflow_efficiency_test.mjs tests/fx_drag_reorder_contract_test.mjs tests/mixer_io_operator_contract_test.mjs tests/mixer_shell_contract_test.mjs tests/console_native_stereo_operator_test.mjs tests/console_native_vst3_host_contract_test.mjs - name: Validate approved GUI checkpoint and single publisher run: python tests/gui_baseline_lock_test.py - name: Validate smart audio architecture handoff contract diff --git a/tests/console_native_vst3_host_contract_test.mjs b/tests/console_native_vst3_host_contract_test.mjs new file mode 100644 index 000000000..b1d5497e6 --- /dev/null +++ b/tests/console_native_vst3_host_contract_test.mjs @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Real host-only VST3 operator contract: no browser DSP or catalog fixture. +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {readFileSync} from 'node:fs'; +const get=f=>readFileSync(f,'utf8'); +const gui=get('web/console-native.js'),lab=get('src/LiveDryRoutingLab.h'); +const host=get('src/Main.cpp'),bridge=get('src/ConsoleLiveBridgeV6.h'); +const bank=get('engine/core/DynamicChannelFxLeaseBank.h'); +test('real native catalog and scoped Add VST3 are bound to accepted ChannelId',()=>{ + assert.match(gui,/addEventListener\('arMixCatalog'/); + assert.match(gui,/realCatalog= catalog/); + assert.match(gui,/data-real-plugin-id/); + assert.match(gui,/NATIVE_LOAD_INSERT/); + assert.match(gui,/data-open-native-fx/); + assert.match(gui,/catalogId:chosenPlugin\.dataset\.realPluginId/); + assert.match(host,/catalog_\.find\(catalogId\)/); + assert.match(host,/engine_\.installNativeVst3/); + assert.doesNotMatch(gui,/demoCatalog|Math\.sin\(|AudioContext/); +}); +test('control-thread vendor lease and one PCM publication are atomic',()=>{ + assert.match(bank,/static Fault appendOwned\(/); + assert.match(lab,/NativeBusResult attachNativeInsert\(/); + assert.match(lab,/DynamicChannelFxLeaseBank::appendOwned/); + assert.match(lab,/nativePublisher_\.commit\(/); + assert.match(lab,/nativeAccepted_\.fxOwners=std::move\(owner\)/); + assert.match(lab,/row->setProperty\("inserts"/); + assert.match(host,/NATIVE_VST3_NOT_SCANNED/); + assert.match(bridge,/operation=="NATIVE_LOAD_INSERT"/); +}); +test('real bypass and vendor editor retain immutable native instance identity',()=>{ + assert.match(gui,/NATIVE_SET_INSERT_BYPASS/); + assert.match(gui,/NATIVE_OPEN_INSERT_EDITOR/); + assert.match(gui,/slot,instanceId,bypassed/); + assert.match(bridge,/NATIVE_SET_INSERT_BYPASS/); + assert.match(host,/engine_\.bypassNativeVst3/); + assert.match(host,/engine_\.leaseNativeVst3Editor/); + assert.match(lab,/nativeAccepted_\.setFxBypass/); + assert.match(lab,/nativeAccepted_\.leaseFxEditor/); +}); diff --git a/web/console-native.js b/web/console-native.js index f92b23f2a..0ea2d32fc 100644 --- a/web/console-native.js +++ b/web/console-native.js @@ -10,6 +10,52 @@ const palette=['#1699cd','#b92e41','#cf6b1e','#b28c27','#34a544','#168762','#0e9 const pending=new Map(),lastValues=new Map(); let snapshot=null,rows=[],bank=0,selectedIds=new Set(),serial=0,lastSignature='',native=!!(api?.emitEvent&&api?.addEventListener); let controlsEnabled=false,focusNewChannel=false; +let realCatalog={items:[],scanning:false,message:''},nativeFxTarget=''; +function fxTarget(id){const row=rows.find(x=>x.id===String(id)); + return row&&row.nativeScoped&&['INPUT','GROUP'].includes(row.role)?row:null; +} +function renderNativeCatalog(){ + const items=Array.isArray(realCatalog?.items)?realCatalog.items:[]; + const term=(el('pluginSearch')?.value||'').trim().toLowerCase(); + const selectedCategory=el('pluginCategory')?.value||'all'; + const view=el('pluginView')?.value||'all'; + const matching=items.filter(x=>{ + if(!x||typeof x.id!=='string'||typeof x.name!=='string')return false; + if(selectedCategory!=='all'&& + !String(x.category||'').toLowerCase().includes(selectedCategory.toLowerCase())) + return false; + if(view==='favorites'&&!x.favorite)return false; + if(view==='recent'||view==='hidden')return false; // no fabricated history + return (x.name+' '+(x.vendor||'')).toLowerCase().includes(term); + }); + const results=el('pluginResults'); + if(results)results.innerHTML=matching.slice(0,64).map(x=> + '').join('')|| + '
No matching native VST3. Scan the installed plugin folders.
'; + if(el('pluginCount'))el('pluginCount').textContent= + (realCatalog.scanning?'SCANNING · ':'')+matching.length+' VERIFIED VST3'+ + (matching.length>64?' · SHOWING 64':''); + if(el('pluginScanStatus'))el('pluginScanStatus').textContent= + String(realCatalog.message||'Native catalog not scanned'); +} +function openNativeCatalog(id){ + const row=fxTarget(id); + if(!row||!opAvailable('NATIVE_LOAD_INSERT')){ + announce('Select a dynamic input or Group with native VST3 support',true);return; + } + nativeFxTarget=row.id; + if(el('pluginTarget'))el('pluginTarget').textContent='INSERT FX · '+row.name; + if(el('pluginBrowser'))el('pluginBrowser').hidden=false; + if(el('pluginsButton'))el('pluginsButton').setAttribute('aria-expanded','true'); + renderNativeCatalog(); + el('pluginSearch')?.focus(); +} +function closeNativeCatalog(){ + if(el('pluginBrowser'))el('pluginBrowser').hidden=true; + if(el('pluginsButton'))el('pluginsButton').setAttribute('aria-expanded','false'); + nativeFxTarget=''; +} const announce=(message,problem=false)=>{const n=el('info');if(n){n.textContent=message;n.style.color=problem?'#e2a5a5':'';}}; const opAvailable=op=>!!(snapshot?.productionCallbackLive? snapshot.graph?.capabilities?.supportedOps?.includes(op): @@ -52,7 +98,7 @@ function normalize(s){ patch?.portId||'',out:String(ch.primaryOutput||''), controls:{faderDb:20*Math.log10(Math.max(Number(ch.fader)||0,1e-6)), pan:(Number(ch.pan)||0)*100,mute:!!ch.mute,solo:!!ch.solo}, - fx:[],sends:ch.parallelSends||[],legacy:false,nativeScoped:true, + fx:ch.inserts||[],sends:ch.parallelSends||[],legacy:false,nativeScoped:true, measuredL:ch.peakL,measuredR:ch.peakR}); } } @@ -114,10 +160,13 @@ function nativeStrip(r){ const meterTick=[0,-6,-12,-18,-24,-36,-48,-60].map(v=>''+v+'').join(''); const gainTick=[10,0,-6,-12,-24,-36,-48,-60].map(v=>''+v+'').join(''); const format=String(r.format).toUpperCase()==='STEREO'?'STEREO':'MONO'; - const fx=(r.fx||[]).slice(0,8).map(slot=>{ + const fx=(r.fx||[]).slice(0,8).map((slot,index)=>{ const token=esc(slot.instanceId||slot.id||''); - return '
'+ - '
'; + const ownerAttrs=' data-insert="'+token+'" data-slot="'+index+'"'; + const editorOp=r.nativeScoped?'NATIVE_OPEN_INSERT_EDITOR':'OPEN_INSERT_EDITOR'; + const bypassOp=r.nativeScoped?'NATIVE_SET_INSERT_BYPASS':'SET_INSERT_BYPASS'; + return '
'+ + '
'; }).join(''); return '
'+ ''+ @@ -133,7 +182,10 @@ function nativeStrip(r){ '')+ '
'+ '
'+fx+ - '
'+ + ''+ '
SEND'+esc((r.sends||[]).length)+' native sends
'+ '
PAN'+Math.round(pan)+'
'+ '
'+ @@ -170,9 +222,12 @@ function render(){ if(el('nativeReturn'))el('nativeReturn').disabled=true; for(const [id,op] of [['addTrack','CREATE_CHANNEL'],['addBus','CREATE_GROUP'],['addFx','CREATE_FX_RETURN'],['clearCue','SET_CUE']]) if(el(id))el(id).disabled=!snapshot?.productionCallbackLive||!opAvailable(op); - for(const id of ['saveScene','recallScene','sceneSafe','sofToggle','pluginsButton','group','ungroup','copy','paste','pluginScan','pluginImport','pluginAddPath','routeParallel','routeOnly','wireMaster','wireMode']) + for(const id of ['saveScene','recallScene','sceneSafe','sofToggle','group','ungroup','copy','paste','pluginImport','pluginAddPath','routeParallel','routeOnly','wireMaster','wireMode']) if(el(id))el(id).disabled=true; - if(el('pluginBrowser'))el('pluginBrowser').hidden=true; + if(el('pluginsButton'))el('pluginsButton').disabled= + !native||!opAvailable('NATIVE_LOAD_INSERT')|| + !rows.some(r=>!!fxTarget(r.id)); + if(el('pluginScan'))el('pluginScan').disabled=!native; paintMeters(); } function paintMeters(){ @@ -265,6 +320,13 @@ function submitNode(n){ else if(op==='SET_MUTE'||op==='SET_SOLO')send(op,row,{enabled:!row.controls[op==='SET_MUTE'?'mute':'solo']}); else if(op==='OPEN_INSERT_EDITOR')send(op,row,{insertId:n.dataset.insert}); else if(op==='SET_INSERT_BYPASS')send(op,row,{insertId:n.dataset.insert,bypassed:n.dataset.bypassed!=='true'}); + else if(op==='NATIVE_OPEN_INSERT_EDITOR'||op==='NATIVE_SET_INSERT_BYPASS'){ + const slot=Number(n.dataset.slot),instanceId=n.dataset.insert; + if(!Number.isInteger(slot)||slot<0||slot>=8||!instanceId){ + announce('Native VST3 instance/slot is stale',true);return; + } + send(op,row,{slot,instanceId,bypassed:n.dataset.bypassed!=='true'}); + } } function accept(s){ if(!s||s.schemaVersion!==6)return; @@ -286,6 +348,7 @@ function ack(a){ const key=a?.requestId,op=pending.get(key); if(!op)return; pending.delete(key); + if(a.status==='ACCEPTED'&&op.op==='NATIVE_LOAD_INSERT')closeNativeCatalog(); if(a.status==='ACCEPTED' && (op.op==='NATIVE_CREATE_CHANNEL'||op.op==='CREATE_CHANNEL')) focusNewChannel=true; // navigate only after the next accepted native snapshot announce(a.status==='ACCEPTED'?op.op+' ACCEPTED · verifying native snapshot': @@ -300,6 +363,15 @@ document.addEventListener('change',e=>{ if(e.target.id==='densitySelect')document.querySelector('.console-body').dataset.density=e.target.value; }); document.addEventListener('click',e=>{ + const chosenPlugin=e.target.closest('[data-real-plugin-id]'); + if(chosenPlugin){ + const row=fxTarget(nativeFxTarget); + if(!row||!opAvailable('NATIVE_LOAD_INSERT')|| + snapshot?.device?.outputArmed){announce('MUTE OUTPUT and select native ChannelId FX rack',true);return;} + send('NATIVE_LOAD_INSERT',row,{catalogId:chosenPlugin.dataset.realPluginId});return; + } + const addFx=e.target.closest('[data-open-native-fx]'); + if(addFx){openNativeCatalog(addFx.dataset.openNativeFx);return;} const chosen=e.target.closest('[data-select-channel]'); if(chosen){ const id=chosen.dataset.selectChannel,row=rowFor(id); @@ -321,6 +393,24 @@ document.addEventListener('click',e=>{ if(section){const n=section.dataset.section,body=document.querySelector('.console-body'); body.classList.toggle('collapsed-'+n);section.setAttribute('aria-expanded',String(!body.classList.contains('collapsed-'+n)));} }); +document.getElementById('pluginsButton')?.addEventListener('click',()=>{ + const target=fxTarget(nativeFxTarget)||[...selectedIds].map(fxTarget).find(Boolean)|| + rows.find(r=>!!fxTarget(r.id)); + if(target){if(el('pluginBrowser')?.hidden)openNativeCatalog(target.id); + else closeNativeCatalog();} + else announce('Create or select a dynamic ChannelId before loading VST3',true); +}); +document.getElementById('pluginClose')?.addEventListener('click',closeNativeCatalog); +document.getElementById('pluginSearch')?.addEventListener('input',renderNativeCatalog); +document.getElementById('pluginCategory')?.addEventListener('change',renderNativeCatalog); +document.getElementById('pluginView')?.addEventListener('change',renderNativeCatalog); +document.getElementById('pluginScan')?.addEventListener('click',()=>{ + if(native)api.emitEvent('arMixAction',{action:'scanVst3'}); +}); +document.addEventListener('keydown',e=>{ + if(e.key==='F8'){e.preventDefault();el('pluginsButton')?.click();} + if(e.key==='Escape'&&!el('pluginBrowser')?.hidden)closeNativeCatalog(); +}); document.getElementById('nativeDevice')?.addEventListener('click',()=>{ if(!native)return; api.emitEvent('arMixAction',{action:'audioSetup'}); @@ -353,6 +443,10 @@ document.getElementById('nativeAddAudio')?.addEventListener('click',()=>{ }); for(const id of ['wireView','wireMode','sofTarget'])if(el(id))el(id).disabled=true; if(!native){announce('NATIVE JUCE BACKEND REQUIRED · NO SIMULATED AUDIO',true);return;} +api.addEventListener('arMixCatalog',catalog=>{ + realCatalog= catalog&&typeof catalog==='object'?catalog:{items:[],scanning:false}; + renderNativeCatalog(); +}); api.addEventListener('arMixConsoleSnapshot',accept); api.addEventListener('arMixConsoleAck',ack); api.addEventListener('arMixAudioArmAck',a=>{ From f90a895e340de0af5cd3f89d3a5eb61a9f14a148 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 05:56:52 +0700 Subject: [PATCH 123/155] test(vst3): account for third real native ChannelId bus-layout negotiation Keep legacy stereo layout and preset verification, and assert new native channel plugin path also uses same JUCE bus-layout negotiation. Earlier strict count of two incorrectly rejected implementing the third genuine producer. --- tests/fx_add_contract_test.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/fx_add_contract_test.mjs b/tests/fx_add_contract_test.mjs index 2b449ac4e..50a8d09a2 100644 --- a/tests/fx_add_contract_test.mjs +++ b/tests/fx_add_contract_test.mjs @@ -33,7 +33,11 @@ test('every ADD click identifies request and reports result inside the open sele assert.match(host,/FX_LOAD_FAIL/); }); test('plugin load and preset restore both negotiate existing VST3 bus layouts',()=>{ - assert.equal((dsp.match(/prepareStereoEffectLayout/g)||[]).length,2); + // Legacy ADD + preset restore + native dynamic ChannelId insert share one + // JUCE stereo layout negotiator; no extra fake plugin host is allowed. + assert.equal((dsp.match(/prepareStereoEffectLayout/g)||[]).length,3); + assert.match(dsp,/LiveDryRoutingLab::NativeBusResult installNativeVst3/); + assert.match(dsp,/dryRoutingLab_\.attachNativeInsert/); assert.match(layout,/if \(compatible \(original\)\) return \{\};/); assert.match(layout,/requested\.inputBuses\.set \(i, disabled\)/); assert.match(layout,/processor\.setBusesLayout \(requested\)/); From 53582746b6dcdc33efeb7823c8b8e7d154e94f44 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 06:04:00 +0700 Subject: [PATCH 124/155] fix(native-vst3): qualify dynamic ChannelEdit to repair MSVC C2039 compile failure Use armix::mixer::ChannelEdit when appending a prepared native VST3 insert to ChannelId roster, not the unrelated nested M4 ChannelEdit. Add a guard against the exact type-shadowing regression. Unblock compiled Windows Console + VST3 host FAT. --- src/LiveDryRoutingLab.h | 7 +++++-- tests/console_native_vst3_host_contract_test.mjs | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 6ba25498a..79157389b 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1146,9 +1146,12 @@ class LiveDryRoutingLab final { } try { auto next=nativeAccepted_.graph.roster; - ChannelEdit add;add.kind=ChannelEdit::Kind::addInsertReference; + // LiveDryRoutingLab also defines a legacy ChannelEdit; explicitly + // select the ChannelId roster action, not the M4 routing type. + armix::mixer::ChannelEdit add; + add.kind=armix::mixer::ChannelEdit::Kind::addInsertReference; add.id=target;add.text=catalogId.toStdString(); - const std::array edits{add}; + const std::array edits{add}; if(!next.edit(expectedRosterRevision,edits).ok()) { out.error="NATIVE_INSERT_CAPACITY_REJECTED";return out; } diff --git a/tests/console_native_vst3_host_contract_test.mjs b/tests/console_native_vst3_host_contract_test.mjs index b1d5497e6..cbedc638d 100644 --- a/tests/console_native_vst3_host_contract_test.mjs +++ b/tests/console_native_vst3_host_contract_test.mjs @@ -38,3 +38,11 @@ test('real bypass and vendor editor retain immutable native instance identity',( assert.match(lab,/nativeAccepted_\.setFxBypass/); assert.match(lab,/nativeAccepted_\.leaseFxEditor/); }); + +test('dynamic VST3 roster insert uses qualified ChannelId edit, never legacy M4 ChannelEdit',()=>{ + const physical=get('src/LiveDryRoutingLab.h'); + assert.match(physical,/armix::mixer::ChannelEdit add;/); + assert.match(physical,/armix::mixer::ChannelEdit::Kind::addInsertReference/); + assert.match(physical,/std::array edits/); + assert.doesNotMatch(physical,/\bChannelEdit add;add\.kind=ChannelEdit::Kind::addInsertReference/); +}); From 4db1825174aabc1f3d6f659520cbd74345a18e09 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 08:03:50 +0700 Subject: [PATCH 125/155] feat(native-wire): connect new Console OUT to actual ChannelId PCM routes Implement safe NATIVE_SET_PRIMARY_OUT with stable source/destination IDs, guard M4-owned inputs, restrict group/main and explicit disconnect, reject stale epoch/roster, prepare retained VST3 lease on control thread, compile cycle-free DAG, atomically publish single JUCE callback graph. GUI renders verified OUT sockets, emits native intent, and awaits accepted ACK/snapshot. --- src/ConsoleLiveBridgeV6.h | 16 +++++++++ src/LiveAudioEngine.h | 14 ++++++++ src/LiveDryRoutingLab.h | 70 +++++++++++++++++++++++++++++++++++++++ web/console-native.js | 37 +++++++++++++++------ 4 files changed, 127 insertions(+), 10 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index b0ba65c15..3b5d8daa3 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -680,6 +680,22 @@ class LiveConsoleBridgeV6 final { } } } + else if(operation=="NATIVE_SET_PRIMARY_OUT") { + std::uint64_t source=0,dest=0; + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),source)|| + !source||!decodeDecimal(payload.getProperty("destinationId",{}),dest)) + error="INVALID_NATIVE_WIRE_ENDPOINT"; + else { + const auto response=engine.setNativePrimaryOutput( + requestedEpoch,nativeRev,rosterRev, + armix::mixer::ChannelId{source}, + armix::mixer::ChannelId{dest}); + applied=response.accepted; + if(!applied)error=response.error; + else {nativeRev=response.pcmRevision; + rosterRev=response.rosterRevision;} + } + } else if(operation=="NATIVE_SET_BUS_MIX") { std::uint64_t target=0; const auto rawGain=payload.getProperty("gain",juce::var()); diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 994c8cae2..f3cfc002a 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1373,6 +1373,20 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback return dryRoutingLab_.patchNativeInputSource( epoch,pcmRevision,rosterRevision,channel,left,right,stereo,true); } + LiveDryRoutingLab::NativeBusResult setNativePrimaryOutput( + std::uint64_t ep,std::uint64_t pcmRev,std::uint64_t rosterRev, + armix::mixer::ChannelId src,armix::mixer::ChannelId dst) { + LiveDryRoutingLab::NativeBusResult fail; + fail.error="HARDWARE_NOT_DISARMED"; + if(independent_.active()||!attached_||!directFence_.permitted()|| + routeReconfiguring_.load(std::memory_order_acquire)|| + diagnosticRoute_.load(std::memory_order_acquire)!= + armix::diagnostics::Route::normal|| + !allOutputsDisarmed()||handoff_.busy()|| + fxMovePhase_.load(std::memory_order_acquire)!=0)return fail; + return dryRoutingLab_.setNativePrimaryOutput( + ep,pcmRev,rosterRev,src,dst,true); + } bool setNativeInputMix(std::uint64_t epoch,std::uint64_t rev, armix::mixer::ChannelId id,float gain,float pan) noexcept { if(independent_.active()||!directFence_.permitted()|| diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 79157389b..5eb0ad4ad 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1459,6 +1459,75 @@ class LiveDryRoutingLab final { reply.error="NATIVE_SOURCE_PREPARE_FAILED";return reply; } } + // CONTROL-only primary OUT/WIRE transaction: stable ChannelId routing, + // native graph DAG validation and immutable PCM publication. + NativeBusResult setNativePrimaryOutput(std::uint64_t ep, + std::uint64_t expectedPcmRev,std::uint64_t expectedRosterRev, + armix::mixer::ChannelId src,armix::mixer::ChannelId dst, + bool outputsDisarmed=false) { + using namespace armix::mixer; + NativeBusResult r{}; + r.pcmRevision=nativeAccepted_.pcmRevision; + r.rosterRevision=nativeAccepted_.graph.roster.revision(); + if(!outputsDisarmed){r.error="OUTPUT_MUST_BE_DISARMED";return r;} + if(!nativeStructureLive_||!channelIdPhysicalPcmActive()||!ready()|| + ep!=epoch()||nativeAccepted_.deviceEpoch!=ep|| + !nativeAccepted_.fxOwners|| + expectedPcmRev!=nativeAccepted_.pcmRevision|| + expectedRosterRev!=nativeAccepted_.graph.roster.revision())return r; + const auto* source=nativeAccepted_.graph.roster.find(src); + const auto* target=nativeAccepted_.graph.roster.find(dst); + if(!source||(source->role!=ChannelRole::input&& + source->role!=ChannelRole::group)|| + (dst.value&&(!target||(target->role!=ChannelRole::main&& + target->role!=ChannelRole::group)))||src==dst){ + r.error="INVALID_NATIVE_WIRE_ENDPOINT";return r; + } + for(const auto id:nativeAccepted_.graph.ids.inputs) + if(id==src){r.error="M4_INPUT_ROUTE_NOT_DYNAMIC";return r;} + if(originalM4Aux(src)){r.error="M4_AUX_ROUTE_NOT_DYNAMIC";return r;} + try { + auto roster=nativeAccepted_.graph.roster; + armix::mixer::ChannelEdit edit; + edit.kind=armix::mixer::ChannelEdit::Kind::setPrimaryOutput; + edit.id=src;edit.target=dst; + if(!roster.edit(expectedRosterRev, + std::span(&edit,1)).ok()){ + r.error="NATIVE_WIRE_ROUTE_REJECTED";return r; + } + DynamicChannelFxLeaseBank nextBank; + if(DynamicChannelFxLeaseBank::reuseRevision( + ep,expectedPcmRev+1,*nativeAccepted_.fxOwners,nextBank)!= + DynamicChannelFxLeaseBank::Fault::none){ + r.error="NATIVE_WIRE_FX_LEASE_REJECTED";return r; + } + auto owner=std::make_shared(std::move(nextBank)); + DynamicNativeSessionPublisher::FxPlan fx; + fx.owner=std::static_pointer_cast(owner); + fx.context=owner.get(); + fx.render=+[](void* ctx,ChannelId id,float* l,float* rr,int n) noexcept{ + (*static_cast(ctx))(id,l,rr,n); + }; + fx.deviceEpoch=ep;fx.graphRevision=expectedPcmRev+1; + const auto published=nativePublisher_.commit( + roster,nativeAccepted_.graph.request,expectedPcmRev, + ep,epoch(),true,std::move(fx)); + if(!published.ok()){ + r.error="NATIVE_WIRE_PCM_GRAPH_REJECTED";return r; + } + nativeAccepted_.graph.roster=std::move(roster); + nativeAccepted_.fxOwners=std::move(owner); + nativeAccepted_.pcmRevision=published.revision; + nativeMeterEpoch_.store(0,std::memory_order_release); + r.accepted=true;r.error=""; + r.pcmRevision=published.revision; + r.rosterRevision=nativeAccepted_.graph.roster.revision(); + return r; + }catch(...){ + r.error="NATIVE_WIRE_PREPARE_FAILED";return r; + } + } + // Live dynamic-input controls: one canonical ChannelId PCM callback, // no M4 ordinal alias, vendor reload or RT thread allocation. bool setNativeInputMix(std::uint64_t epochValue,std::uint64_t revision, @@ -1530,6 +1599,7 @@ class LiveDryRoutingLab final { for(const char* op: {"NATIVE_CREATE_GROUP_SELECTED", "NATIVE_REMOVE_BUS","NATIVE_SET_BUS_MIX", "NATIVE_CREATE_CHANNEL","NATIVE_PATCH_CHANNEL", + "NATIVE_SET_PRIMARY_OUT", "NATIVE_SET_CHANNEL_MIX", "NATIVE_SET_CHANNEL_MUTE_SOLO", "NATIVE_LOAD_INSERT","NATIVE_SET_INSERT_BYPASS", diff --git a/web/console-native.js b/web/console-native.js index 0ea2d32fc..0d636d876 100644 --- a/web/console-native.js +++ b/web/console-native.js @@ -138,12 +138,26 @@ function stereoSourceMarkup(row,attr){ '
'; } function outputOptions(row){ - let opts=['']; - for(const d of snapshot?.graph?.destinations||[]) - if(d.role==='GROUP'||d.role==='MAIN')opts.push(''); - return opts.join(''); + if(row.nativeScoped){ + // The only legal OUT sockets are real accepted Group/MAIN ChannelIds. + const channels=snapshot?.legacyM4?.nativeBus?.channels||[]; + const disconnected=!row.out||row.out==='0'; + const opts=['']; + for(const dest of channels){ + if(!['MAIN','GROUP'].includes(dest.role)||String(dest.id)===row.id)continue; + const id=String(dest.id); + opts.push(''); + } + return opts.join(''); + } + let opts=['']; + for(const d of snapshot?.graph?.destinations||[]) + if(d.role==='GROUP'||d.role==='MAIN')opts.push(''); + return opts.join(''); } + function nativeStrip(r){ const main=r.role==='MAIN',db=gain(r.controls.faderDb),pan=Number(r.controls.pan)||0; const can=op=>opAvailable(op)&&native&& @@ -152,7 +166,8 @@ function nativeStrip(r){ !(r.role==='FX_RETURN'&&['SET_FADER','SET_PAN','SET_MUTE','SET_SOLO'].includes(op))&& !(snapshot?.legacyM4?.nativeBus?.structural&& (op==='SET_PRIMARY_OUT'||op==='SET_PROCESSING_FORMAT'))&& - !(snapshot?.device?.outputArmed && op==='NATIVE_PATCH_CHANNEL'); + !(snapshot?.device?.outputArmed && + (op==='NATIVE_PATCH_CHANNEL'||op==='NATIVE_SET_PRIMARY_OUT')); const act=(op,attrs='')=>' data-op="'+op+'" data-id="'+esc(r.id)+'"'+attrs+ (can(op)?'':' disabled title="Requires native accepted operation"'); const role=main?'master':r.role==='GROUP'?'bus':r.role==='FX_RETURN'?'fx':'audio'; @@ -177,10 +192,8 @@ function nativeStrip(r){ ''): ''+(main?'SUM':'BUS RECEIVE')+'')+''+ '
OUT'+ - (r.nativeScoped?''+esc( - snapshot?.legacyM4?.nativeBus?.channels?.find(x=>String(x.id)===r.out)?.name||r.out||'MAIN')+'': - '')+ - '
'+ + ''+ '
'+fx+ '
Live MixerCH01 · click destination arrows10 audio tracks · 1 bus · master
-
+
'+ - '
SEND'+esc((r.sends||[]).length)+' native sends
'+ + '
SEND'+ + ''+esc((r.sends||[]).length)+' native sends'+ + '
'+ + '
'+ '
PAN'+Math.round(pan)+'
'+ '
'+ ''+ @@ -242,6 +247,7 @@ function render(){ !rows.some(r=>!!fxTarget(r.id)); if(el('pluginScan'))el('pluginScan').disabled=!native; paintMeters(); + scheduleWirePaint(); } function paintMeters(){ if(!snapshot)return; @@ -266,6 +272,74 @@ function paintMeters(){ } } } + +// WIRE paints accepted native ChannelId routes only, never the pending draft. +const svgNs='http://www.w3.org/2000/svg'; +function scheduleWirePaint(){ + if(wirePaintQueued)return; + wirePaintQueued=true; + requestAnimationFrame(()=>{wirePaintQueued=false;paintWires();}); +} +function wireNode(id,kind){ + return document.querySelector('.strip[data-id="'+CSS.escape(String(id))+'"] [data-wire-'+kind+']'); +} +function wirePoint(node,root){ + const a=node.getBoundingClientRect(),b=root.getBoundingClientRect(); + return {x:a.left+a.width/2-b.left,y:a.top+a.height/2-b.top}; +} +function wirePath(svg,d,color){ + const path=document.createElementNS(svgNs,'path'); + path.setAttribute('d',d);path.setAttribute('stroke',color); + path.setAttribute('stroke-width','2.4');path.setAttribute('fill','none'); + path.setAttribute('stroke-linecap','round'); + svg.appendChild(path);return path; +} +function wireColor(id){ + const r=rowFor(String(id)); + if(r?.role==='MAIN')return '#bc8997'; + if(r?.role==='GROUP')return '#cfac6b'; + return palette[(rows.indexOf(r)+palette.length)%palette.length]; +} +function paintWires(){ + const svg=el('wireLayer'),root=document.querySelector('.console-body'); + if(!svg||!root)return; + svg.setAttribute('viewBox','0 0 '+root.clientWidth+' '+root.clientHeight); + svg.replaceChildren(); + for(const r of rows){ + if(!r.nativeScoped||!['INPUT','GROUP'].includes(r.role)||!r.out||r.out==='0')continue; + const from=wireNode(r.id,'out');if(!from)continue; + const a=wirePoint(from,root),to=wireNode(r.out,'in'); + if(!to){wirePath(svg,'M'+a.x+' '+a.y+' q0 17 0 32',wireColor(r.id));continue;} + const b=wirePoint(to,root),mid=(a.x+b.x)/2,y=Math.max(a.y,b.y)+24; + wirePath(svg,'M'+a.x+' '+a.y+' C'+a.x+' '+y+' '+mid+' '+y+' '+mid+' '+y,wireColor(r.id)); + wirePath(svg,'M'+mid+' '+y+' C'+mid+' '+y+' '+b.x+' '+y+' '+b.x+' '+b.y,wireColor(r.out)); + } +} +function previewWire(e){ + if(!wireDrag||wireDrag.pointerId!==e.pointerId)return; + wireDrag.moved ||= Math.hypot(e.clientX-wireDrag.x,e.clientY-wireDrag.y)>8; + const root=document.querySelector('.console-body'),svg=el('wireLayer'); + const from=wireNode(wireDrag.id,'out');if(!root||!svg||!from)return; + const p=wirePoint(from,root),b=root.getBoundingClientRect(); + const x=e.clientX-b.left,y=e.clientY-b.top; + let path=svg.querySelector('[data-preview-wire]'); + if(!path){path=wirePath(svg,'',wireColor(wireDrag.id));path.dataset.previewWire='';} + path.setAttribute('d','M'+p.x+' '+p.y+' Q'+((p.x+x)/2)+' '+(Math.max(p.y,y)+25)+' '+x+' '+y); +} +function finishWire(e){ + if(!wireDrag||wireDrag.pointerId!==e.pointerId)return; + const d=wireDrag;wireDrag=null; + const socket=document.elementFromPoint(e.clientX,e.clientY)?.closest('[data-wire-in]'); + const dst=socket&&!socket.disabled?socket.dataset.wireIn:null; + scheduleWirePaint(); + const src=rowFor(d.id); + if(!d.moved||!src||!opAvailable('NATIVE_SET_PRIMARY_OUT'))return; + if(snapshot?.device?.outputArmed){announce('MUTE OUTPUT before WIRE edit',true);return;} + if(dst===src.id){announce('WIRE feedback forbidden',true);return;} + // Dropping a connected OUT cable outside a socket detaches the native route. + send('NATIVE_SET_PRIMARY_OUT',src,{destinationId:String(dst||'0')}); +} + function send(op,row,payload){ if(!api||!snapshot){announce('NATIVE ENGINE NOT CONNECTED',true);return;} if(!opAvailable(op)){announce(op+' NOT AVAILABLE IN INSTALLED AUDIO ENGINE',true);return;} @@ -458,6 +532,24 @@ document.getElementById('nativeAddAudio')?.addEventListener('click',()=>{ const format=el('nativeChannelFormat')?.value==='STEREO'?'STEREO':'MONO'; if(op)send(op,{id:'0',legacy:false},{name,format}); }); + +const wireOverlay=el('wireLayer'),wireContainer=document.querySelector('.console-body'); +if(wireOverlay&&wireContainer)wireContainer.appendChild(wireOverlay); +document.addEventListener('pointerdown',e=>{ + const socket=e.target.closest('[data-wire-out]'); + if(!socket||socket.disabled||!native||!opAvailable('NATIVE_SET_PRIMARY_OUT')|| + snapshot?.device?.outputArmed)return; + const src=rowFor(socket.dataset.wireOut); + if(!src||!['INPUT','GROUP'].includes(src.role))return; + wireDrag={id:src.id,x:e.clientX,y:e.clientY,pointerId:e.pointerId,moved:false}; + e.preventDefault(); +}); +window.addEventListener('pointermove',previewWire,{passive:true}); +window.addEventListener('pointerup',finishWire); +window.addEventListener('pointercancel',()=>{wireDrag=null;scheduleWirePaint();}); +window.addEventListener('resize',scheduleWirePaint,{passive:true}); +el('viewport')?.addEventListener('scroll',scheduleWirePaint,{passive:true}); + for(const id of ['wireView','wireMode','sofTarget'])if(el(id))el(id).disabled=true; if(!native){announce('NATIVE JUCE BACKEND REQUIRED · NO SIMULATED AUDIO',true);return;} api.addEventListener('arMixCatalog',catalog=>{ From e79d2e3c62828062472433c062679e3d143ab58b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 08:13:08 +0700 Subject: [PATCH 127/155] test(native-wire): verify actual PCM Group serial route, feedback rollback and OUT disconnect Exercise accepted DynamicChannelId PCM graph, not simulated UI: CH11->MAIN then CH11->Group->MAIN preserves amplitude; cycle attempt rejects without changing live graph or sound; OUT NONE mutes primary path; reconnect restores sound. Compiles under existing native Windows CTest target. --- tests/dynamic_accepted_session_test.cpp | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 7cb00f86e..7653d4a28 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -135,7 +135,73 @@ static void verifyRealtimeSlewAndNativeChannelIdContinuousControls() { session.pollRetirement(); } +// Native WIRE PCM regression: source OUT → Group → MAIN must be an +// exclusive serial route, not two dry feeds. Rejected feedback preserves the +// previous audible graph. Disconnect really removes primary audio. +static void verifyConsoleWirePrimaryOutputPcm() { + constexpr std::uint64_t epoch=9751; + constexpr float center=.7071067811865475f; + DynamicAcceptedSession session; + DynamicGraphRequest request; + request.physicalInputs=1;request.maxFrames=64; + const std::array created{ + add(0,ChannelRole::input,"CH11"), + add(1,ChannelRole::group,"VOICE GROUP",ProcessingFormat::stereo), + add(2,ChannelRole::main,"MAIN",ProcessingFormat::stereo) + }; + auto result=session.edit(0,0,created,request,epoch,epoch,true); + assert(result.ok()&&result.edit.createdIds.size()==3); + const auto ch=result.edit.createdIds[0]; + const auto group=result.edit.createdIds[1]; + const auto main=result.edit.createdIds[2]; + const std::array first{ + output(ch,main),output(group,main) + }; + request.sources={{ch,0,-1,false}}; + result=session.edit(1,1,first,request,epoch,epoch,true); + assert(result.ok()&&result.graphRevision==2); + std::array audio{},left{},right{}; + audio.fill(.35f); + const float* inputs[]{audio.data()}; + const auto noFx=+[](ChannelId,float*,float*,int) noexcept {}; + const auto render=[&]{ + return session.render(epoch,inputs,1,left.data(),right.data(),64,false,noFx); + }; + assert(render()&&near(left[63],.35f*center,1e-4f)); + const std::array routeGroup{output(ch,group)}; + result=session.edit(session.acceptedRosterRevision(),2,routeGroup, + request,epoch,epoch,true); + assert(result.ok()&&session.acceptedGraphRevision()==3); + const auto* graph=session.acceptedRouting(epoch,3); + assert(graph&&graph->find(ch)->primaryOutput==group); + assert(graph->find(group)->primaryOutput==main); + assert(render()&&near(left[63],.35f*center,1e-4f)); + + // Group -> CH11 while CH11 -> Group is cyclic. A rejected native + // publication must preserve CH11 -> Group -> MAIN and real PCM. + const std::array feedback{output(group,ch)}; + const auto rejected=session.edit(session.acceptedRosterRevision(),3, + feedback,request,epoch,epoch,true); + assert(!rejected.ok()&&session.acceptedGraphRevision()==3); + assert(session.acceptedRouting(epoch,3)->find(group)->primaryOutput==main); + assert(render()&&near(left[63],.35f*center,1e-4f)); + const std::array disconnected{output(ch,ChannelId{})}; + result=session.edit(session.acceptedRosterRevision(),3,disconnected, + request,epoch,epoch,true); + assert(result.ok()&&session.acceptedGraphRevision()==4); + assert(!session.acceptedRouting(epoch,4)->find(ch)->primaryOutput.value); + assert(render()&&near(left[63],0.f,1e-5f)); + // Reconnect to the same real Group, with exactly one primary route. + result=session.edit(session.acceptedRosterRevision(),4,routeGroup, + request,epoch,epoch,true); + assert(result.ok()&&session.acceptedGraphRevision()==5); + assert(render()&&near(left[63],.35f*center,1e-4f)); + session.unpublish(); + session.pollRetirement(); +} + int main() { + verifyConsoleWirePrimaryOutputPcm(); verifyRealtimeSlewAndNativeChannelIdContinuousControls(); constexpr std::uint64_t epoch=77; constexpr float center=.7071067811865475f; From f4957146ec8f0d0166ae4ce1bf1b3d5e4da86b6a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 08:23:16 +0700 Subject: [PATCH 128/155] fix(msvc): update native bridge CTest to five-argument real VST3 action contract Restore ARMixLiveChannelFxTests compilation by supplying explicit control busy state and fail-closed VST3 callback for routing tests, without weakening production signature. Add dynamic WIRE native ChannelId OUT intent mock and accepted ACK coverage. --- tests/live_channel_fx_graph_test.cpp | 48 +++++++++++++++++++++------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index c4f222e86..c0483d09b 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -957,6 +957,7 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { int liveMixes=0; int nativeInputCreates=0,nativeInputPatches=0; int nativeInputMixes=0,nativeInputToggles=0; + int nativeWireRoutes=0; Report createNativeInputChannel(std::uint64_t ep,std::uint64_t pcm, std::uint64_t roster,const std::string& name, ProcessingFormat format){ @@ -990,6 +991,12 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(id.value==18&&near(gain,.5f)&&near(pan,0.f)); ++liveMixes;return true; } + Report setNativePrimaryOutput(std::uint64_t ep,std::uint64_t pcm, + std::uint64_t roster,ChannelId src,ChannelId dst) { + assert(ep==9007199254740993ULL&&pcm==3&&roster==4); + assert(src.value==20&&dst.value==18); + ++nativeWireRoutes;return {true,{},4,5,""}; + } Report editNativeBus(std::uint64_t ep,std::uint64_t pcm, std::uint64_t roster,ChannelRole role, std::span selected, @@ -1003,6 +1010,14 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { return {true,{19},4,5,""}; } } busControl; + + // Control-thread test: no vendor VST3 effect required for routing. + const auto routeBusIntent=[&](const juce::var& intent) { + return bridge.processNativeBusIntent(intent,snap,busControl,false, + [](const juce::String&,ChannelId,const juce::var&, + std::uint64_t,std::uint64_t,std::uint64_t) + ->BusControl::Report { return {}; }); + }; const auto makeBusIntent=[&](const juce::String& req) { auto command=std::make_unique(); command->setProperty("requestId",req); @@ -1029,7 +1044,7 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { inputPayload->setProperty("format","MONO"); create.getDynamicObject()->setProperty( "payload",juce::var(inputPayload.release())); - auto inputAck=bridge.processNativeBusIntent(create,snap,busControl); + auto inputAck=routeBusIntent(create); assert(inputAck.getProperty("status","").toString()=="ACCEPTED"); assert(inputAck.getProperty("createdChannelId","").toString()=="20"); assert(busControl.nativeInputCreates==1); @@ -1041,7 +1056,7 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { patchPayload->setProperty("physicalRight",-1); patchPayload->setProperty("sourceFormat","MONO"); patch.getDynamicObject()->setProperty("payload",juce::var(patchPayload.release())); - inputAck=bridge.processNativeBusIntent(patch,snap,busControl); + inputAck=routeBusIntent(patch); assert(inputAck.getProperty("status","").toString()=="ACCEPTED"); assert(busControl.nativeInputPatches==1); auto inputMix=makeBusIntent("native:ch11:3"); @@ -1052,7 +1067,7 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { controlPayload->setProperty("pan",0.0); inputMix.getDynamicObject()->setProperty( "payload",juce::var(controlPayload.release())); - inputAck=bridge.processNativeBusIntent(inputMix,snap,busControl); + inputAck=routeBusIntent(inputMix); assert(inputAck.getProperty("status","").toString()=="ACCEPTED"); assert(busControl.nativeInputMixes==1); auto inputToggle=makeBusIntent("native:ch11:4"); @@ -1063,26 +1078,37 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { togglePayload->setProperty("mute",true);togglePayload->setProperty("solo",false); inputToggle.getDynamicObject()->setProperty( "payload",juce::var(togglePayload.release())); - inputAck=bridge.processNativeBusIntent(inputToggle,snap,busControl); + inputAck=routeBusIntent(inputToggle); assert(inputAck.getProperty("status","").toString()=="ACCEPTED"); assert(busControl.nativeInputToggles==1); - auto nativeAck=bridge.processNativeBusIntent( - makeBusIntent("native:bus:1"),snap,busControl); + auto nativeAck=routeBusIntent( + makeBusIntent("native:bus:1")); assert(nativeAck.getProperty("status","").toString()=="ACCEPTED"); assert(nativeAck.getProperty("graphRevision","").toString()=="0"); assert(nativeAck.getProperty("nativeGraphRevision","").toString()=="4"); assert(nativeAck.getProperty("nativeRosterRevision","").toString()=="5"); assert(nativeAck.getProperty("createdChannelId","").toString()=="19"); assert(busControl.commits==1); - nativeAck=bridge.processNativeBusIntent( - makeBusIntent("native:bus:1"),snap,busControl); + nativeAck=routeBusIntent( + makeBusIntent("native:bus:1")); assert(nativeAck.getProperty("errorCode","").toString()=="DUPLICATE_REQUEST_ID"); assert(busControl.commits==1); auto staleBus=makeBusIntent("native:bus:2"); staleBus.getDynamicObject()->setProperty("nativeGraphRevision","2"); - nativeAck=bridge.processNativeBusIntent(staleBus,snap,busControl); + nativeAck=routeBusIntent(staleBus); assert(nativeAck.getProperty("status","").toString()=="REJECTED"); assert(busControl.commits==1); + + auto wireIntent=makeBusIntent("native:wire:1"); + wireIntent.getDynamicObject()->setProperty("operation","NATIVE_SET_PRIMARY_OUT"); + wireIntent.getDynamicObject()->setProperty("targetChannelId","20"); + auto wirePayload=std::make_unique(); + wirePayload->setProperty("destinationId","18"); + wireIntent.getDynamicObject()->setProperty( + "payload",juce::var(wirePayload.release())); + const auto wireAck=routeBusIntent(wireIntent); + assert(wireAck.getProperty("status","").toString()=="ACCEPTED"); + assert(busControl.nativeWireRoutes==1); auto liveMixIntent=makeBusIntent("native:mix:1"); liveMixIntent.getDynamicObject()->setProperty( "operation","NATIVE_SET_BUS_MIX"); @@ -1092,8 +1118,8 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { mixPayload->setProperty("pan",0.0); liveMixIntent.getDynamicObject()->setProperty( "payload",juce::var(mixPayload.release())); - const auto mixAck=bridge.processNativeBusIntent( - liveMixIntent,snap,busControl); + const auto mixAck=routeBusIntent( + liveMixIntent); assert(mixAck.getProperty("status","").toString()=="ACCEPTED"); assert(busControl.liveMixes==1&&busControl.commits==1); // Fail-closed device fault: do not advertise a compatibility actuator From 96d2d306a832d1dd16908da344ebfc928bb9b155 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:11:47 +0700 Subject: [PATCH 129/155] fix(wire): canonical duplicate dry route rejection (#375) * fix(wire): reject dual PRE/POST dry edge per channel pair * test(wire): guard duplicate taps and retain accepted prepared graph --- engine/core/DynamicPreparedMixerBlock.h | 8 +++---- tests/dynamic_accepted_session_test.cpp | 28 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/engine/core/DynamicPreparedMixerBlock.h b/engine/core/DynamicPreparedMixerBlock.h index f71319d03..e9365f83a 100644 --- a/engine/core/DynamicPreparedMixerBlock.h +++ b/engine/core/DynamicPreparedMixerBlock.h @@ -299,13 +299,13 @@ class DynamicPreparedMixerBlock final { if(i==main) {error={DynamicGraphFault::mainFeedback,rows[i].id};return false;} if(i==monitor) {error={DynamicGraphFault::monitorFeedback,rows[i].id};return false;} if(to==i) {error={DynamicGraphFault::cycle,rows[i].id};return false;} - // A duplicate edge would sum the same send twice and can - // cause unexpectedly loud signal. Different taps are legal. + // WIRE-first MVP admits ONE audible edge per ordered pair. + // A legacy PRE + POST pair is still duplicate dry PCM, + // even when the tap flag differs. Reject before publication. const bool duplicate=std::any_of( outgoing[i].begin(),outgoing[i].end(), [&](const Edge& existing) { - return existing.destination==to && - existing.pre==send.preFader; + return existing.destination==to; }); if(duplicate) { error={DynamicGraphFault::duplicateSend,rows[i].id}; diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 7653d4a28..f9699bb46 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -201,6 +201,34 @@ static void verifyConsoleWirePrimaryOutputPcm() { } int main() { + + // WIRE-first regression: PRE and POST to the SAME destination are + // NOT two valid edges. Reject before accepting duplicate dry PCM. + // A failed compile must preserve the previous prepared graph. + { + DynamicChannelRoster roster; + const std::array create{ + add(0,ChannelRole::input,"WIRE SRC"), + add(1,ChannelRole::main,"MAIN",ProcessingFormat::stereo) + }; + const auto created=roster.edit(0,create); + assert(created.ok() && created.createdIds.size()==2); + const auto src=created.createdIds[0], dst=created.createdIds[1]; + const std::array first{output(src,dst)}; + assert(roster.edit(1,first).ok()); + DynamicGraphRequest request; + request.maxFrames=64; + DynamicPreparedMixerBlock block; + DynamicGraphError fault; + assert(DynamicPreparedMixerBlock::compile(roster,request,block,fault)); + assert(block.channelCount()==2); + const std::array duplicate{send(src,dst,.5f,true)}; + assert(roster.edit(2,duplicate).ok()); // legacy draft may still hold it + assert(!DynamicPreparedMixerBlock::compile(roster,request,block,fault)); + assert(fault.fault==DynamicGraphFault::duplicateSend); + assert(block.channelCount()==2); // previous prepared PCM untouched + } + verifyConsoleWirePrimaryOutputPcm(); verifyRealtimeSlewAndNativeChannelIdContinuousControls(); constexpr std::uint64_t epoch=77; From b6e992f989c9aabb0e0741a8dc215daeac0e605c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:16:49 +0700 Subject: [PATCH 130/155] feat(wire): stable EdgeId and atomic native WIRE transaction on existing roster --- engine/core/DynamicChannelRoster.h | 169 ++++++++++++++++++++++++++++- 1 file changed, 167 insertions(+), 2 deletions(-) diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index f05736a35..4c3e7331e 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -29,6 +29,7 @@ struct ChannelSendRef final { bool preFader=false; float pan=0.f; // send-only balance: PRE mono uses equal-power coefficients bool primaryOutput=false; // OUT selector edge, not a parallel SEND + std::uint64_t edgeId=0; // stable native identity; CONTROL-only assignment }; struct ChannelStripDefinition final { ChannelId id{}; @@ -51,7 +52,8 @@ struct ChannelRosterBudget final { enum class ChannelEditFault : std::uint8_t { none, staleRevision, invalidAction, missingChannel, invalidPosition, - invalidValue, budgetExceeded, linkedDestination, idExhausted + invalidValue, budgetExceeded, linkedDestination, idExhausted, + missingEdge, duplicateSend }; struct ChannelEdit final { enum class Kind : std::uint8_t { @@ -75,9 +77,18 @@ struct ChannelEditResult final { std::size_t actionIndex=0; std::uint64_t revision=0; std::vector createdIds; + std::vector createdEdgeIds; bool ok() const noexcept {return fault==ChannelEditFault::none;} }; +struct WireChange final { + enum class Kind : std::uint8_t {connect,remove,retarget,routeOnly}; + Kind kind=Kind::connect; + ChannelId from{},to{}; + std::uint64_t edgeId=0; + float gain=1.f; +}; + class DynamicChannelRoster final { public: explicit DynamicChannelRoster(ChannelRosterBudget budget={}) : budget_(budget) {} @@ -276,14 +287,132 @@ class DynamicChannelRoster final { // Structural edits are infrequent and prepared entirely on CONTROL. // Rebuild before acceptance: rejected/failed edits cannot leave the // active stable-ID map pointing into an old reordered vector. + std::uint64_t stagedNextEdge=nextEdgeId_; + if(!assignMissingEdgeIds(candidate,stagedNextEdge)) { + result.fault=ChannelEditFault::idExhausted; + result.createdIds.clear();return result; + } auto stagedIndex=buildIndex(candidate); channels_.swap(candidate); + nextEdgeId_=stagedNextEdge; index_.swap(stagedIndex); nextId_=next; result.revision=++revision_; return result; } + + // This is the only WIRE topology editor. Uses the SAME ChannelSendRef + // inventory as the native PCM compiler and existing source/FX ownership. + // The accepted session later compiles the whole DAG and publishes once. + ChannelEditResult wireTransaction( + std::uint64_t expectedRevision,std::span changes) { + ChannelEditResult result;result.revision=revision_; + if(expectedRevision!=revision_){result.fault=ChannelEditFault::staleRevision;return result;} + if(changes.empty() || revision_==std::numeric_limits::max()){ + result.fault=ChannelEditFault::invalidAction;return result; + } + auto candidate=channels_; // one CONTROL-thread batch copy + const auto main=std::find_if(candidate.begin(),candidate.end(), + [](const auto& ch){return ch.role==ChannelRole::main;}); + if(main==candidate.end()){result.fault=ChannelEditFault::invalidAction;return result;} + const ChannelId mainId=main->id; + std::uint64_t stagedNextEdge=nextEdgeId_; + if(!assignMissingEdgeIds(candidate,stagedNextEdge)){ + result.fault=ChannelEditFault::idExhausted;return result; + } + for(std::size_t i=0;irole==ChannelRole::main || source->role==ChannelRole::monitor){ + result.fault=ChannelEditFault::missingChannel;break; + } + auto& sends=source->sends; + if(op.kind==WireChange::Kind::remove || + op.kind==WireChange::Kind::retarget) { + const auto edge=std::find_if(sends.begin(),sends.end(), + [&](const auto& s){return s.edgeId==op.edgeId;}); + if(!op.edgeId || edge==sends.end()) { + result.fault=ChannelEditFault::missingEdge;break; + } + if(op.kind==WireChange::Kind::remove){sends.erase(edge);continue;} + if(!op.to.value || op.to==op.from || edge->destination==op.to){ + result.fault=ChannelEditFault::invalidValue;break; + } + edge->destination=op.to; // retain exact edgeId, gain and tap + continue; + } + if(op.kind!=WireChange::Kind::connect && + op.kind!=WireChange::Kind::routeOnly) { + result.fault=ChannelEditFault::invalidAction;break; + } + if(!op.to.value || op.to==op.from || !std::isfinite(op.gain) || + op.gain<0.f || op.gain>4.f || + (op.kind==WireChange::Kind::routeOnly && op.to==mainId)){ + result.fault=ChannelEditFault::invalidValue;break; + } + const bool already=std::any_of(sends.begin(),sends.end(), + [&](const auto& s){return s.destination==op.to;}); + if(already && op.kind==WireChange::Kind::connect){ + result.fault=ChannelEditFault::duplicateSend;break; + } + if(op.kind==WireChange::Kind::routeOnly){ + sends.erase(std::remove_if(sends.begin(),sends.end(), + [&](const auto& s){return s.destination==mainId;}), + sends.end()); + if(already)continue; // retain original edgeId/gain + } + if(sends.size()>=budget_.maximumSendsPerChannel){ + result.fault=ChannelEditFault::budgetExceeded;break; + } + const bool hasPrimary=std::any_of(sends.begin(),sends.end(), + [](const auto& s){return s.primaryOutput;}); + const bool primary=!hasPrimary && + (op.to==mainId || op.kind==WireChange::Kind::routeOnly); + sends.push_back({op.to,op.gain,false,0.f,primary,0}); + } + if(result.ok()){ + // Legacy PRE and primary edges share the same accepted graph. + // The PCM compiler also validates complete reachability/cycles. + std::unordered_map indexes; + for(std::size_t i=0;i destinations; + for(const auto& edge:row.sends){ + if(!indexes.count(edge.destination.value) || + row.id==edge.destination || + row.role==ChannelRole::main || row.role==ChannelRole::monitor){ + result.fault=ChannelEditFault::invalidValue;break; + } + if(!destinations.insert(edge.destination.value).second){ + result.fault=ChannelEditFault::duplicateSend;break; + } + } + } + if(result.ok() && !withinBudget(candidate)) + result.fault=ChannelEditFault::budgetExceeded; + } + if(!result.ok())return result; + if(!assignMissingEdgeIds(candidate,stagedNextEdge)){ + result.fault=ChannelEditFault::idExhausted;return result; + } + for(const auto& row:candidate) + for(const auto& edge:row.sends) + if(edge.edgeId>=nextEdgeId_) + result.createdEdgeIds.push_back(edge.edgeId); + auto stagedIndex=buildIndex(candidate); + channels_.swap(candidate); + index_.swap(stagedIndex); + nextEdgeId_=stagedNextEdge; + result.revision=++revision_; + return result; + } + // Studio Console Add Bus / Add FX Channel: allocate a fresh independent // stereo ChannelId, OUT -> MAIN, without borrowing an input or requiring // a selection. CONTROL only; native graph publication is separate. @@ -322,8 +451,14 @@ class DynamicChannelRoster final { // Structural edits are infrequent and prepared entirely on CONTROL. // Rebuild before acceptance: rejected/failed edits cannot leave the // active stable-ID map pointing into an old reordered vector. + std::uint64_t stagedNextEdge=nextEdgeId_; + if(!assignMissingEdgeIds(candidate,stagedNextEdge)) { + result.fault=ChannelEditFault::idExhausted; + result.createdIds.clear();return result; + } auto stagedIndex=buildIndex(candidate); channels_.swap(candidate); + nextEdgeId_=stagedNextEdge; index_.swap(stagedIndex);result.createdIds.push_back({nextId_++}); result.revision=++revision_;return result; } @@ -377,8 +512,14 @@ class DynamicChannelRoster final { // Structural edits are infrequent and prepared entirely on CONTROL. // Rebuild before acceptance: rejected/failed edits cannot leave the // active stable-ID map pointing into an old reordered vector. + std::uint64_t stagedNextEdge=nextEdgeId_; + if(!assignMissingEdgeIds(candidate,stagedNextEdge)) { + result.fault=ChannelEditFault::idExhausted; + result.createdIds.clear();return result; + } auto stagedIndex=buildIndex(candidate); channels_.swap(candidate); + nextEdgeId_=stagedNextEdge; index_.swap(stagedIndex); result.revision=++revision_;return result; } @@ -457,8 +598,14 @@ class DynamicChannelRoster final { // Structural edits are infrequent and prepared entirely on CONTROL. // Rebuild before acceptance: rejected/failed edits cannot leave the // active stable-ID map pointing into an old reordered vector. + std::uint64_t stagedNextEdge=nextEdgeId_; + if(!assignMissingEdgeIds(candidate,stagedNextEdge)) { + result.fault=ChannelEditFault::idExhausted; + result.createdIds.clear();return result; + } auto stagedIndex=buildIndex(candidate); channels_.swap(candidate); + nextEdgeId_=stagedNextEdge; index_.swap(stagedIndex); ++nextId_;result.revision=++revision_; result.createdIds.push_back(busId); @@ -466,6 +613,24 @@ class DynamicChannelRoster final { } private: + static bool assignMissingEdgeIds( + std::vector& rows,std::uint64_t& next) { + std::unordered_set used; + for(const auto& row:rows) + for(const auto& edge:row.sends) + if(edge.edgeId && !used.insert(edge.edgeId).second)return false; + for(auto& row:rows) + for(auto& edge:row.sends)if(!edge.edgeId){ + while(used.count(next)) { + if(next==std::numeric_limits::max())return false; + ++next; + } + if(!next || next==std::numeric_limits::max())return false; + edge.edgeId=next; + used.insert(next++); + } + return true; + } static std::unordered_map buildIndex( const std::vector& rows) { std::unordered_map index; @@ -506,6 +671,6 @@ class DynamicChannelRoster final { ChannelRosterBudget budget_; std::vector channels_; std::unordered_map index_; // CONTROL ONLY - std::uint64_t revision_=0, nextId_=1; + std::uint64_t revision_=0, nextId_=1, nextEdgeId_=1; }; } // namespace armix::mixer From 59a02b2fd22c98216235eb87ae2028bb08efc913 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:17:41 +0700 Subject: [PATCH 131/155] feat(wire): atomically publish native WIRE batch through existing accepted PCM session --- engine/core/DynamicAcceptedSession.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/engine/core/DynamicAcceptedSession.h b/engine/core/DynamicAcceptedSession.h index 64d9667d9..d7660b7a5 100644 --- a/engine/core/DynamicAcceptedSession.h +++ b/engine/core/DynamicAcceptedSession.h @@ -65,6 +65,30 @@ class DynamicAcceptedSession final { std::move(result),std::move(fx)); } + + // A single native structural operation over accepted ChannelSendRef. + // No JS DSP or independent router: same compiled PCM, routing readback, + // device epoch, revision and FX leases as all other native edit paths. + Result wireTransaction(std::uint64_t expectedRosterRevision, + std::uint64_t expectedGraphRevision, + std::span changes, + const DynamicGraphRequest& route, + std::uint64_t expectedDeviceEpoch, + std::uint64_t activeDeviceEpoch, + bool allOutputsDisarmed, + DynamicNativeSessionPublisher::FxPlan fx={}) { + Result result=preflight(expectedRosterRevision,expectedGraphRevision); + if(!result.ok())return result; + auto candidate=accepted_; + result.edit=candidate.wireTransaction(expectedRosterRevision,changes); + if(!result.edit.ok()) { + result.fault=Fault::editRejected;return result; + } + return publish(std::move(candidate),route,expectedGraphRevision, + expectedDeviceEpoch,activeDeviceEpoch,allOutputsDisarmed, + std::move(result),std::move(fx)); + } + // Studio Pro: one independent Bus ChannelId and automatic assignment of // selected primary OUTs; FX Return leaves those OUTs intact and adds sends. Result createBusForSelected(std::uint64_t expectedRosterRevision, From b359d2c3fc3ca0b5f8eccdf39d022a6c7e09fc28 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:17:44 +0700 Subject: [PATCH 132/155] feat(wire): project exact stable edge IDs from accepted native routing --- engine/core/DynamicConsoleRoutingView.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/engine/core/DynamicConsoleRoutingView.h b/engine/core/DynamicConsoleRoutingView.h index a610abbe3..29cf7b460 100644 --- a/engine/core/DynamicConsoleRoutingView.h +++ b/engine/core/DynamicConsoleRoutingView.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -18,6 +19,13 @@ struct ConsoleSendView final { ChannelId destination{}; float gain=1.f,pan=0.f; bool preFader=false; + std::uint64_t edgeId=0; +}; +struct ConsoleEdgeView final { + std::uint64_t edgeId=0; + ChannelId from{},to{}; + float gainLinear=1.f; + bool preFader=false,primaryOutput=false; }; struct ConsoleChannelView final { ChannelId id{}; @@ -40,6 +48,7 @@ class DynamicConsoleRoutingView final { public: std::uint64_t rosterRevision=0; std::vector channels; + std::vector edges; // exact native accepted graph, NOT a second graph ChannelId main{},monitor{}; const ConsoleChannelView* find(ChannelId id) const noexcept { const auto it=std::find_if(channels.begin(),channels.end(), @@ -73,11 +82,15 @@ class DynamicConsoleRoutingView final { next.channels.push_back(std::move(item)); } if(!next.main.value)return false; + std::unordered_set acceptedEdgeIds; for(std::size_t i=0;isecond]; if(link.primaryOutput) { if(sender.primaryOutput.value || link.preFader || @@ -87,7 +100,7 @@ class DynamicConsoleRoutingView final { destination.primarySources.push_back(sender.id); } else { sender.parallelSends.push_back( - {link.destination,link.gain,link.pan,link.preFader}); + {link.destination,link.gain,link.pan,link.preFader,link.edgeId}); // One source shown once in the Bus fan-in even if it has // multiple legal taps to that destination. if(std::find(destination.parallelSendSources.begin(), From a307831079ae6d05554fe590217cce4e92f0631a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:18:24 +0700 Subject: [PATCH 133/155] test(wire): native atomic MAIN detach, fan-out, 3-hop sample alignment and rollback --- tests/dynamic_accepted_session_test.cpp | 130 ++++++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index f9699bb46..15dd5fa7d 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -200,7 +200,137 @@ static void verifyConsoleWirePrimaryOutputPcm() { session.pollRetirement(); } + +// Native WIRE-first acceptance: exactly ONE immutable PCM graph owner. +// Direct, nested and reconvergent paths process within the SAME sample block; +// exact edgeId detach only affects its source, rejected DAG stays audible. +static void verifyAtomicWireTransactionAndZeroSampleHops() { + constexpr std::uint64_t epoch=9909; + constexpr float center=.7071067811865475f; + DynamicAcceptedSession session; + DynamicGraphRequest physical; + physical.physicalInputs=1;physical.maxFrames=64; + const std::array create{ + add(0,ChannelRole::input,"INPUT"), + add(1,ChannelRole::input,"SUM 1",ProcessingFormat::stereo), + add(2,ChannelRole::input,"SUM 2",ProcessingFormat::stereo), + add(3,ChannelRole::main,"MAIN",ProcessingFormat::stereo) + }; + auto a=session.edit(0,0,create,physical,epoch,epoch,true); + assert(a.ok() && a.edit.createdIds.size()==4); + const auto one=a.edit.createdIds[0],two=a.edit.createdIds[1]; + const auto three=a.edit.createdIds[2],main=a.edit.createdIds[3]; + physical.sources={{one,0,-1,false}}; + auto connect=[](ChannelId from,ChannelId to,float gain=1.f) { + WireChange w;w.kind=WireChange::Kind::connect;w.from=from; + w.to=to;w.gain=gain;return w; + }; + auto routeOnly=[](ChannelId from,ChannelId to) { + WireChange w;w.kind=WireChange::Kind::routeOnly; + w.from=from;w.to=to;return w; + }; + auto remove=[](ChannelId from,std::uint64_t id) { + WireChange w;w.kind=WireChange::Kind::remove; + w.from=from;w.edgeId=id;return w; + }; + const std::array initial{ + connect(one,main),connect(two,main),connect(three,main) + }; + a=session.wireTransaction(1,1,initial,physical,epoch,epoch,true); + assert(a.ok()&&a.graphRevision==2&&a.edit.createdEdgeIds.size()==3); + const auto* graph=session.acceptedRouting(epoch,2); + assert(graph&&graph->edges.size()==3); + const auto findEdge=[&](ChannelId from,ChannelId to, + std::uint64_t revision){ + const auto* current=session.acceptedRouting(epoch,revision); + assert(current); + const auto it=std::find_if(current->edges.begin(),current->edges.end(), + [&](const auto& edge){return edge.from==from && edge.to==to;}); + return it==current->edges.end()?std::uint64_t{0}:it->edgeId; + }; + const auto originalMain=findEdge(one,main,2); + const auto otherMain=findEdge(three,main,2); + assert(originalMain!=0 && otherMain!=0 && originalMain!=otherMain); + std::array impulse{},left{},right{}; + impulse[11]=.3f; + const float* inputs[]{impulse.data()}; + const auto noFx=+[](ChannelId,float*,float*,int) noexcept {}; + const auto render=[&]{ + return session.render(epoch,inputs,1,left.data(),right.data(),64, + false,noFx); + }; + assert(render() && near(left[11],.3f*center)); + for(int i=0;i<64;++i) + if(i!=11)assert(near(left[i],0.f)); + + const std::array hop1{routeOnly(one,two)}; + a=session.wireTransaction(2,2,hop1,physical,epoch,epoch,true); + assert(a.ok() && a.graphRevision==3); + assert(!findEdge(one,main,3) && findEdge(one,two,3)); + assert(render() && near(left[11],.3f*center)); + + const std::array hop2{routeOnly(two,three)}; + a=session.wireTransaction(3,3,hop2,physical,epoch,epoch,true); + assert(a.ok() && a.graphRevision==4); + const auto chainId=findEdge(one,two,4); + assert(chainId && !findEdge(two,main,4)); + assert(findEdge(three,main,4)==otherMain); + assert(render() && near(left[11],.3f*center)); + for(int i=0;i<64;++i) + if(i!=11)assert(near(left[i],0.f)); + + // A second real path doubles PCM only by explicit legal fan-out. + const std::array parallel{connect(one,main)}; + a=session.wireTransaction(4,4,parallel,physical,epoch,epoch,true); + assert(a.ok() && a.graphRevision==5); + const auto directId=findEdge(one,main,5); + assert(directId && directId!=originalMain); + assert(render() && near(left[11],2.f*.3f*center,1e-4f)); + const std::array unplug{remove(one,directId)}; + a=session.wireTransaction(5,5,unplug,physical,epoch,epoch,true); + assert(a.ok() && a.graphRevision==6); + assert(!findEdge(one,main,6) && findEdge(three,main,6)==otherMain); + assert(render() && near(left[11],.3f*center)); + + // Wrong edge identity cannot disconnect another source's MAIN. + const std::array wrongEdge{remove(one,otherMain)}; + auto rejected=session.wireTransaction(6,6,wrongEdge,physical,epoch,epoch,true); + assert(rejected.fault==DynamicAcceptedSession::Fault::editRejected); + assert(session.acceptedGraphRevision()==6); + assert(render() && near(left[11],.3f*center)); + const std::array duplicate{connect(one,two)}; + rejected=session.wireTransaction(6,6,duplicate,physical,epoch,epoch,true); + assert(rejected.fault==DynamicAcceptedSession::Fault::editRejected); + assert(session.acceptedGraphRevision()==6); + + // Mixed existing route cycle: whole native DAG compile must roll back. + const std::array feedback{connect(three,one)}; + rejected=session.wireTransaction(6,6,feedback,physical,epoch,epoch,true); + assert(rejected.fault==DynamicAcceptedSession::Fault::graphRejected); + assert(session.acceptedGraphRevision()==6); + assert(render() && near(left[11],.3f*center)); + rejected=session.wireTransaction(5,5,unplug,physical,epoch,epoch,true); + assert(rejected.fault==DynamicAcceptedSession::Fault::staleRoster); + assert(session.acceptedGraphRevision()==6); + rejected=session.wireTransaction(6,6,unplug,physical,epoch+1,epoch,true); + assert(rejected.fault==DynamicAcceptedSession::Fault::graphRejected); + assert(render() && near(left[11],.3f*center)); + + // RETARGET keeps identity and gain, not a new/ghost wire. + WireChange retarget; + retarget.kind=WireChange::Kind::retarget; + retarget.from=one;retarget.to=main;retarget.edgeId=chainId; + const std::array reroute{retarget}; + a=session.wireTransaction(6,6,reroute,physical,epoch,epoch,true); + assert(a.ok() && a.graphRevision==7); + assert(findEdge(one,main,7)==chainId && !findEdge(one,two,7)); + assert(render() && near(left[11],.3f*center)); + session.unpublish(); + session.pollRetirement(); +} + int main() { + verifyAtomicWireTransactionAndZeroSampleHops(); // WIRE-first regression: PRE and POST to the SAME destination are // NOT two valid edges. Reject before accepting duplicate dry PCM. From de5c4ac43bef0179c56910de90929f48bf568f54 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:24:30 +0700 Subject: [PATCH 134/155] feat(wire): apply canonical atomic WIRE to installed JUCE ChannelId PCM graph --- src/LiveDryRoutingLab.h | 82 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 5eb0ad4ad..f20bf5874 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1528,6 +1528,72 @@ class LiveDryRoutingLab final { } } + + // Real installed ChannelId PCM transaction. No alternate router: compile + // the accepted roster's SAME send inventory, lease the SAME native VST3 + // processors and publish once to the JUCE callback's existing publisher. + // M4 cannot represent arbitrary WIRE afterwards; never downgrade it. + NativeBusResult applyNativeWireTransaction( + std::uint64_t ep,std::uint64_t expectedPcmRev, + std::uint64_t expectedRosterRev, + std::span changes, + bool outputsDisarmed=false) { + using namespace armix::mixer; + NativeBusResult r{}; + r.pcmRevision=nativeAccepted_.pcmRevision; + r.rosterRevision=nativeAccepted_.graph.roster.revision(); + if(!outputsDisarmed){r.error="OUTPUT_MUST_BE_DISARMED";return r;} + if(!channelIdPhysicalPcmActive()||!ready()|| + ep!=epoch()||nativeAccepted_.deviceEpoch!=ep|| + !nativeAccepted_.fxOwners|| + expectedPcmRev!=nativeAccepted_.pcmRevision|| + expectedRosterRev!=nativeAccepted_.graph.roster.revision()) { + r.error="STALE_NATIVE_WIRE_GRAPH";return r; + } + if(changes.empty()||changes.size()>256){ + r.error="INVALID_NATIVE_WIRE_BATCH";return r; + } + try { + auto roster=nativeAccepted_.graph.roster; + const auto changed=roster.wireTransaction(expectedRosterRev,changes); + if(!changed.ok()){ + r.error="NATIVE_WIRE_TRANSACTION_REJECTED";return r; + } + DynamicChannelFxLeaseBank bank; + if(DynamicChannelFxLeaseBank::reuseRevision( + ep,expectedPcmRev+1,*nativeAccepted_.fxOwners,bank)!= + DynamicChannelFxLeaseBank::Fault::none){ + r.error="NATIVE_WIRE_FX_LEASE_REJECTED";return r; + } + auto owner=std::make_shared(std::move(bank)); + DynamicNativeSessionPublisher::FxPlan fx; + fx.owner=std::static_pointer_cast(owner); + fx.context=owner.get(); + fx.render=+[](void* ctx,ChannelId id,float* l,float* rr,int n) noexcept { + (*static_cast(ctx))(id,l,rr,n); + }; + fx.deviceEpoch=ep; + fx.graphRevision=expectedPcmRev+1; + const auto published=nativePublisher_.commit( + roster,nativeAccepted_.graph.request,expectedPcmRev, + ep,epoch(),true,std::move(fx)); + if(!published.ok()){ + r.error="NATIVE_WIRE_PCM_GRAPH_REJECTED";return r; + } + nativeAccepted_.graph.roster=std::move(roster); + nativeAccepted_.fxOwners=std::move(owner); + nativeAccepted_.pcmRevision=published.revision; + nativeStructureLive_=true; // never fall back to incompatible M4 + nativeMeterEpoch_.store(0,std::memory_order_release); + r.accepted=true;r.error=""; + r.pcmRevision=published.revision; + r.rosterRevision=nativeAccepted_.graph.roster.revision(); + return r; + }catch(...){ + r.error="NATIVE_WIRE_PREPARE_FAILED";return r; + } + } + // Live dynamic-input controls: one canonical ChannelId PCM callback, // no M4 ordinal alias, vendor reload or RT thread allocation. bool setNativeInputMix(std::uint64_t epochValue,std::uint64_t revision, @@ -1695,6 +1761,22 @@ class LiveDryRoutingLab final { rows.add(juce::var(row.release())); } state->setProperty("channels",juce::var(rows)); + juce::Array edges; + for(const auto& accepted:routing->edges) { + auto edge=std::make_unique(); + edge->setProperty("edgeId",juce::String( + std::to_string(accepted.edgeId))); + edge->setProperty("from",juce::String( + std::to_string(accepted.from.value))); + edge->setProperty("to",juce::String( + std::to_string(accepted.to.value))); + edge->setProperty("gainLinear", + static_cast(accepted.gainLinear)); + edge->setProperty("tap",accepted.preFader?"PRE_FADER":"POST_FADER"); + edge->setProperty("primaryOutput",accepted.primaryOutput); + edges.add(juce::var(edge.release())); + } + state->setProperty("edges",juce::var(edges)); return juce::var(state.release()); } From ca0fa075b92c8bd979daf9e112abc0c41f888014 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:25:16 +0700 Subject: [PATCH 135/155] feat(wire): route JUCE native intent into real ChannelId PCM publication --- src/LiveAudioEngine.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index f3cfc002a..4d90376ca 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1387,6 +1387,24 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback return dryRoutingLab_.setNativePrimaryOutput( ep,pcmRev,rosterRev,src,dst,true); } + // JUCE control-thread gateway to the already installed ChannelId renderer. + // No callback detach or alternate route ownership. Preserve device, + // original vendor VST3 leases and physical output-arm safety gates. + LiveDryRoutingLab::NativeBusResult applyNativeWireTransaction( + std::uint64_t ep,std::uint64_t pcmRev,std::uint64_t rosterRev, + std::span changes) { + LiveDryRoutingLab::NativeBusResult fail; + fail.error="HARDWARE_NOT_DISARMED"; + if(independent_.active()||!attached_||!directFence_.permitted()|| + routeReconfiguring_.load(std::memory_order_acquire)|| + diagnosticRoute_.load(std::memory_order_acquire)!= + armix::diagnostics::Route::normal|| + !allOutputsDisarmed()||handoff_.busy()|| + fxMovePhase_.load(std::memory_order_acquire)!=0) + return fail; + return dryRoutingLab_.applyNativeWireTransaction( + ep,pcmRev,rosterRev,changes,true); + } bool setNativeInputMix(std::uint64_t epoch,std::uint64_t rev, armix::mixer::ChannelId id,float gain,float pan) noexcept { if(independent_.active()||!directFence_.permitted()|| From 5bc08077553cf5fdc2bb760f1d728a1b13c24f24 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:25:52 +0700 Subject: [PATCH 136/155] feat(wire): strict native WebView WIRE batch decoding and epoch-fenced ACK --- src/ConsoleLiveBridgeV6.h | 65 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 3b5d8daa3..cd3ca4fcd 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -696,6 +696,71 @@ class LiveConsoleBridgeV6 final { rosterRev=response.rosterRevision;} } } + else if(operation=="NATIVE_APPLY_WIRE_TRANSACTION") { + using namespace armix::mixer; + const auto raw=payload.getProperty("changes",juce::var()); + const auto* list=raw.getArray(); + if(!list || list->isEmpty() || list->size()>256) + error="INVALID_NATIVE_WIRE_BATCH"; + else { + std::vector changes; + changes.reserve(static_cast(list->size())); + for(const auto& item:*list) { + if(!item.isObject()) { + error="INVALID_NATIVE_WIRE_CHANGE";break; + } + WireChange change; + const auto action=item.getProperty("op","").toString(); + if(action=="CONNECT")change.kind=WireChange::Kind::connect; + else if(action=="REMOVE")change.kind=WireChange::Kind::remove; + else if(action=="RETARGET")change.kind=WireChange::Kind::retarget; + else if(action=="ROUTE_ONLY")change.kind=WireChange::Kind::routeOnly; + else {error="INVALID_NATIVE_WIRE_ACTION";break;} + std::uint64_t source=0,dest=0,edge=0; + if(!decodeDecimal(item.getProperty("from",{}),source) || + source==0) { + error="INVALID_NATIVE_WIRE_SOURCE";break; + } + change.from={source}; + if(change.kind!=WireChange::Kind::remove) { + if(!decodeDecimal(item.getProperty("to",{}),dest) || + dest==0) { + error="INVALID_NATIVE_WIRE_DESTINATION";break; + } + change.to={dest}; + } + if(change.kind==WireChange::Kind::remove || + change.kind==WireChange::Kind::retarget) { + if(!decodeDecimal(item.getProperty("edgeId",{}),edge)|| + edge==0) { + error="INVALID_NATIVE_WIRE_EDGE_ID";break; + } + change.edgeId=edge; + } else { + const auto tap=item.getProperty("tap","POST_FADER").toString(); + const auto gain=item.getProperty("gainLinear",juce::var(1.)); + if(tap!="POST_FADER" || + !(gain.isDouble()||gain.isInt()) || + !std::isfinite(static_cast(gain)) || + static_cast(gain)<0. || + static_cast(gain)>4.) { + error="INVALID_NATIVE_WIRE_GAIN_OR_TAP";break; + } + change.gain=static_cast(static_cast(gain)); + } + changes.push_back(change); + } + if(error.isEmpty()) { + const auto response=engine.applyNativeWireTransaction( + requestedEpoch,nativeRev,rosterRev, + std::span(changes)); + applied=response.accepted; + if(!applied)error=response.error; + else {nativeRev=response.pcmRevision; + rosterRev=response.rosterRevision;} + } + } + } else if(operation=="NATIVE_SET_BUS_MIX") { std::uint64_t target=0; const auto rawGain=payload.getProperty("gain",juce::var()); From baeddf05853168a03810c1bcafec70fa58df7f8f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:26:13 +0700 Subject: [PATCH 137/155] feat(wire): advertise only installed scoped native WIRE transaction --- src/LiveDryRoutingLab.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index f20bf5874..8f4ae0825 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1666,6 +1666,7 @@ class LiveDryRoutingLab final { "NATIVE_REMOVE_BUS","NATIVE_SET_BUS_MIX", "NATIVE_CREATE_CHANNEL","NATIVE_PATCH_CHANNEL", "NATIVE_SET_PRIMARY_OUT", + "NATIVE_APPLY_WIRE_TRANSACTION", "NATIVE_SET_CHANNEL_MIX", "NATIVE_SET_CHANNEL_MUTE_SOLO", "NATIVE_LOAD_INSERT","NATIVE_SET_INSERT_BYPASS", From 6ee19f7515ddaef45a1cacd5f272899decec301a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:26:42 +0700 Subject: [PATCH 138/155] test(wire): native WebView batch ACK exact edge IDs and malformed intent rollback --- tests/live_channel_fx_graph_test.cpp | 61 +++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index c0483d09b..91f97c602 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -957,7 +957,7 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { int liveMixes=0; int nativeInputCreates=0,nativeInputPatches=0; int nativeInputMixes=0,nativeInputToggles=0; - int nativeWireRoutes=0; + int nativeWireRoutes=0,nativeWireBatches=0; Report createNativeInputChannel(std::uint64_t ep,std::uint64_t pcm, std::uint64_t roster,const std::string& name, ProcessingFormat format){ @@ -997,6 +997,19 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(src.value==20&&dst.value==18); ++nativeWireRoutes;return {true,{},4,5,""}; } + Report applyNativeWireTransaction(std::uint64_t ep, + std::uint64_t pcm,std::uint64_t roster, + std::span changes) { + assert(ep==9007199254740993ULL&&pcm==3&&roster==4); + assert(changes.size()==2); + assert(changes[0].kind==WireChange::Kind::remove); + assert(changes[0].from.value==20&&changes[0].edgeId==77); + assert(changes[1].kind==WireChange::Kind::connect); + assert(changes[1].from.value==20&&changes[1].to.value==18); + assert(near(changes[1].gain,.5f)); + ++nativeWireBatches; + return {true,{},4,5,""}; + } Report editNativeBus(std::uint64_t ep,std::uint64_t pcm, std::uint64_t roster,ChannelRole role, std::span selected, @@ -1109,6 +1122,52 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { const auto wireAck=routeBusIntent(wireIntent); assert(wireAck.getProperty("status","").toString()=="ACCEPTED"); assert(busControl.nativeWireRoutes==1); + // Same existing native bridge -> exact batch -> post-publication ACK. + // Legacy M4 revision remains separate; no false universal LIVE claim. + auto batch=makeBusIntent("native:wire:batch:1"); + batch.getDynamicObject()->setProperty( + "operation","NATIVE_APPLY_WIRE_TRANSACTION"); + juce::Array changes; + auto unplug=std::make_unique(); + unplug->setProperty("op","REMOVE"); + unplug->setProperty("from","20"); + unplug->setProperty("edgeId","77"); + changes.add(juce::var(unplug.release())); + auto connect=std::make_unique(); + connect->setProperty("op","CONNECT"); + connect->setProperty("from","20"); + connect->setProperty("to","18"); + connect->setProperty("tap","POST_FADER"); + connect->setProperty("gainLinear",.5); + changes.add(juce::var(connect.release())); + auto transaction=std::make_unique(); + transaction->setProperty("changes",juce::var(changes)); + batch.getDynamicObject()->setProperty( + "payload",juce::var(transaction.release())); + auto batchAck=routeBusIntent(batch); + assert(batchAck.getProperty("status","").toString()=="ACCEPTED"); + assert(batchAck.getProperty("nativeGraphRevision","").toString()=="4"); + assert(batchAck.getProperty("nativeRosterRevision","").toString()=="5"); + assert(busControl.nativeWireBatches==1); + batchAck=routeBusIntent(batch); + assert(batchAck.getProperty("errorCode","").toString()=="DUPLICATE_REQUEST_ID"); + assert(busControl.nativeWireBatches==1); + auto invalidBatch=makeBusIntent("native:wire:bad:2"); + invalidBatch.getDynamicObject()->setProperty( + "operation","NATIVE_APPLY_WIRE_TRANSACTION"); + auto malformed=std::make_unique(); + juce::Array badChanges; + auto bad=std::make_unique(); + bad->setProperty("op","REMOVE");bad->setProperty("from","020"); + bad->setProperty("edgeId","77"); + badChanges.add(juce::var(bad.release())); + malformed->setProperty("changes",juce::var(badChanges)); + invalidBatch.getDynamicObject()->setProperty( + "payload",juce::var(malformed.release())); + batchAck=routeBusIntent(invalidBatch); + assert(batchAck.getProperty("status","").toString()=="REJECTED"); + assert(batchAck.getProperty("errorCode","").toString()=="INVALID_NATIVE_WIRE_SOURCE"); + assert(busControl.nativeWireBatches==1); auto liveMixIntent=makeBusIntent("native:mix:1"); liveMixIntent.getDynamicObject()->setProperty( "operation","NATIVE_SET_BUS_MIX"); From d31f7c7c14e5e236e7f847e7ee9fd19dd900cb76 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:29:36 +0700 Subject: [PATCH 139/155] feat(wire): one-transaction default MAIN edge for new native channels --- engine/core/DynamicChannelRoster.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index 4c3e7331e..e3e669441 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -69,6 +69,7 @@ struct ChannelEdit final { bool enabled=false; // mute/solo value (or future enable operation) bool preFader=false; // send tap at construction, no hidden POST default bool primaryOutput=false; // exclusive OUT edge, independent of parallel SEND + bool connectMainOnCreate=false; // WIRE-first native creation; legacy imports unchanged float sendPan=0.f; // independent send PAN, never channel fader PAN std::string text; }; @@ -147,6 +148,7 @@ class DynamicChannelRoster final { } auto candidate=channels_; // one copy per BATCH, never in audio callback auto next=nextId_; + std::vector defaultMainOnCreate; const auto seek=[&candidate](ChannelId id){ return std::find_if(candidate.begin(),candidate.end(), [id](const auto& c){return c.id==id;}); @@ -179,6 +181,10 @@ class DynamicChannelRoster final { if(!validName(row.name)) {result.fault=ChannelEditFault::invalidValue;break;} candidate.insert(candidate.begin()+static_cast(op.position),std::move(row)); result.createdIds.push_back(candidate[op.position].id); + if(op.connectMainOnCreate && + candidate[op.position].role!=ChannelRole::main && + candidate[op.position].role!=ChannelRole::monitor) + defaultMainOnCreate.push_back(candidate[op.position].id); } else { auto it=seek(op.id); if(op.id.value==0 || it==candidate.end()) { @@ -282,6 +288,30 @@ class DynamicChannelRoster final { result.fault=ChannelEditFault::budgetExceeded;break; } } + // WIRE-first channel creation must connect MAIN exactly ONCE in the + // SAME batch/revision, even when MAIN was created later in this batch. + // Existing restored/disconnected channels are never auto-rewired. + if(result.ok() && !defaultMainOnCreate.empty()) { + const auto main=std::find_if(candidate.begin(),candidate.end(), + [](const auto& row){return row.role==ChannelRole::main;}); + if(main==candidate.end() || + std::count_if(candidate.begin(),candidate.end(), + [](const auto& row){return row.role==ChannelRole::main;})!=1) { + result.fault=ChannelEditFault::invalidValue; + } else { + const auto mainId=main->id; + for(const auto id:defaultMainOnCreate){ + auto row=seek(id); + if(row==candidate.end() || + row->sends.size()>=budget_.maximumSendsPerChannel){ + result.fault=ChannelEditFault::budgetExceeded;break; + } + const bool exists=std::any_of(row->sends.begin(),row->sends.end(), + [&](const auto& send){return send.destination==mainId;}); + if(!exists)row->sends.push_back({mainId,1.f,false,0.f,true,0}); + } + } + } if(result.ok() && !withinBudget(candidate))result.fault=ChannelEditFault::budgetExceeded; if(!result.ok()) {result.createdIds.clear();return result;} // Structural edits are infrequent and prepared entirely on CONTROL. From 7ec8c7763ab5bb9d7399241a38da7b3994a57d59 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:30:04 +0700 Subject: [PATCH 140/155] fix(wire): atomically create native input and MAIN edge in one accepted roster revision --- src/LiveDryRoutingLab.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 8f4ae0825..255b2f6d5 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1331,23 +1331,17 @@ class LiveDryRoutingLab final { if(main==existing.end()) { reply.error="NATIVE_MAIN_NOT_FOUND";return reply; } - const ChannelId mainId=main->id; armix::mixer::ChannelEdit add; add.kind=armix::mixer::ChannelEdit::Kind::add;add.role=ChannelRole::input; add.format=format;add.text=name; + add.connectMainOnCreate=true; // exact one real POST_FADER MAIN edge add.position=static_cast(main-existing.begin()); + // One accepted roster revision and ONE prepared PCM publication, + // not create + second independent OUT routing mutation. auto created=roster.edit(expectedRosterRevision, std::span(&add,1)); if(!created.ok()||created.createdIds.size()!=1) { - reply.error="CHANNEL_ROSTER_ADMISSION_REJECTED";return reply; - } - armix::mixer::ChannelEdit primary; - primary.kind=armix::mixer::ChannelEdit::Kind::setPrimaryOutput; - primary.id=created.createdIds.front();primary.target=mainId; - const auto connected=roster.edit(roster.revision(), - std::span(&primary,1)); - if(!connected.ok()) { - reply.error="CHANNEL_MAIN_ROUTING_REJECTED";return reply; + reply.error="CHANNEL_MAIN_ADMISSION_REJECTED";return reply; } DynamicChannelFxLeaseBank bank; if(DynamicChannelFxLeaseBank::reuseRevision( From b8ebf198310cfe6b38e09180f3fe0405a66166ed Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:30:31 +0700 Subject: [PATCH 141/155] test(wire): default MAIN edge created exactly once, saved disconnected channel remains disconnected --- tests/dynamic_accepted_session_test.cpp | 43 +++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 15dd5fa7d..2899da1c5 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -329,7 +329,50 @@ static void verifyAtomicWireTransactionAndZeroSampleHops() { session.pollRetirement(); } + +// New native channel = exactly one CH->MAIN edge in ONE accepted revision, +// even when MAIN appears later in the same initial transaction. Restoring +// an intentionally disconnected older channel never auto-repairs its route. +static void verifyDefaultNativeMainEdgeAndDisconnectedRestore() { + constexpr std::uint64_t epoch=9910; + DynamicAcceptedSession session; + DynamicGraphRequest physical; + physical.maxFrames=64; + auto source=add(0,ChannelRole::input,"NEW WIRE"); + source.connectMainOnCreate=true; + const auto main=add(1,ChannelRole::main,"MAIN",ProcessingFormat::stereo); + const std::array first{source,main}; + auto a=session.edit(0,0,first,physical,epoch,epoch,true); + assert(a.ok() && a.edit.createdIds.size()==2); + const auto ch=a.edit.createdIds[0],master=a.edit.createdIds[1]; + const auto* routing=session.acceptedRouting(epoch,1); + assert(routing && routing->edges.size()==1); + const auto id=routing->edges.front().edgeId; + assert(id && routing->edges.front().from==ch && + routing->edges.front().to==master && + routing->edges.front().primaryOutput && + routing->edges.front().gainLinear==1.f); + WireChange unplug;unplug.kind=WireChange::Kind::remove; + unplug.from=ch;unplug.edgeId=id; + const std::array batch{unplug}; + a=session.wireTransaction(1,1,batch,physical,epoch,epoch,true); + assert(a.ok() && a.graphRevision==2); + assert(session.acceptedRouting(epoch,2)->edges.empty()); + auto newer=add(1,ChannelRole::input,"NEWER WIRE"); + newer.connectMainOnCreate=true; + const std::array append{newer}; + a=session.edit(2,2,append,physical,epoch,epoch,true); + assert(a.ok() && a.edit.createdIds.size()==1); + routing=session.acceptedRouting(epoch,3); + assert(routing && routing->edges.size()==1); + assert(routing->edges.front().from==a.edit.createdIds.front()); + assert(routing->edges.front().to==master); + assert(routing->edges.front().edgeId!=id); + session.unpublish();session.pollRetirement(); +} + int main() { + verifyDefaultNativeMainEdgeAndDisconnectedRestore(); verifyAtomicWireTransactionAndZeroSampleHops(); // WIRE-first regression: PRE and POST to the SAME destination are From af2823b5ad0a355658f432c5253f57b5da486e47 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 14:45:50 +0700 Subject: [PATCH 142/155] test(wire): expose exact native feedback rejection fault without weakening gate --- tests/dynamic_accepted_session_test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index 2899da1c5..fe04e2bc2 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include using namespace armix::mixer; @@ -306,6 +307,13 @@ static void verifyAtomicWireTransactionAndZeroSampleHops() { // Mixed existing route cycle: whole native DAG compile must roll back. const std::array feedback{connect(three,one)}; rejected=session.wireTransaction(6,6,feedback,physical,epoch,epoch,true); + if(rejected.fault!=DynamicAcceptedSession::Fault::graphRejected) + std::fprintf(stderr,"WIRE feedback rejection diagnostic: acceptedFault=%u rosterFault=%u nativeFault=%u graphFault=%u revision=%llu\\n", + static_cast(rejected.fault), + static_cast(rejected.edit.fault), + static_cast(rejected.native.fault), + static_cast(rejected.native.graphError.fault), + static_cast(rejected.graphRevision)); assert(rejected.fault==DynamicAcceptedSession::Fault::graphRejected); assert(session.acceptedGraphRevision()==6); assert(render() && near(left[11],.3f*center)); From 4eeac29f262bab4ffb4280ca2fc8e34c1ad09ba6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 15:57:10 +0700 Subject: [PATCH 143/155] fix(wire): reject stale device before edits, preserve MAIN edge ID and rollback safety --- engine/core/DynamicAcceptedSession.h | 14 +++++- engine/core/DynamicChannelRoster.h | 15 +++++-- tests/dynamic_accepted_session_test.cpp | 59 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 4 deletions(-) diff --git a/engine/core/DynamicAcceptedSession.h b/engine/core/DynamicAcceptedSession.h index d7660b7a5..61cca950f 100644 --- a/engine/core/DynamicAcceptedSession.h +++ b/engine/core/DynamicAcceptedSession.h @@ -79,6 +79,15 @@ class DynamicAcceptedSession final { DynamicNativeSessionPublisher::FxPlan fx={}) { Result result=preflight(expectedRosterRevision,expectedGraphRevision); if(!result.ok())return result; + // Validate the hardware generation BEFORE inspecting draft edge IDs. + // A stale request may reference an edge removed by a newer device + // epoch; return the stronger device fault without touching the graph. + if(!expectedDeviceEpoch || expectedDeviceEpoch!=activeDeviceEpoch) { + result.fault=Fault::graphRejected; + result.native.fault=DynamicNativeSessionPublisher::Fault::staleDevice; + result.native.revision=publisher_.acceptedRevision(); + return result; + } auto candidate=accepted_; result.edit=candidate.wireTransaction(expectedRosterRevision,changes); if(!result.edit.ok()) { @@ -260,6 +269,7 @@ class DynamicAcceptedSession final { result.native.fault=DynamicNativeSessionPublisher::Fault::invalidCandidate; result.native.revision=publisher_.acceptedRevision(); result.edit.createdIds.clear(); + result.edit.createdEdgeIds.clear(); return result; } // A structural OUT/GROUP/Return edit does NOT implicitly change IN. @@ -284,6 +294,7 @@ class DynamicAcceptedSession final { result.native.graphError={DynamicGraphFault::invalidSource,source.id}; result.native.revision=publisher_.acceptedRevision(); result.edit.createdIds.clear(); + result.edit.createdEdgeIds.clear(); return result; // old audible SOURCE and VST3 leases unchanged } } @@ -294,7 +305,8 @@ class DynamicAcceptedSession final { std::move(fx)); if(!result.native.ok()) { result.fault=Fault::graphRejected; - result.edit.createdIds.clear(); // NEVER advertise phantom Bus + result.edit.createdIds.clear(); + result.edit.createdEdgeIds.clear(); // NEVER advertise phantom Bus return result; // candidate destroyed; accepted state intact } static_assert(std::is_nothrow_move_assignable_v); diff --git a/engine/core/DynamicChannelRoster.h b/engine/core/DynamicChannelRoster.h index e3e669441..3b435432d 100644 --- a/engine/core/DynamicChannelRoster.h +++ b/engine/core/DynamicChannelRoster.h @@ -268,9 +268,18 @@ class DynamicChannelRoster final { result.fault=ChannelEditFault::invalidValue;break; } auto& edges=it->sends; - edges.erase(std::remove_if(edges.begin(),edges.end(), - [](const auto& x){return x.primaryOutput;}),edges.end()); - if(op.target.value) { + const auto primary=std::find_if(edges.begin(),edges.end(), + [](const auto& edge){return edge.primaryOutput;}); + if(!op.target.value) { + if(primary!=edges.end())edges.erase(primary); + } else if(primary!=edges.end()) { + // Retarget the EXACT original physical cable; preserve + // stable edgeId instead of removing/recreating it. + primary->destination=op.target; + primary->gain=1.f; + primary->preFader=false; + primary->pan=0.f; + } else { if(edges.size()>=budget_.maximumSendsPerChannel) { result.fault=ChannelEditFault::budgetExceeded;break; } diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index fe04e2bc2..d7abee868 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -315,6 +315,7 @@ static void verifyAtomicWireTransactionAndZeroSampleHops() { static_cast(rejected.native.graphError.fault), static_cast(rejected.graphRevision)); assert(rejected.fault==DynamicAcceptedSession::Fault::graphRejected); + assert(rejected.edit.createdEdgeIds.empty()); // no phantom rejected ID assert(session.acceptedGraphRevision()==6); assert(render() && near(left[11],.3f*center)); rejected=session.wireTransaction(5,5,unplug,physical,epoch,epoch,true); @@ -322,6 +323,15 @@ static void verifyAtomicWireTransactionAndZeroSampleHops() { assert(session.acceptedGraphRevision()==6); rejected=session.wireTransaction(6,6,unplug,physical,epoch+1,epoch,true); assert(rejected.fault==DynamicAcceptedSession::Fault::graphRejected); + assert(rejected.native.fault==DynamicNativeSessionPublisher::Fault::staleDevice); + assert(rejected.edit.createdEdgeIds.empty()); + // A genuinely valid edge must also reject the wrong epoch before + // publication, irrespective of the edit's own validity. + const std::array validButStale{connect(one,main)}; + rejected=session.wireTransaction(6,6,validButStale,physical,epoch+1,epoch,true); + assert(rejected.fault==DynamicAcceptedSession::Fault::graphRejected); + assert(rejected.native.fault==DynamicNativeSessionPublisher::Fault::staleDevice); + assert(session.acceptedGraphRevision()==6); assert(render() && near(left[11],.3f*center)); // RETARGET keeps identity and gain, not a new/ghost wire. @@ -379,7 +389,56 @@ static void verifyDefaultNativeMainEdgeAndDisconnectedRestore() { session.unpublish();session.pollRetirement(); } +static void verifyPrimaryOutKeepsCanonicalEdgeIdentity() { + constexpr std::uint64_t epoch=9931; + DynamicAcceptedSession session; + DynamicGraphRequest physical; + physical.physicalInputs=1;physical.maxFrames=64; + const std::array first{ + add(0,ChannelRole::input,"SOURCE"), + add(1,ChannelRole::input,"INTERMEDIATE",ProcessingFormat::stereo), + add(2,ChannelRole::main,"MAIN",ProcessingFormat::stereo) + }; + auto a=session.edit(0,0,first,physical,epoch,epoch,true); + assert(a.ok()); + const auto src=a.edit.createdIds[0],via=a.edit.createdIds[1]; + const auto main=a.edit.createdIds[2]; + const std::array initial{output(src,main),output(via,main)}; + physical.sources={{src,0,-1,false}}; + a=session.edit(1,1,initial,physical,epoch,epoch,true); + assert(a.ok()); + const auto* accepted=session.acceptedRouting(epoch,2); + assert(accepted&&accepted->edges.size()==2); + const auto edgeId=accepted->edges[0].edgeId; + const auto viaId=accepted->edges[1].edgeId; + assert(edgeId!=0&&viaId!=0&&edgeId!=viaId); + std::array impulse{},left{},right{}; + impulse[19]=.25f; + const float* pins[]{impulse.data()}; + const auto noFx=+[](ChannelId,float*,float*,int) noexcept {}; + const auto render=[&] { + return session.render(epoch,pins,1,left.data(),right.data(),64,false,noFx); + }; + assert(render() && near(left[19],.25f*.7071067811865475f)); + const std::array same{output(src,main)}; + a=session.edit(2,2,same,physical,epoch,epoch,true); + assert(a.ok()); + assert(session.acceptedRouting(epoch,3)->edges[0].edgeId==edgeId); + assert(render() && near(left[19],.25f*.7071067811865475f)); + const std::array retarget{output(src,via)}; + a=session.edit(3,3,retarget,physical,epoch,epoch,true); + assert(a.ok()); + accepted=session.acceptedRouting(epoch,4); + assert(accepted->edges[0].edgeId==edgeId); + assert(accepted->edges[0].to==via); + assert(accepted->edges[1].edgeId==viaId); + assert(render() && near(left[19],.25f*.7071067811865475f)); + session.unpublish(); + session.pollRetirement(); +} + int main() { + verifyPrimaryOutKeepsCanonicalEdgeIdentity(); verifyDefaultNativeMainEdgeAndDisconnectedRestore(); verifyAtomicWireTransactionAndZeroSampleHops(); From de347b32123ee3523f2bc7d743631b752e1ce305 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 16:00:58 +0700 Subject: [PATCH 144/155] feat(wire): publish verified internal routing while output armed without device reconfigure --- engine/core/DynamicAcceptedSession.h | 29 ++++++++++++++++++--- engine/core/DynamicNativeSessionPublisher.h | 6 +++-- src/LiveAudioEngine.h | 6 ++--- src/LiveDryRoutingLab.h | 8 +++--- tests/dynamic_accepted_session_test.cpp | 14 +++++++++- 5 files changed, 50 insertions(+), 13 deletions(-) diff --git a/engine/core/DynamicAcceptedSession.h b/engine/core/DynamicAcceptedSession.h index 61cca950f..ec901f2d3 100644 --- a/engine/core/DynamicAcceptedSession.h +++ b/engine/core/DynamicAcceptedSession.h @@ -93,9 +93,31 @@ class DynamicAcceptedSession final { if(!result.edit.ok()) { result.fault=Fault::editRejected;return result; } + // Never trust an armed GUI candidate that quietly changes capture + // pins, DSP block capacity or device admission. Only pure internal + // edges can be published while hardware output is armed. + const bool samePhysical= + route.physicalInputs==acceptedRequest_.physicalInputs && + route.maxFrames==acceptedRequest_.maxFrames && + route.maxScratchBytes==acceptedRequest_.maxScratchBytes && + route.mainMonoAfterFx==acceptedRequest_.mainMonoAfterFx && + route.sources.size()==acceptedRequest_.sources.size() && + std::equal(route.sources.begin(),route.sources.end(), + acceptedRequest_.sources.begin(), + [](const DynamicSourcePatch& lhs,const DynamicSourcePatch& rhs) { + return lhs.id==rhs.id && lhs.inputL==rhs.inputL && + lhs.inputR==rhs.inputR && lhs.stereo==rhs.stereo; + }); + if(!allOutputsDisarmed && !samePhysical) { + result.fault=Fault::graphRejected; + result.native.fault=DynamicNativeSessionPublisher::Fault::outputArmed; + result.native.revision=publisher_.acceptedRevision(); + result.edit.createdEdgeIds.clear(); + return result; + } return publish(std::move(candidate),route,expectedGraphRevision, expectedDeviceEpoch,activeDeviceEpoch,allOutputsDisarmed, - std::move(result),std::move(fx)); + std::move(result),std::move(fx),samePhysical); } // Studio Pro: one independent Bus ChannelId and automatic assignment of @@ -254,7 +276,8 @@ class DynamicAcceptedSession final { std::uint64_t previousGraphRevision, std::uint64_t requestedEpoch,std::uint64_t currentEpoch, bool outputsDisarmed,Result&& result, - DynamicNativeSessionPublisher::FxPlan fx) { + DynamicNativeSessionPublisher::FxPlan fx, + bool verifiedInternalWireOnly=false) { // Existing SOURCE targets belong to the accepted native session. // For already-patched ChannelIds with the same input format, ignore // stale physical pin ordinals supplied by an old GUI draft during @@ -302,7 +325,7 @@ class DynamicAcceptedSession final { const bool nextHasFx=static_cast(fx.owner); result.native=publisher_.commit(candidate,effective,previousGraphRevision, requestedEpoch,currentEpoch,outputsDisarmed, - std::move(fx)); + std::move(fx),verifiedInternalWireOnly); if(!result.native.ok()) { result.fault=Fault::graphRejected; result.edit.createdIds.clear(); diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index 0574f9753..c767600af 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -68,7 +68,7 @@ class DynamicNativeSessionPublisher final { std::uint64_t proposedDeviceEpoch, std::uint64_t activeDeviceEpoch, bool allOutputsDisarmed, - FxPlan fx={}) { + FxPlan fx={},bool verifiedInternalWireOnly=false) { CommitResult report;report.revision=publisher_.lastRevision(); if(!fx.valid() || (fx.owner && (fx.deviceEpoch!=proposedDeviceEpoch || @@ -83,7 +83,9 @@ class DynamicNativeSessionPublisher final { expectedRevision==std::numeric_limits::max()) { report.fault=Fault::staleRevision;return report; } - if(!allOutputsDisarmed) { + // Only the canonical native WIRE owner may attest unchanged + // physical patch / device epoch. Other structural edits disarm. + if(!allOutputsDisarmed && !verifiedInternalWireOnly) { report.fault=Fault::outputArmed;return report; } auto next=std::make_unique(); diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 4d90376ca..20bc4039e 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1394,16 +1394,16 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback std::uint64_t ep,std::uint64_t pcmRev,std::uint64_t rosterRev, std::span changes) { LiveDryRoutingLab::NativeBusResult fail; - fail.error="HARDWARE_NOT_DISARMED"; + fail.error="NATIVE_WIRE_DEVICE_NOT_READY"; if(independent_.active()||!attached_||!directFence_.permitted()|| routeReconfiguring_.load(std::memory_order_acquire)|| diagnosticRoute_.load(std::memory_order_acquire)!= armix::diagnostics::Route::normal|| - !allOutputsDisarmed()||handoff_.busy()|| + handoff_.busy()|| fxMovePhase_.load(std::memory_order_acquire)!=0) return fail; return dryRoutingLab_.applyNativeWireTransaction( - ep,pcmRev,rosterRev,changes,true); + ep,pcmRev,rosterRev,changes); } bool setNativeInputMix(std::uint64_t epoch,std::uint64_t rev, armix::mixer::ChannelId id,float gain,float pan) noexcept { diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 255b2f6d5..a2b18e1ed 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1530,13 +1530,13 @@ class LiveDryRoutingLab final { NativeBusResult applyNativeWireTransaction( std::uint64_t ep,std::uint64_t expectedPcmRev, std::uint64_t expectedRosterRev, - std::span changes, - bool outputsDisarmed=false) { + std::span changes) { using namespace armix::mixer; NativeBusResult r{}; r.pcmRevision=nativeAccepted_.pcmRevision; r.rosterRevision=nativeAccepted_.graph.roster.revision(); - if(!outputsDisarmed){r.error="OUTPUT_MUST_BE_DISARMED";return r;} + // This method has NO physical request argument. Always publish + // the previously accepted identical source/clock configuration. if(!channelIdPhysicalPcmActive()||!ready()|| ep!=epoch()||nativeAccepted_.deviceEpoch!=ep|| !nativeAccepted_.fxOwners|| @@ -1570,7 +1570,7 @@ class LiveDryRoutingLab final { fx.graphRevision=expectedPcmRev+1; const auto published=nativePublisher_.commit( roster,nativeAccepted_.graph.request,expectedPcmRev, - ep,epoch(),true,std::move(fx)); + ep,epoch(),false,std::move(fx),true); if(!published.ok()){ r.error="NATIVE_WIRE_PCM_GRAPH_REJECTED";return r; } diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index d7abee868..ac6a740de 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -265,7 +265,7 @@ static void verifyAtomicWireTransactionAndZeroSampleHops() { if(i!=11)assert(near(left[i],0.f)); const std::array hop1{routeOnly(one,two)}; - a=session.wireTransaction(2,2,hop1,physical,epoch,epoch,true); + a=session.wireTransaction(2,2,hop1,physical,epoch,epoch,false); // live PCM routing while armed assert(a.ok() && a.graphRevision==3); assert(!findEdge(one,main,3) && findEdge(one,two,3)); assert(render() && near(left[11],.3f*center)); @@ -318,6 +318,18 @@ static void verifyAtomicWireTransactionAndZeroSampleHops() { assert(rejected.edit.createdEdgeIds.empty()); // no phantom rejected ID assert(session.acceptedGraphRevision()==6); assert(render() && near(left[11],.3f*center)); + // Preserve output safety: the same WIRE edit with a changed hardware + // block budget is rejected BEFORE the native PCM graph is published. + DynamicGraphRequest changedPhysical=physical; + changedPhysical.maxFrames=128; + const std::array validTopology{connect(two,main)}; + rejected=session.wireTransaction(6,6,validTopology,changedPhysical, + epoch,epoch,false); + assert(rejected.fault==DynamicAcceptedSession::Fault::graphRejected); + assert(rejected.native.fault==DynamicNativeSessionPublisher::Fault::outputArmed); + assert(rejected.edit.createdEdgeIds.empty()); + assert(session.acceptedGraphRevision()==6); + assert(render() && near(left[11],.3f*center)); rejected=session.wireTransaction(5,5,unplug,physical,epoch,epoch,true); assert(rejected.fault==DynamicAcceptedSession::Fault::staleRoster); assert(session.acceptedGraphRevision()==6); From d7a4ab75470fe4b3f802e805968fa31d43ca2f2e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 16:58:23 +0700 Subject: [PATCH 145/155] feat(wire): v8 APPLY_WIRE_TRANSACTION and accepted native EdgeId graph via existing bridge --- src/ConsoleLiveBridgeV6.h | 95 ++++++++++++++++++++++++---- src/Main.cpp | 2 +- tests/live_channel_fx_graph_test.cpp | 72 +++++++++++++++++++++ 3 files changed, 154 insertions(+), 15 deletions(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index cd3ca4fcd..a670ad40f 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -161,6 +161,38 @@ class LiveConsoleBridgeV6 final { const auto bus=route.getProperty("nativeBus",juce::var()); if(native && bus.isObject()) { object->setProperty("nativeBus",bus); + // Native PCM is the only source of exact ChannelIds, + // EdgeIds and accepted revision for the v8 projection. + const auto channels=bus.getProperty("channels",{}); + const auto edges=bus.getProperty("edges",{}); + const auto rev=bus.getProperty("graphRevision",{}); + const auto roster=bus.getProperty("rosterRevision",{}); + const auto nativeOps=bus.getProperty("supportedOps",{}); + std::uint64_t graphId=0,rosterId=0; + const auto* ops=nativeOps.getArray(); + if(channels.isArray() && edges.isArray() && ops && + ops->contains(juce::var(juce::String( + "NATIVE_APPLY_WIRE_TRANSACTION"))) && + decodeDecimal(rev,graphId) && graphId && + decodeDecimal(roster,rosterId) && rosterId) { + const auto graph=actual.getProperty("graph",{}); + if(auto* accepted=graph.getDynamicObject()) { + accepted->setProperty("revision",rev); + accepted->setProperty("rosterRevision",roster); + accepted->setProperty("channels",channels); + accepted->setProperty("edges",edges); + const auto capabilities=graph.getProperty("capabilities",{}); + if(auto* caps=capabilities.getDynamicObject()) { + caps->setProperty("callbackOwnsChannelIds",true); + juce::Array available; + available.add(juce::var(juce::String( + "APPLY_WIRE_TRANSACTION"))); + caps->setProperty("supportedOps",juce::var(available)); + } + } + } + // Full product-LIVE remains gated on VST3/Show/monitor + // parity and measured hardware FAT (#15). } // Separate namespace: these operations mutate the one // INSTALLED M4 JUCE PCM graph. They are NEVER universal @@ -566,25 +598,58 @@ class LiveConsoleBridgeV6 final { } recentIds_.push_back(key);completed_.insert(key); const auto operation=intent.getProperty("operation","").toString(); + const bool v8Wire=operation=="APPLY_WIRE_TRANSACTION"; const auto payload=intent.getProperty("payload",juce::var()); + // One existing decoder, one native candidate, one PCM publisher. + const auto baseGraph=v8Wire?intent.getProperty("baseGraphRevision",{}) + :intent.getProperty("nativeGraphRevision",{}); + const auto baseRoster=v8Wire?intent.getProperty("baseRosterRevision",{}) + :intent.getProperty("nativeRosterRevision",{}); + const auto legacyBase=v8Wire?legacy.getProperty("routingRevision",{}) + :intent.getProperty("legacyRoutingRevision",{}); if(ioBusy)error="NATIVE_SHOW_OR_BACKUP_BUSY"; else if(!decodeDecimal(intent.getProperty("deviceEpoch",{}),requestedEpoch) || - !decodeDecimal(intent.getProperty("legacyRoutingRevision",{}),legacyRevision) || - !decodeDecimal(intent.getProperty("nativeGraphRevision",{}),nativeRev) || - !decodeDecimal(intent.getProperty("nativeRosterRevision",{}),rosterRev) || + !decodeDecimal(legacyBase,legacyRevision) || + !decodeDecimal(baseGraph,nativeRev) || + !decodeDecimal(baseRoster,rosterRev) || intent.getProperty("deviceEpoch","").toString()!=epoch || - intent.getProperty("legacyRoutingRevision","").toString()!= - legacy.getProperty("routingRevision","").toString()) + legacyBase.toString()!=legacy.getProperty("routingRevision","").toString()) error="STALE_NATIVE_BUS_DEVICE_OR_ROUTE"; else if(!bus.isObject() || - bus.getProperty("graphRevision","").toString()!= - intent.getProperty("nativeGraphRevision","").toString() || - bus.getProperty("rosterRevision","").toString()!= - intent.getProperty("nativeRosterRevision","").toString() || + bus.getProperty("graphRevision","").toString()!=baseGraph.toString() || + bus.getProperty("rosterRevision","").toString()!=baseRoster.toString() || legacy.getProperty("controlPlane","").toString()!="LEGACY_M4_ORDINAL") error="NATIVE_BUS_GRAPH_NOT_ADMITTED"; - else if(!payload.isObject())error="INVALID_NATIVE_BUS_PAYLOAD"; - else if(operation=="NATIVE_CREATE_CHANNEL" || + else if(v8Wire && + (graph.getProperty("revision","").toString()!=baseGraph.toString() || + graph.getProperty("rosterRevision","").toString()!=baseRoster.toString())) + error="STALE_GRAPH_REVISION"; + else if(v8Wire) { + const auto caps=graph.getProperty("capabilities",{}); + const auto ops=caps.getProperty("supportedOps",{}); + const auto* allowed=ops.getArray(); + const auto rows=graph.getProperty("channels",{}); + const auto focus=intent.getProperty("targetChannelId",{}); + armix::mixer::ChannelId parsed{}; + const bool valid=focus.isString() && + armix::integration::parseNativeChannelId( + focus.toString().toStdString(),parsed); + bool admitted=false; + if(valid)if(const auto* channels=rows.getArray()) + for(const auto& row:*channels) + if(row.getProperty("id","").toString()==focus.toString()) + {admitted=true;break;} + if(!admitted || !graph.getProperty("edges",{}).isArray() || + !static_cast(caps.getProperty("callbackOwnsChannelIds",false)) || + !allowed || !allowed->contains(juce::var(juce::String( + "APPLY_WIRE_TRANSACTION")))) + error="UNIVERSAL_WIRE_NOT_ADMITTED"; + } + if(error.isEmpty() && !payload.isObject()) + error="INVALID_NATIVE_BUS_PAYLOAD"; + if(error.isNotEmpty()) { + // Do not touch installed native audio on stale requests. + } else if(operation=="NATIVE_CREATE_CHANNEL" || operation=="NATIVE_PATCH_CHANNEL") { if(operation=="NATIVE_CREATE_CHANNEL") { const auto name=payload.getProperty("name","").toString(); @@ -696,7 +761,7 @@ class LiveConsoleBridgeV6 final { rosterRev=response.rosterRevision;} } } - else if(operation=="NATIVE_APPLY_WIRE_TRANSACTION") { + else if(operation=="NATIVE_APPLY_WIRE_TRANSACTION" || v8Wire) { using namespace armix::mixer; const auto raw=payload.getProperty("changes",juce::var()); const auto* list=raw.getArray(); @@ -847,8 +912,10 @@ class LiveConsoleBridgeV6 final { ack.requestId=key; ack.status=applied?"ACCEPTED":"REJECTED"; ack.deviceEpoch=epoch.toStdString(); - ack.graphRevision=graph.getProperty("revision","0").toString().toStdString(); - ack.rosterRevision=graph.getProperty("rosterRevision","0").toString().toStdString(); + ack.graphRevision=v8Wire && applied?std::to_string(nativeRev): + graph.getProperty("revision","0").toString().toStdString(); + ack.rosterRevision=v8Wire && applied?std::to_string(rosterRev): + graph.getProperty("rosterRevision","0").toString().toStdString(); ack.errorCode=error.toStdString(); const auto json=PuzzleV8Wire::ack(ack); auto wire=juce::JSON::parse(juce::String::fromUTF8(json.c_str())); diff --git a/src/Main.cpp b/src/Main.cpp index e505f085b..205f76461 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -218,7 +218,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr const auto snapshot=armix::console::LiveConsoleBridgeV6::snapshot(engine_.status()); const auto op=args.getProperty("operation","").toString(); juce::var ack; - if(op.startsWith("NATIVE_")) + if(op.startsWith("NATIVE_") || op=="APPLY_WIRE_TRANSACTION") ack=consoleBridge_.processNativeBusIntent( args,snapshot,engine_, nativeShowBusy_||studioBackupBusy_, diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 91f97c602..3954fbaff 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -1168,6 +1168,78 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(batchAck.getProperty("status","").toString()=="REJECTED"); assert(batchAck.getProperty("errorCode","").toString()=="INVALID_NATIVE_WIRE_SOURCE"); assert(busControl.nativeWireBatches==1); + // Canonical public v8 operation uses the SAME installed ChannelId + // publisher and ACK revisions, never a WebView/legacy owned PCM graph. + const auto v8Route=live.getProperty("dryRoutingLab",{}); + const auto v8Bus=v8Route.getProperty("nativeBus",{}); + auto* v8BusObject=v8Bus.getDynamicObject(); + assert(v8BusObject); + const auto v8Rows=v8Bus.getProperty("channels",{}); + auto v8Input=std::make_unique(); + v8Input->setProperty("id","20"); + v8Input->setProperty("role","INPUT"); + v8Rows.getArray()->add(juce::var(v8Input.release())); + juce::Array v8Edges; + auto v8Edge=std::make_unique(); + v8Edge->setProperty("edgeId","77"); + v8Edge->setProperty("from","20"); + v8Edge->setProperty("to","18"); + v8Edge->setProperty("tap","POST_FADER"); + v8Edge->setProperty("gainLinear",.5); + v8Edges.add(juce::var(v8Edge.release())); + v8BusObject->setProperty("edges",juce::var(v8Edges)); + juce::Array v8InstalledOps; + v8InstalledOps.add(juce::var(juce::String("NATIVE_APPLY_WIRE_TRANSACTION"))); + v8BusObject->setProperty("supportedOps",juce::var(v8InstalledOps)); + const auto acceptedV8=Bridge::snapshot(live); + const auto acceptedV8Graph=acceptedV8.getProperty("graph",{}); + const auto acceptedV8Caps=acceptedV8Graph.getProperty("capabilities",{}); + assert(!static_cast(acceptedV8.getProperty("productionCallbackLive",true))); + assert(acceptedV8Graph.getProperty("revision","").toString()=="3"); + assert(acceptedV8Graph.getProperty("rosterRevision","").toString()=="4"); + assert(acceptedV8Graph.getProperty("channels",{}).getArray()->size()==2); + assert(acceptedV8Graph.getProperty("edges",{}).getArray()->size()==1); + assert(acceptedV8Graph.getProperty("edges",{}).getArray()->getReference(0) + .getProperty("edgeId","").toString()=="77"); + assert(static_cast(acceptedV8Caps.getProperty("callbackOwnsChannelIds",false))); + assert(acceptedV8Caps.getProperty("supportedOps",{}).getArray()->contains( + juce::var(juce::String("APPLY_WIRE_TRANSACTION")))); + auto v8IntentObject=std::make_unique(); + v8IntentObject->setProperty("requestId","v8:wire:1"); + v8IntentObject->setProperty("deviceEpoch","9007199254740993"); + v8IntentObject->setProperty("baseGraphRevision","3"); + v8IntentObject->setProperty("baseRosterRevision","4"); + v8IntentObject->setProperty("operation","APPLY_WIRE_TRANSACTION"); + v8IntentObject->setProperty("targetChannelId","20"); + v8IntentObject->setProperty("payload",batch.getProperty("payload",{})); + const auto v8WireIntent=juce::var(v8IntentObject.release()); + const auto applyV8=[&](const juce::var& command,const juce::var& snapshot) { + return bridge.processNativeBusIntent(command,snapshot,busControl,false, + [](const juce::String&,ChannelId,const juce::var&, + std::uint64_t,std::uint64_t,std::uint64_t) + ->BusControl::Report {return {};}); + }; + auto v8Reply=applyV8(v8WireIntent,acceptedV8); + assert(v8Reply.getProperty("status","").toString()=="ACCEPTED"); + assert(v8Reply.getProperty("graphRevision","").toString()=="4"); + assert(v8Reply.getProperty("rosterRevision","").toString()=="5"); + assert(busControl.nativeWireBatches==2); + assert(applyV8(v8WireIntent,acceptedV8) + .getProperty("errorCode","").toString()=="DUPLICATE_REQUEST_ID"); + auto staleV8=juce::JSON::parse(juce::JSON::toString(v8WireIntent,false)); + staleV8.getDynamicObject()->setProperty("requestId","v8:wire:stale"); + staleV8.getDynamicObject()->setProperty("baseGraphRevision","2"); + assert(applyV8(staleV8,acceptedV8).getProperty("status","").toString()=="REJECTED"); + assert(busControl.nativeWireBatches==2); + // Subsequent native producer snapshot must match the acknowledged graph + // and roster revision before GUI may paint an accepted WIRE cable. + v8BusObject->setProperty("graphRevision","4"); + v8BusObject->setProperty("rosterRevision","5"); + const auto afterV8=Bridge::snapshot(live); + assert(afterV8.getProperty("graph",{}).getProperty("revision","") + .toString()==v8Reply.getProperty("graphRevision","").toString()); + assert(afterV8.getProperty("graph",{}).getProperty("rosterRevision","") + .toString()==v8Reply.getProperty("rosterRevision","").toString()); auto liveMixIntent=makeBusIntent("native:mix:1"); liveMixIntent.getDynamicObject()->setProperty( "operation","NATIVE_SET_BUS_MIX"); From f56056a68d8582c2ee0d3bf58e5f55dea03982c4 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 17:05:55 +0700 Subject: [PATCH 146/155] fix(wire-v8): keep intent scope through ACK; guard exact focused source --- src/ConsoleLiveBridgeV6.h | 8 +++++++- tests/live_channel_fx_graph_test.cpp | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index a670ad40f..0eb5d4231 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -579,6 +579,8 @@ class LiveConsoleBridgeV6 final { const auto req=intent.getProperty("requestId",juce::var()); const auto request=req.isString()?req.toString():juce::String(); const auto key=request.toStdString(); + const bool v8Wire=intent.getProperty("operation","").toString()== + "APPLY_WIRE_TRANSACTION"; const auto device=snapshot.getProperty("device",juce::var()); const auto graph=snapshot.getProperty("graph",juce::var()); const auto legacy=snapshot.getProperty("legacyM4",juce::var()); @@ -598,7 +600,6 @@ class LiveConsoleBridgeV6 final { } recentIds_.push_back(key);completed_.insert(key); const auto operation=intent.getProperty("operation","").toString(); - const bool v8Wire=operation=="APPLY_WIRE_TRANSACTION"; const auto payload=intent.getProperty("payload",juce::var()); // One existing decoder, one native candidate, one PCM publisher. const auto baseGraph=v8Wire?intent.getProperty("baseGraphRevision",{}) @@ -787,6 +788,11 @@ class LiveConsoleBridgeV6 final { error="INVALID_NATIVE_WIRE_SOURCE";break; } change.from={source}; + // MAIN focus cannot disconnect someone else's edge. + if(v8Wire && item.getProperty("from",{}).toString()!= + intent.getProperty("targetChannelId",{}).toString()) { + error="UNIVERSAL_WIRE_UNFOCUSED_SOURCE";break; + } if(change.kind!=WireChange::Kind::remove) { if(!decodeDecimal(item.getProperty("to",{}),dest) || dest==0) { diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 3954fbaff..7527ab28a 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -1231,6 +1231,16 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { staleV8.getDynamicObject()->setProperty("baseGraphRevision","2"); assert(applyV8(staleV8,acceptedV8).getProperty("status","").toString()=="REJECTED"); assert(busControl.nativeWireBatches==2); + // A focused MAIN plug cannot modify another admitted channel's wire + // even if its edge ID is otherwise syntactically valid. + auto wrongFocus=juce::JSON::parse(juce::JSON::toString(v8WireIntent,false)); + wrongFocus.getDynamicObject()->setProperty("requestId","v8:wire:wrong-focus"); + wrongFocus.getDynamicObject()->setProperty("targetChannelId","18"); + const auto rejectedFocus=applyV8(wrongFocus,acceptedV8); + assert(rejectedFocus.getProperty("status","").toString()=="REJECTED"); + assert(rejectedFocus.getProperty("errorCode","").toString()== + "UNIVERSAL_WIRE_UNFOCUSED_SOURCE"); + assert(busControl.nativeWireBatches==2); // Subsequent native producer snapshot must match the acknowledged graph // and roster revision before GUI may paint an accepted WIRE cable. v8BusObject->setProperty("graphRevision","4"); From a9fd4d6b3a67f7d229f89a0c9944ea57689f2c6c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Wed, 4 Nov 2026 17:16:03 +0700 Subject: [PATCH 147/155] test(wire-v8): isolate accepted native revision fixture from legacy M4 regression --- tests/live_channel_fx_graph_test.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 7527ab28a..01a5eb7e6 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -1168,6 +1168,19 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(batchAck.getProperty("status","").toString()=="REJECTED"); assert(batchAck.getProperty("errorCode","").toString()=="INVALID_NATIVE_WIRE_SOURCE"); assert(busControl.nativeWireBatches==1); + auto liveMixIntent=makeBusIntent("native:mix:1"); + liveMixIntent.getDynamicObject()->setProperty( + "operation","NATIVE_SET_BUS_MIX"); + liveMixIntent.getDynamicObject()->setProperty("targetChannelId","18"); + auto mixPayload=std::make_unique(); + mixPayload->setProperty("gain",.5); + mixPayload->setProperty("pan",0.0); + liveMixIntent.getDynamicObject()->setProperty( + "payload",juce::var(mixPayload.release())); + const auto mixAck=routeBusIntent( + liveMixIntent); + assert(mixAck.getProperty("status","").toString()=="ACCEPTED"); + assert(busControl.liveMixes==1&&busControl.commits==1); // Canonical public v8 operation uses the SAME installed ChannelId // publisher and ACK revisions, never a WebView/legacy owned PCM graph. const auto v8Route=live.getProperty("dryRoutingLab",{}); @@ -1250,19 +1263,6 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { .toString()==v8Reply.getProperty("graphRevision","").toString()); assert(afterV8.getProperty("graph",{}).getProperty("rosterRevision","") .toString()==v8Reply.getProperty("rosterRevision","").toString()); - auto liveMixIntent=makeBusIntent("native:mix:1"); - liveMixIntent.getDynamicObject()->setProperty( - "operation","NATIVE_SET_BUS_MIX"); - liveMixIntent.getDynamicObject()->setProperty("targetChannelId","18"); - auto mixPayload=std::make_unique(); - mixPayload->setProperty("gain",.5); - mixPayload->setProperty("pan",0.0); - liveMixIntent.getDynamicObject()->setProperty( - "payload",juce::var(mixPayload.release())); - const auto mixAck=routeBusIntent( - liveMixIntent); - assert(mixAck.getProperty("status","").toString()=="ACCEPTED"); - assert(busControl.liveMixes==1&&busControl.commits==1); // Fail-closed device fault: do not advertise a compatibility actuator // against a poisoned physical port topology or stale hardware session. auto liveRoute=live.getProperty("dryRoutingLab",{}); From 168b1a20807a72e16590a385df5686569d0f6976 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 02:23:43 +0700 Subject: [PATCH 148/155] WIRE C2: verify v8 ACK changes installed ChannelId PCM graph and exact EdgeId --- tests/live_channel_fx_graph_test.cpp | 163 +++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 01a5eb7e6..1d3e4d869 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -1263,6 +1263,169 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { .toString()==v8Reply.getProperty("graphRevision","").toString()); assert(afterV8.getProperty("graph",{}).getProperty("rosterRevision","") .toString()==v8Reply.getProperty("rosterRevision","").toString()); + // C2 native integration: public v8 ACK is exercised against the REAL + // accepted PCM graph, not the mock authorizing the bridge above. + // Direct + nested routes must change sample amplitudes on the SAME + // sample index after the focused MAIN cable is actually unplugged. + { + constexpr std::uint64_t pcmEpoch=9007199254740993ULL; + DynamicAcceptedSession pcm; + DynamicGraphRequest patch; + patch.physicalInputs=1;patch.maxFrames=64; + const auto createRow=[](std::size_t position,ChannelRole role, + const char* name,ProcessingFormat width) { + ChannelEdit e;e.kind=ChannelEdit::Kind::add; + e.position=position;e.role=role;e.text=name;e.format=width; + return e; + }; + const std::array create{ + createRow(0,ChannelRole::input,"PCM SOURCE",ProcessingFormat::mono), + createRow(1,ChannelRole::input,"PCM VIA",ProcessingFormat::stereo), + createRow(2,ChannelRole::main,"PCM MAIN",ProcessingFormat::stereo) + }; + auto admission=pcm.edit(0,0,create,patch,pcmEpoch,pcmEpoch,true); + assert(admission.ok()&&admission.edit.createdIds.size()==3); + const auto src=admission.edit.createdIds[0]; + const auto via=admission.edit.createdIds[1]; + const auto sink=admission.edit.createdIds[2]; + patch.sources={{src,0,-1,false}}; + ChannelEdit direct;direct.kind=ChannelEdit::Kind::setPrimaryOutput; + direct.id=src;direct.target=sink; + ChannelEdit viaOut=direct;viaOut.id=via; + const std::array mains{direct,viaOut}; + admission=pcm.edit(1,1,mains,patch,pcmEpoch,pcmEpoch,true); + assert(admission.ok()&&pcm.acceptedGraphRevision()==2); + WireChange intermediate;intermediate.kind=WireChange::Kind::connect; + intermediate.from=src;intermediate.to=via; + const std::array toVia{intermediate}; + const auto linked=pcm.wireTransaction( + 2,2,toVia,patch,pcmEpoch,pcmEpoch,false); + assert(linked.ok()&&pcm.acceptedGraphRevision()==3); + const auto* acceptedPcm=pcm.acceptedRouting(pcmEpoch,3); + assert(acceptedPcm&&acceptedPcm->edges.size()==3); + std::uint64_t directId=0; + for(const auto& edge:acceptedPcm->edges) + if(edge.from==src&&edge.to==sink)directId=edge.edgeId; + assert(directId!=0); + std::array impulse{},left{},right{}; + impulse[11]=.3f; + const float* capture[]{impulse.data()}; + const auto noFx=+[](ChannelId,float*,float*,int) noexcept {}; + const auto renderPcm=[&] { + return pcm.render(pcmEpoch,capture,1,left.data(),right.data(), + 64,false,noFx); + }; + assert(renderPcm()); + const float parallelValue=left[11]; + assert(parallelValue>.1f); + assert(near(left[10],0.f)&&near(left[12],0.f)); + + // The existing Console nativeBus is only a *view*; reproject it + // from the actual tested accepted session and its stable IDs. + auto admittedBus=live.getProperty("dryRoutingLab",{}) + .getProperty("nativeBus",{}); + auto* busObject=admittedBus.getDynamicObject(); + assert(busObject); + const auto projectNativePcm=[&](std::uint64_t rev) { + const auto* accepted=pcm.acceptedRouting(pcmEpoch,rev); + assert(accepted); + juce::Array rows,edges; + for(const auto& row:accepted->channels) { + auto view=std::make_unique(); + view->setProperty("id",juce::String(std::to_string(row.id.value))); + view->setProperty("role",row.role==ChannelRole::main?"MAIN":"INPUT"); + rows.add(juce::var(view.release())); + } + for(const auto& edge:accepted->edges) { + auto view=std::make_unique(); + view->setProperty("edgeId",juce::String(std::to_string(edge.edgeId))); + view->setProperty("from",juce::String(std::to_string(edge.from.value))); + view->setProperty("to",juce::String(std::to_string(edge.to.value))); + view->setProperty("tap",edge.preFader?"PRE_FADER":"POST_FADER"); + view->setProperty("gainLinear",static_cast(edge.gainLinear)); + view->setProperty("primaryOutput",edge.primaryOutput); + edges.add(juce::var(view.release())); + } + busObject->setProperty("graphRevision", + juce::String(std::to_string(rev))); + busObject->setProperty("rosterRevision", + juce::String(std::to_string( + pcm.acceptedRosterRevision()))); + busObject->setProperty("channels",juce::var(rows)); + busObject->setProperty("edges",juce::var(edges)); + return Bridge::snapshot(live); + }; + const auto nativeBefore=projectNativePcm(3); + assert(nativeBefore.getProperty("graph",{}).getProperty("edges",{}) + .getArray()->size()==3); + // Derive from the real session rather than mocking the APPLY result. + struct ActualPcmControl final:BusControl { + DynamicAcceptedSession& session; + DynamicGraphRequest admitted; + ActualPcmControl(DynamicAcceptedSession& s, + const DynamicGraphRequest& p) + :session(s),admitted(p){} + Report applyNativeWireTransaction(std::uint64_t ep, + std::uint64_t graphRev,std::uint64_t rosterRev, + std::span edits) { + const auto result=session.wireTransaction( + rosterRev,graphRev,edits,admitted,ep,ep,false); + return {result.ok(),{},session.acceptedGraphRevision(), + session.acceptedRosterRevision(), + result.ok()?"":"NATIVE_PCM_REJECTED"}; + } + } nativePcmControl(pcm,patch); + auto userIntent=std::make_unique(); + userIntent->setProperty("requestId","v8:pcm:unplug:1"); + userIntent->setProperty("deviceEpoch",juce::String(std::to_string(pcmEpoch))); + userIntent->setProperty("baseGraphRevision","3"); + userIntent->setProperty("baseRosterRevision","3"); + userIntent->setProperty("operation","APPLY_WIRE_TRANSACTION"); + userIntent->setProperty("targetChannelId", + juce::String(std::to_string(src.value))); + auto unplug=std::make_unique(); + unplug->setProperty("op","REMOVE"); + unplug->setProperty("from",juce::String(std::to_string(src.value))); + unplug->setProperty("edgeId",juce::String(std::to_string(directId))); + juce::Array edits;edits.add(juce::var(unplug.release())); + auto payload=std::make_unique(); + payload->setProperty("changes",juce::var(edits)); + userIntent->setProperty("payload",juce::var(payload.release())); + const auto change=juce::var(userIntent.release()); + const auto response=bridge.processNativeBusIntent( + change,nativeBefore,nativePcmControl,false, + [](const juce::String&,ChannelId,const juce::var&, + std::uint64_t,std::uint64_t,std::uint64_t) + ->ActualPcmControl::Report {return {};}); + assert(response.getProperty("status","").toString()=="ACCEPTED"); + assert(response.getProperty("graphRevision","").toString()=="4"); + assert(response.getProperty("rosterRevision","").toString()=="4"); + assert(pcm.acceptedGraphRevision()==4); + assert(renderPcm()); + assert(left[11]>.05f&&left[11]size()==2); + assert(nativeBefore.getProperty("graph",{}) + .getProperty("revision","").toString()=="3"); + // Stale intent and exact edge replay must not remove any other MAIN. + auto staleChange=juce::JSON::parse(juce::JSON::toString(change,false)); + staleChange.getDynamicObject()->setProperty("requestId","v8:pcm:stale"); + const auto staleResponse=bridge.processNativeBusIntent( + staleChange,nativeAfter,nativePcmControl,false, + [](const juce::String&,ChannelId,const juce::var&, + std::uint64_t,std::uint64_t,std::uint64_t) + ->ActualPcmControl::Report {return {};}); + assert(staleResponse.getProperty("status","").toString()=="REJECTED"); + assert(pcm.acceptedGraphRevision()==4); + assert(renderPcm()&&left[11] Date: Thu, 5 Nov 2026 02:37:14 +0700 Subject: [PATCH 149/155] ENGINE: convert real accepted ChannelId PCM channels, EdgeIds, controls, and meters to approved v8 WebView contract --- src/ApprovedNativeV8Projection.h | 156 +++++++++++++++++++++++++++ src/ConsoleLiveBridgeV6.h | 24 ++--- tests/live_channel_fx_graph_test.cpp | 42 +++++++- 3 files changed, 201 insertions(+), 21 deletions(-) create mode 100644 src/ApprovedNativeV8Projection.h diff --git a/src/ApprovedNativeV8Projection.h b/src/ApprovedNativeV8Projection.h new file mode 100644 index 000000000..ab95387fd --- /dev/null +++ b/src/ApprovedNativeV8Projection.h @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include +#include +#include +#include +#include +#include + +// Single JUCE CONTROL-thread adapter: installed PCM/ChannelId readback -> +// approved /preview/ public schema v8. No new renderer, callback or DSP. +namespace armix::console { +inline bool nativeV8Decimal(const juce::var& value) { + if(!value.isString())return false; + const auto s=value.toString().toStdString(); + if(s.empty()||s.size()>20||(s.size()>1&&s[0]=='0'))return false; + std::uint64_t n=0; + for(char c:s) { + if(c<'0'||c>'9')return false; + auto d=static_cast(c-'0'); + if(n>(std::numeric_limits::max()-d)/10)return false; + n=n*10+d; + } + return n!=0; +} +inline bool nativeV8Number(const juce::var& value,double& n) { + if(!value.isInt()&&!value.isInt64()&&!value.isDouble())return false; + n=static_cast(value); + return std::isfinite(n); +} +inline bool projectApprovedNativeV8(juce::var& snapshot,const juce::var& bus) { + const auto rawRows=bus.getProperty("channels",{}),rawEdges=bus.getProperty("edges",{}); + const auto* rows=rawRows.getArray();const auto* edges=rawEdges.getArray(); + const auto rev=bus.getProperty("graphRevision",{}),roster=bus.getProperty("rosterRevision",{}); + if(!rows||rows->isEmpty()||!edges||!nativeV8Decimal(rev)|| + !nativeV8Decimal(roster))return false; + juce::Array channels,wires,destinations; + std::unordered_set ids,edgeIds; + auto meters=std::make_unique(); + juce::String mainId; + for(const auto& row:*rows) { + const auto id=row.getProperty("id",{}),name=row.getProperty("name",{}); + const auto role=row.getProperty("role","").toString(); + const auto format=row.getProperty("format","").toString(); + const auto out=row.getProperty("primaryOutput",{}); + const auto fader=row.getProperty("fader",{}),pan=row.getProperty("pan",{}); + const auto mute=row.getProperty("mute",{}),solo=row.getProperty("solo",{}); + const auto inserts=row.getProperty("inserts",{}); + double linear=0.,p=0.; + if(!nativeV8Decimal(id)||!ids.insert(id.toString().toStdString()).second || + !name.isString()||name.toString().isEmpty()|| + (role!="INPUT"&&role!="GROUP"&&role!="FX_RETURN"&&role!="MAIN"&&role!="MONITOR")|| + (format!="MONO"&&format!="STEREO")|| + !out.isString()||!nativeV8Number(fader,linear)|| + !nativeV8Number(pan,p)||linear<0.||linear>4.||p< -1.||p>1.|| + !mute.isBool()||!solo.isBool()||!inserts.isArray())return false; + if(role=="MAIN"){if(mainId.isNotEmpty())return false;mainId=id.toString();} + auto ch=std::make_unique(); + ch->setProperty("id",id);ch->setProperty("name",name); + ch->setProperty("role",role);ch->setProperty("processingFormat",format); + if(out.toString()!="0") { + if(!nativeV8Decimal(out)||out.toString()==id.toString())return false; + ch->setProperty("primaryOutId",out); + } + const auto source=row.getProperty("source",{}); + if(source.isObject())ch->setProperty("source",source); + auto controls=std::make_unique(); + const double db=linear>0.?20.*std::log10(linear):-60.; + controls->setProperty("faderDb",juce::jlimit(-60.,12.,db)); + controls->setProperty("pan",p); + controls->setProperty("mute",mute);controls->setProperty("solo",solo); + ch->setProperty("controls",juce::var(controls.release())); + juce::Array fx; + for(const auto& item:*inserts.getArray()){ + const auto token=item.getProperty("instanceId",{}),label=item.getProperty("name",{}); + const auto bypass=item.getProperty("bypassed",{}); + if(!token.isString()||!label.isString()||!bypass.isBool())return false; + auto insert=std::make_unique(); + insert->setProperty("id",token);insert->setProperty("name",label); + insert->setProperty("bypassed",bypass); + fx.add(juce::var(insert.release())); + } + ch->setProperty("inserts",juce::var(fx)); + ch->setProperty("sends",juce::var(juce::Array{})); + if(role!="INPUT"){ + auto dst=std::make_unique(); + dst->setProperty("id",id);dst->setProperty("name",name); + dst->setProperty("role",role); + destinations.add(juce::var(dst.release())); + } + double left=0.,right=0.; + if(nativeV8Number(row.getProperty("peakL",{}),left) && + nativeV8Number(row.getProperty("peakR",{}),right) && + left>=0.&&right>=0.){ + auto peak=std::make_unique(); + peak->setProperty("peakL",left);peak->setProperty("peakR",right); + meters->setProperty(juce::Identifier(id.toString()),juce::var(peak.release())); + } + channels.add(juce::var(ch.release())); + } + if(mainId.isEmpty())return false; + for(const auto& channel:channels) { + const auto out=channel.getProperty("primaryOutId",{}); + if(out.isString()&&!ids.count(out.toString().toStdString()))return false; + } + for(const auto& edge:*edges) { + const auto id=edge.getProperty("edgeId",{}),from=edge.getProperty("from",{}), + to=edge.getProperty("to",{}),gain=edge.getProperty("gainLinear",{}); + const auto tap=edge.getProperty("tap","").toString(); + const auto primary=edge.getProperty("primaryOutput",{}); + double linear=0.; + if(!nativeV8Decimal(id)||!nativeV8Decimal(from)||!nativeV8Decimal(to)|| + from.toString()==to.toString()|| + !edgeIds.insert(id.toString().toStdString()).second|| + !ids.count(from.toString().toStdString())|| + !ids.count(to.toString().toStdString())|| + from.toString()==mainId||(tap!="PRE_FADER"&&tap!="POST_FADER")|| + !nativeV8Number(gain,linear)||linear<0.||linear>4.|| + !primary.isBool())return false; + auto w=std::make_unique(); + w->setProperty("edgeId",id);w->setProperty("from",from);w->setProperty("to",to); + w->setProperty("tap",tap);w->setProperty("gainLinear",linear); + w->setProperty("primaryOutput",primary); + w->setProperty("enabled",true);w->setProperty("signalKind","AUDIO"); + wires.add(juce::var(w.release())); + if(!static_cast(primary))for(auto& channel:channels) { + if(channel.getProperty("id","").toString()!=from.toString())continue; + auto send=std::make_unique(); + send->setProperty("id",id);send->setProperty("targetId",to); + send->setProperty("tap",tap);send->setProperty("gainLinear",linear); + const auto list=channel.getProperty("sends",{}); + if(auto* a=list.getArray())a->add(juce::var(send.release())); + break; + } + } + const auto graph=snapshot.getProperty("graph",{}); + const auto telemetry=snapshot.getProperty("telemetry",{}); + auto* g=graph.getDynamicObject();auto* t=telemetry.getDynamicObject(); + if(!g||!t)return false; + // All validation completed before anything becomes authoritative. + g->setProperty("revision",rev);g->setProperty("rosterRevision",roster); + g->setProperty("mainChannelId",mainId); + g->setProperty("channels",juce::var(channels)); + g->setProperty("destinations",juce::var(destinations)); + g->setProperty("edges",juce::var(wires)); + if(auto* caps=graph.getProperty("capabilities",{}).getDynamicObject()){ + caps->setProperty("callbackOwnsChannelIds",true); + juce::Array ops;ops.add("APPLY_WIRE_TRANSACTION"); + caps->setProperty("supportedOps",juce::var(ops)); + } + t->setProperty("channelMeterRmsPeak",juce::var(meters.release())); + // productionCallbackLive deliberately stays FALSE until full FAT. + return true; +} +} // namespace armix::console diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index 0eb5d4231..e019f8160 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -3,6 +3,7 @@ #include #include "../integration/ConsoleNativeContractV6.h" #include "../engine/core/ConsolePuzzleV8Wire.h" +#include "ApprovedNativeV8Projection.h" #include #include #include @@ -170,27 +171,16 @@ class LiveConsoleBridgeV6 final { const auto nativeOps=bus.getProperty("supportedOps",{}); std::uint64_t graphId=0,rosterId=0; const auto* ops=nativeOps.getArray(); + // Project REAL native PCM state to the public v8 ABI. + // Raw nativeBus fields must not be published verbatim: + // fader is linear, format/primaryOutput are internal, + // and native edges lack enabled/signalKind. if(channels.isArray() && edges.isArray() && ops && ops->contains(juce::var(juce::String( "NATIVE_APPLY_WIRE_TRANSACTION"))) && decodeDecimal(rev,graphId) && graphId && - decodeDecimal(roster,rosterId) && rosterId) { - const auto graph=actual.getProperty("graph",{}); - if(auto* accepted=graph.getDynamicObject()) { - accepted->setProperty("revision",rev); - accepted->setProperty("rosterRevision",roster); - accepted->setProperty("channels",channels); - accepted->setProperty("edges",edges); - const auto capabilities=graph.getProperty("capabilities",{}); - if(auto* caps=capabilities.getDynamicObject()) { - caps->setProperty("callbackOwnsChannelIds",true); - juce::Array available; - available.add(juce::var(juce::String( - "APPLY_WIRE_TRANSACTION"))); - caps->setProperty("supportedOps",juce::var(available)); - } - } - } + decodeDecimal(roster,rosterId) && rosterId) + (void)projectApprovedNativeV8(actual,bus); // Full product-LIVE remains gated on VST3/Show/monitor // parity and measured hardware FAT (#15). } diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 1d3e4d869..515c7481c 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -1188,10 +1188,24 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { auto* v8BusObject=v8Bus.getDynamicObject(); assert(v8BusObject); const auto v8Rows=v8Bus.getProperty("channels",{}); - auto v8Input=std::make_unique(); - v8Input->setProperty("id","20"); - v8Input->setProperty("role","INPUT"); - v8Rows.getArray()->add(juce::var(v8Input.release())); + // Make the synthetic fixture structurally complete: partial native + // rows must not advertise accepted ChannelId support. + auto makeNativeRow=[](const char* id,const char* role) { + auto view=std::make_unique(); + view->setProperty("id",id);view->setProperty("role",role); + view->setProperty("name",role);view->setProperty("format","STEREO"); + view->setProperty("primaryOutput","0"); + view->setProperty("fader",1.);view->setProperty("pan",0.); + view->setProperty("mute",false);view->setProperty("solo",false); + view->setProperty("inserts",juce::var(juce::Array{})); + view->setProperty("peakL",.25);view->setProperty("peakR",.2); + return juce::var(view.release()); + }; + v8Rows.getArray()->clear(); + auto nativeInput=makeNativeRow("20","INPUT"); + nativeInput.getDynamicObject()->setProperty("primaryOutput","18"); + v8Rows.getArray()->add(nativeInput); + v8Rows.getArray()->add(makeNativeRow("18","MAIN")); juce::Array v8Edges; auto v8Edge=std::make_unique(); v8Edge->setProperty("edgeId","77"); @@ -1199,6 +1213,7 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { v8Edge->setProperty("to","18"); v8Edge->setProperty("tap","POST_FADER"); v8Edge->setProperty("gainLinear",.5); + v8Edge->setProperty("primaryOutput",true); v8Edges.add(juce::var(v8Edge.release())); v8BusObject->setProperty("edges",juce::var(v8Edges)); juce::Array v8InstalledOps; @@ -1211,7 +1226,14 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { assert(acceptedV8Graph.getProperty("revision","").toString()=="3"); assert(acceptedV8Graph.getProperty("rosterRevision","").toString()=="4"); assert(acceptedV8Graph.getProperty("channels",{}).getArray()->size()==2); + assert(acceptedV8Graph.getProperty("mainChannelId","").toString()=="18"); + const auto publicChannel=acceptedV8Graph.getProperty("channels",{}) + .getArray()->getReference(0); + assert(publicChannel.getProperty("processingFormat","").toString()=="STEREO"); + assert(publicChannel.getProperty("controls",{}).getProperty("faderDb",{}).isDouble()); assert(acceptedV8Graph.getProperty("edges",{}).getArray()->size()==1); + assert(acceptedV8Graph.getProperty("edges",{}).getArray()->getReference(0) + .getProperty("signalKind","").toString()=="AUDIO"); assert(acceptedV8Graph.getProperty("edges",{}).getArray()->getReference(0) .getProperty("edgeId","").toString()=="77"); assert(static_cast(acceptedV8Caps.getProperty("callbackOwnsChannelIds",false))); @@ -1334,6 +1356,18 @@ static void verifyNativeConsoleWireRejectsUnsupportedM4AndPreservesEpoch() { auto view=std::make_unique(); view->setProperty("id",juce::String(std::to_string(row.id.value))); view->setProperty("role",row.role==ChannelRole::main?"MAIN":"INPUT"); + view->setProperty("name",juce::String(row.name)); + view->setProperty("format",row.format==ProcessingFormat::mono?"MONO":"STEREO"); + view->setProperty("primaryOutput", + juce::String(std::to_string(row.primaryOutput.value))); + const auto* admitted=pcm.acceptedRoster().find(row.id); + assert(admitted); + view->setProperty("fader",static_cast(admitted->faderLinear)); + view->setProperty("pan",static_cast(admitted->pan)); + view->setProperty("mute",admitted->mute); + view->setProperty("solo",admitted->solo); + view->setProperty("inserts",juce::var(juce::Array{})); + view->setProperty("peakL",.3);view->setProperty("peakR",.3); rows.add(juce::var(view.release())); } for(const auto& edge:accepted->edges) { From 086300c96b62d55b5fcfc90e55ed0dd66787660a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 04:44:04 +0700 Subject: [PATCH 150/155] ENGINE E6: unify original CH1-10 and dynamic ChannelId realtime PCM controls --- src/LiveDryRoutingLab.h | 76 +++++++++++--------- tests/dynamic_accepted_session_test.cpp | 74 +++++++++++++++++++ tests/engine_runtime_reconciliation_test.mjs | 23 ++++++ 3 files changed, 140 insertions(+), 33 deletions(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index a2b18e1ed..fbbfc979a 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -754,31 +754,28 @@ class LiveDryRoutingLab final { if(name=="mute")updated.mute=value>0.5f; else updated.solo=value>0.5f; }else return false; + // The admitted native ChannelId graph is the ONLY active PCM control + // authority. Reject before changing legacy M4 DSP or claiming ACK. + if(channelIdPhysicalPcmActive()) { + if(nativeStructureLive_)return false; // old ordinal is now stale + const auto id=nativeAccepted_.graph.ids.inputs[strip]; + const bool accepted=(name=="mute"||name=="solo") + ?setNativeInputMuteSolo(expectedEpoch,nativeAccepted_.pcmRevision, + id,updated.mute,updated.solo) + :setNativeInputMix(expectedEpoch,nativeAccepted_.pcmRevision, + id,updated.linear,updated.pan); + if(!accepted)return false; + channelEdits_[strip]=updated; // CONTROL-thread Show/re-admission baseline + return true; + } + if(nativeStructureLive_ || nativeControlDirty_)return false; + // Legacy M4 is still the installed PCM owner before native cutover. 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; - if(channelIdPhysicalPcmActive()) { - const auto id=nativeAccepted_.graph.ids.inputs[strip]; - const bool mirrored=(name=="mute"||name=="solo") - ?nativePublisher_.setChannelMuteSolo( - expectedEpoch,nativeAccepted_.pcmRevision, - id,updated.mute,updated.solo) - :nativePublisher_.setChannelMix( - expectedEpoch,nativeAccepted_.pcmRevision, - id,updated.linear,updated.pan); - if(!mirrored)rejectedNativeMirror(); - else { - const auto id=nativeAccepted_.graph.ids.inputs[strip]; - if(name=="mute"||name=="solo") - nativeAccepted_.graph.roster.rememberLiveMuteSolo( - id,updated.mute,updated.solo); - else nativeAccepted_.graph.roster.rememberLiveMix( - id,updated.linear,updated.pan); - } - } return true; } @@ -1013,7 +1010,8 @@ class LiveDryRoutingLab final { armix::mixer::DynamicChannelFxLeaseBank::ExternalLease externalCh1={}) { // E5: a native BUS uses topology that M4 cannot represent. Never // demote its renderer on an unsupported legacy re-admission. - if(nativeStructureLive_ && nativeAccepted_.deviceEpoch==epoch()) + if((nativeStructureLive_ || nativeControlDirty_) && + nativeAccepted_.deviceEpoch==epoch()) return false; // Otherwise the last ACCEPTED M4 graph is the safe physical fallback // if migration rejects. This also handles a successfully replaced M4 @@ -1082,6 +1080,7 @@ class LiveDryRoutingLab final { true,nativePublisher_,nativeAccepted_,std::move(externalCh1)); if(!applied.ok() || generation!=epoch() || m4Revision!=revision()) return false; // selected M4 PCM owns the safe fallback + nativeControlDirty_=false; // fresh accepted legacy/native control baseline channelIdPcmEpoch_.store(generation,std::memory_order_release); return true; } catch(...) { @@ -1588,34 +1587,43 @@ class LiveDryRoutingLab final { } } - // Live dynamic-input controls: one canonical ChannelId PCM callback, - // no M4 ordinal alias, vendor reload or RT thread allocation. + // E6: Original migrated CH1-10 AND added dynamic INPUTs are driven + // by the same installed ChannelId publisher, callback and VST3 lease. + // Identity/epoch/revision gates precede any audible DSP mutation. bool setNativeInputMix(std::uint64_t epochValue,std::uint64_t revision, armix::mixer::ChannelId id,float gain,float pan) noexcept { - if(!nativeStructureLive_||!channelIdPhysicalPcmActive()|| + if(!channelIdPhysicalPcmActive()|| + nativeAccepted_.deviceEpoch!=epochValue|| epochValue!=epoch()||revision!=nativeAccepted_.pcmRevision|| !std::isfinite(gain)||gain<0.f||gain>4.f|| !std::isfinite(pan)||pan< -1.f||pan>1.f)return false; - for(const auto original:nativeAccepted_.graph.ids.inputs) - if(original==id)return false; const auto* channel=nativeAccepted_.graph.roster.find(id); if(!channel||channel->role!=armix::mixer::ChannelRole::input)return false; if(!nativePublisher_.setChannelMix(epochValue,revision,id,gain,pan)) return false; - return nativeAccepted_.graph.roster.rememberLiveMix(id,gain,pan); + if(!nativeAccepted_.graph.roster.rememberLiveMix(id,gain,pan)) { + topologyFault_.store(true,std::memory_order_release); + return false; // never ACK a rendered state missing from readback + } + nativeControlDirty_=true; + return true; } bool setNativeInputMuteSolo(std::uint64_t epochValue,std::uint64_t revision, armix::mixer::ChannelId id, bool mute,bool solo) noexcept { - if(!nativeStructureLive_||!channelIdPhysicalPcmActive()|| + if(!channelIdPhysicalPcmActive()|| + nativeAccepted_.deviceEpoch!=epochValue|| epochValue!=epoch()||revision!=nativeAccepted_.pcmRevision)return false; - for(const auto original:nativeAccepted_.graph.ids.inputs) - if(original==id)return false; const auto* channel=nativeAccepted_.graph.roster.find(id); if(!channel||channel->role!=armix::mixer::ChannelRole::input)return false; if(!nativePublisher_.setChannelMuteSolo( epochValue,revision,id,mute,solo))return false; - return nativeAccepted_.graph.roster.rememberLiveMuteSolo(id,mute,solo); + if(!nativeAccepted_.graph.roster.rememberLiveMuteSolo(id,mute,solo)) { + topologyFault_.store(true,std::memory_order_release); + return false; + } + nativeControlDirty_=true; + return true; } bool nativeBusTopologyLive() const noexcept { @@ -1778,9 +1786,9 @@ class LiveDryRoutingLab final { void revokeChannelIdPcm() noexcept { channelIdPcmEpoch_.store(0,std::memory_order_release); - // A live Group/FX RETURN cannot be represented by the old M4 - // schedule. Do not silently send its sources straight to MAIN. - if(nativeStructureLive_) + // Neither a structural BUS nor a native-owned fader/mute/pan may + // silently resume on the out-of-date legacy M4 PCM renderer. + if(nativeStructureLive_ || nativeControlDirty_) topologyFault_.store(true,std::memory_order_release); } void rejectedNativeMirror() noexcept { @@ -1798,6 +1806,7 @@ class LiveDryRoutingLab final { channelIdPcmEpoch_.store(0,std::memory_order_release); nativeMeterEpoch_.store(0,std::memory_order_release); nativeStructureLive_=false; + nativeControlDirty_=false; nativePublisher_.unpublish(); // CONTROL-only; audio lease retires safely nativeAccepted_=armix::mixer::UnifiedLegacyAccepted{}; userPatched_.store(false,std::memory_order_release); @@ -2245,6 +2254,7 @@ class LiveDryRoutingLab final { armix::mixer::UnifiedLegacyAccepted nativeAccepted_; std::atomic channelIdPcmEpoch_{0}; bool nativeStructureLive_=false; // CONTROL only; never read by callback + bool nativeControlDirty_=false; // Native edit cannot fall back to stale M4 PCM std::atomic monitorPeakL_{0.f},monitorPeakR_{0.f}; armix::dsp::MasterOutputMonoPolicy masterMonoPolicy_; // audio thread only std::array channelEdits_{}; // JUCE message thread only diff --git a/tests/dynamic_accepted_session_test.cpp b/tests/dynamic_accepted_session_test.cpp index ac6a740de..d39762988 100644 --- a/tests/dynamic_accepted_session_test.cpp +++ b/tests/dynamic_accepted_session_test.cpp @@ -449,7 +449,81 @@ static void verifyPrimaryOutKeepsCanonicalEdgeIdentity() { session.pollRetirement(); } +// Original CH1-10 do not get a different fader/solo DSP owner from CH11. +// This is an actual accepted native publisher PCM test, not a mock GUI reducer. +static void verifyOriginalAndAddedInputsShareNativePcmControls() { + constexpr std::uint64_t epoch=94011; + constexpr float center=.7071067811865475f; + DynamicAcceptedSession pcm; + DynamicGraphRequest physical; + physical.physicalInputs=3; + physical.maxFrames=64; + std::vector initial; + for(int i=0;i<10;++i) + initial.push_back(add(static_cast(i), + ChannelRole::input,"ORIGINAL CH")); + initial.push_back(add(10,ChannelRole::main,"MAIN", + ProcessingFormat::stereo)); + auto applied=pcm.edit(0,0,initial,physical,epoch,epoch,true); + assert(applied.ok() && applied.edit.createdIds.size()==11); + const auto ch1=applied.edit.createdIds[0]; + const auto ch2=applied.edit.createdIds[1]; + const auto main=applied.edit.createdIds[10]; + const std::array originals{ + output(ch1,main),output(ch2,main)}; + physical.sources={{ch1,0,-1,false},{ch2,1,-1,false}}; + applied=pcm.edit(1,1,originals,physical,epoch,epoch,true); + assert(applied.ok() && pcm.acceptedGraphRevision()==2); + // CH11 is added to the SAME accepted native graph later, not indexed + // as CH1 and not assigned a second VST/PCM process callback. + const std::array added{ + add(10,ChannelRole::input,"DYNAMIC CH11")}; + applied=pcm.edit(2,2,added,physical,epoch,epoch,true); + assert(applied.ok() && applied.edit.createdIds.size()==1); + const auto ch11=applied.edit.createdIds[0]; + assert(ch11!=ch1 && ch11!=ch2); + physical.sources.push_back({ch11,2,-1,false}); + const std::array connect{output(ch11,main)}; + applied=pcm.edit(3,3,connect,physical,epoch,epoch,true); + assert(applied.ok() && pcm.acceptedGraphRevision()==4); + std::array a{},b{},c{},l{},rr{}; + a.fill(.2f);b.fill(.3f);c.fill(.4f); + const float* inputs[]{a.data(),b.data(),c.data()}; + const auto noFx=+[](ChannelId,float*,float*,int) noexcept {}; + const auto render=[&] { + return pcm.render(epoch,inputs,3,l.data(),rr.data(),64,false,noFx); + }; + assert(render() && near(l[63],(.2f+.3f+.4f)*center)); + const float minus12=std::pow(10.f,-12.f/20.f); + assert(pcm.setLiveMix(epoch,4,ch1,minus12,0.f)); + assert(render() && near(l[63],(.2f*minus12+.3f+.4f)*center)); + assert(pcm.setLiveMix(epoch,4,ch2,1.f,-1.f)); + assert(render() && near(l[63],(.2f*minus12+.4f)*center+.3f)); + assert(near(rr[63],(.2f*minus12+.4f)*center)); + assert(pcm.setLiveMuteSolo(epoch,4,ch1,true,false)); + assert(render() && near(l[63],.3f+.4f*center)); + assert(pcm.setLiveMuteSolo(epoch,4,ch11,false,true)); + assert(render() && near(l[63],.4f*center)); + assert(pcm.setLiveMix(epoch,4,ch11,.5f,1.f)); + assert(render() && near(l[63],0.f) && near(rr[63],.2f)); + // No old device, old graph revision or invented ChannelId can change + // accepted native PCM, even while a solo/fader edit is in flight. + assert(!pcm.setLiveMix(epoch-1,4,ch1,1.f,0.f)); + assert(!pcm.setLiveMix(epoch,3,ch2,1.f,0.f)); + assert(!pcm.setLiveMuteSolo(epoch,3,ch11,false,false)); + assert(!pcm.setLiveMuteSolo(epoch,4,ChannelId{987654},true,false)); + assert(render() && near(l[63],0.f) && near(rr[63],.2f)); + assert(pcm.acceptedGraphRevision()==4); + assert(near(pcm.acceptedRoster().find(ch1)->faderLinear,minus12)); + assert(near(pcm.acceptedRoster().find(ch11)->faderLinear,.5f)); + assert(pcm.acceptedRoster().find(ch1)->mute); + assert(pcm.acceptedRoster().find(ch11)->solo); + pcm.unpublish(); + pcm.pollRetirement(); +} + int main() { + verifyOriginalAndAddedInputsShareNativePcmControls(); verifyPrimaryOutKeepsCanonicalEdgeIdentity(); verifyDefaultNativeMainEdgeAndDisconnectedRestore(); verifyAtomicWireTransactionAndZeroSampleHops(); diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index ff8855c95..98cc5e26f 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -91,6 +91,29 @@ test('occupied CH1 Orbit uses one strong Graph lease through native renderer and assert.equal(count(engine,/void audioDeviceIOCallbackWithContext\s*\(/g),1); }); +test('E6 original CH1-10 and dynamic INPUT use one accepted native PCM control writer',()=>{ + const legacy=physical.slice(physical.indexOf('bool setChannelParameter('), + physical.indexOf('// Real AUX FX RETURN')); + const native=physical.slice(physical.indexOf('bool setNativeInputMix('), + physical.indexOf('bool nativeBusTopologyLive()')); + assert.ok(legacy.indexOf('if(channelIdPhysicalPcmActive())')>=0); + assert.ok(legacy.indexOf('setNativeInputMix(')>=0); + assert.ok(legacy.indexOf('setNativeInputMuteSolo(')>=0); + assert.ok(legacy.indexOf('setNativeInputMix(')< + legacy.indexOf('publisher_.updateActiveControl('), + 'legacy M4 PCM must never be mutated before accepted ChannelId write'); + assert.match(legacy,/if\(!accepted\)return false/); + assert.doesNotMatch(native,/for\(const auto original/); + assert.doesNotMatch(native,/!nativeStructureLive_\|\|!channelIdPhysicalPcmActive/); + assert.match(native,/nativeAccepted_\.deviceEpoch!=epochValue/); + assert.match(native,/nativePublisher_\.setChannelMix/); + assert.match(native,/nativePublisher_\.setChannelMuteSolo/); + assert.match(native,/nativeAccepted_\.graph\.roster\.rememberLiveMix/); + assert.match(native,/nativeAccepted_\.graph\.roster\.rememberLiveMuteSolo/); + assert.match(physical,/nativeStructureLive_ \|\| nativeControlDirty_/); + assert.match(physical,/nativeControlDirty_=false; \/\/ fresh accepted legacy\/native/); +}); + test('E3 stable ChannelId GROUP/FX RETURN is a real guarded physical PCM transaction',()=>{ assert.match(physical,/NativeBusResult editNativeBus\(/); assert.match(physical,/next\.createBusForSelected\(/); From 59d1ef66d62fb66f030feca5ede8e47b77ca959d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 04:47:50 +0700 Subject: [PATCH 151/155] ENGINE E6: fail silent if any native mirror rejects after ChannelId controls --- src/LiveDryRoutingLab.h | 4 +++- tests/engine_runtime_reconciliation_test.mjs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index fbbfc979a..82f5ea88b 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1792,7 +1792,9 @@ class LiveDryRoutingLab final { topologyFault_.store(true,std::memory_order_release); } void rejectedNativeMirror() noexcept { - if(nativeStructureLive_) + // A failed AUX/mirror after any native-owned fader gesture must not + // reactivate stale legacy M4 controls on the original channels. + if(nativeStructureLive_ || nativeControlDirty_) topologyFault_.store(true,std::memory_order_release); else channelIdPcmEpoch_.store(0,std::memory_order_release); } diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs index 98cc5e26f..b12f24109 100644 --- a/tests/engine_runtime_reconciliation_test.mjs +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -111,6 +111,7 @@ test('E6 original CH1-10 and dynamic INPUT use one accepted native PCM control w assert.match(native,/nativeAccepted_\.graph\.roster\.rememberLiveMix/); assert.match(native,/nativeAccepted_\.graph\.roster\.rememberLiveMuteSolo/); assert.match(physical,/nativeStructureLive_ \|\| nativeControlDirty_/); + assert.match(physical,/void rejectedNativeMirror\(\) noexcept \{[\s\S]*?nativeControlDirty_/); assert.match(physical,/nativeControlDirty_=false; \/\/ fresh accepted legacy\/native/); }); From e15aefec648f7450e6f2d2afa1c6397dd5f68395 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 07:30:28 +0700 Subject: [PATCH 152/155] ENGINE: rebase strict FX/callback contract tests onto unified native render path --- tests/engine_runtime_reconciliation_test.mjs | 418 +++++++++++++++++++ tests/fx_add_contract_test.mjs | 6 +- tests/live_graph_contract_test.mjs | 50 ++- tests/live_routing_ui_contract_test.mjs | 2 +- tests/p0_diagnostic_contract_test.mjs | 7 +- 5 files changed, 470 insertions(+), 13 deletions(-) create mode 100644 tests/engine_runtime_reconciliation_test.mjs diff --git a/tests/engine_runtime_reconciliation_test.mjs b/tests/engine_runtime_reconciliation_test.mjs new file mode 100644 index 000000000..b12f24109 --- /dev/null +++ b/tests/engine_runtime_reconciliation_test.mjs @@ -0,0 +1,418 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Fast G0 architecture gate. Tests the INSTALLED owner (M4 compatibility) +// without pretending that the prepared ChannelId graph is live. +// When ChannelId cutover is actually approved, this gate MUST change in +// the same exact-SHA integration commit as the JUCE callback and native ACK. +import test from 'node:test'; +import vm from 'node:vm'; +import assert from 'node:assert/strict'; +import {readFileSync} from 'node:fs'; + +const read=p=>readFileSync(p,'utf8'); +const engine=read('src/LiveAudioEngine.h'); +const host=read('src/Main.cpp'); +const cmake=read('CMakeLists.txt'); +const authority=read('engine/core/NativeRenderAuthority.h'); +const bridge=read('src/ConsoleLiveBridgeV6.h'); +const wire=read('engine/core/ConsolePuzzleV8Wire.h'); +const schema=JSON.parse(read('contracts/console-puzzle-v8.json')); +const worker=read('src/NativeShowSaveWorker.h'); +const showCapture=read('src/NativeLiveShowCapture.h'); +const showRecall=read('src/NativeDryShowRecall.h'); +const physical=read('src/LiveDryRoutingLab.h'); +const dynamic=read('engine/core/DynamicNativeSessionPublisher.h'); +const realtimePermit=read('engine/core/RealtimeRenderPermit.h'); +const start=engine.indexOf('void audioDeviceIOCallbackWithContext ('); +assert.ok(start>0,'missing ONE JUCE production callback'); +const callback=engine.slice(start); +const count=(s,pattern)=>[...s.matchAll(pattern)].length; + +test('exactly one production audio callback and one native PCM owner',()=>{ + assert.equal(count(engine,/void audioDeviceIOCallbackWithContext\s*\(/g),1); + assert.equal(count(host,/LiveAudioEngine engine_;/g),1); + assert.match(engine,/#include "\.\.\/engine\/core\/NativeRenderAuthority\.h"/); + assert.match(callback,/NativeRenderAuthority::select\(/); + assert.match(callback,/NativeRenderOwner::failSilentUnpatched/); + assert.match(callback,/NativeRenderOwner::acceptedM4Session/); + assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1, + 'two native M4 PCM renders would double-sum or double-process vendor FX'); + assert.doesNotMatch(callback,/DynamicNativeSessionPublisher|DynamicAcceptedSession|\.publisher_\.render\(/, + 'unadmitted universal graph must never run alongside real M4 callback'); + assert.match(authority,/acceptedM4Session/); + assert.match(authority,/isolatedDiagnostic/); +}); + +test('unpatched is silent and diagnostic path cannot host a legacy second VST engine',()=>{ + const unpatched=callback.indexOf('NativeRenderOwner::failSilentUnpatched'); + const routed=callback.indexOf('NativeRenderOwner::acceptedM4Session'); + const isolated=callback.indexOf('// The only remaining stereo renderer is DIAGNOSTIC'); + const finish=callback.indexOf('const auto elapsedUs = clockMicros() - beginUs',isolated); + assert.ok(unpatched>=0&&routed>unpatched&&isolated>routed&&finish>isolated); + const first=callback.slice(unpatched,routed); + assert.match(first,/FloatVectorOperations::clear\(outputs\[c\], samples\)/); + assert.match(first,/handoff_\.endCycle\(cycle\)/, + 'plugin owner must still retire on the CONTROL thread when unpatched'); + const tail=callback.slice(isolated,finish); + assert.doesNotMatch(tail,/processor->processBlock|MidiBuffer midi|createPluginInstance|prepareToPlay/, + 'do not revive a hidden stereo plugin engine in diagnostic fallback'); + assert.match(tail,/diagnosticTone_\.next/); +}); + +test('original CH1 vendor FX/Orbit is leased exactly once in accepted M4 renderer',()=>{ + const old=engine.indexOf('static void renderOriginalChannelOneGraph('); + const end=engine.indexOf('void audioDeviceIOCallbackWithContext',old); + assert.ok(old>=0&&end>old); + const fx=engine.slice(old,end); + assert.match(fx,/slot\.processor->processBlock\(buffer,midi\)/); + assert.match(fx,/bypass\.request\(graph\.bypassFlags/); + assert.match(fx,/catch\(\.\.\.\)/); + assert.match(callback,/LegacyChannelOneLease ch1Lease\{cycle\.graph\}/); + assert.match(callback,/&processLegacyChannelOne/); + assert.doesNotMatch(callback,/std::make_unique<|std::make_shared<|createPluginInstance\(/, + 'no FX instantiation or graph allocation in device callback'); +}); + +test('occupied CH1 Orbit uses one strong Graph lease through native renderer and Show handoff',()=>{ + assert.match(engine,/std::shared_ptr graphOwned_\s*\{std::make_shared\(\)\}/); + assert.match(engine,/std::shared_ptr stagedOwner_/); + assert.match(engine,/fx\.owner=std::static_pointer_cast\(graphOwned_\)/); + assert.match(engine,/fx\.context=graphOwned_\.get\(\)/); + assert.match(engine,/fx\.render=&processOwnedChannelOne/); + assert.match(engine,/renderOriginalChannelOneGraph\(\s*\*static_cast\(token\)/); + assert.match(engine,/Graph\(\) \{ dryScratch\.setSize\(2,maxFrames,false,true,false\); \}/); + assert.match(engine,/graph\.dryScratch\.getWritePointer\(0\)/); + assert.match(engine,/graph\.orderPacked\.load\(std::memory_order_acquire\)/); + assert.match(engine,/dryRoutingLab_\.revokeChannelIdPcm\(\)/); + assert.equal(count(engine,/dryRoutingLab_\.revokeChannelIdPcm\(\)/g),2, + 'both Show recall and original CH1 ADD/REMOVE must revoke native renderer'); + assert.match(physical,/occupiedExternalCh1Fx>0,hw/); + assert.match(physical,/nativePublisher_,nativeAccepted_,std::move\(externalCh1\)/); + assert.match(physical,/channelIdPcmEpoch_\.store\(0,std::memory_order_release\)/); + assert.equal(count(engine,/void audioDeviceIOCallbackWithContext\s*\(/g),1); +}); + +test('E6 original CH1-10 and dynamic INPUT use one accepted native PCM control writer',()=>{ + const legacy=physical.slice(physical.indexOf('bool setChannelParameter('), + physical.indexOf('// Real AUX FX RETURN')); + const native=physical.slice(physical.indexOf('bool setNativeInputMix('), + physical.indexOf('bool nativeBusTopologyLive()')); + assert.ok(legacy.indexOf('if(channelIdPhysicalPcmActive())')>=0); + assert.ok(legacy.indexOf('setNativeInputMix(')>=0); + assert.ok(legacy.indexOf('setNativeInputMuteSolo(')>=0); + assert.ok(legacy.indexOf('setNativeInputMix(')< + legacy.indexOf('publisher_.updateActiveControl('), + 'legacy M4 PCM must never be mutated before accepted ChannelId write'); + assert.match(legacy,/if\(!accepted\)return false/); + assert.doesNotMatch(native,/for\(const auto original/); + assert.doesNotMatch(native,/!nativeStructureLive_\|\|!channelIdPhysicalPcmActive/); + assert.match(native,/nativeAccepted_\.deviceEpoch!=epochValue/); + assert.match(native,/nativePublisher_\.setChannelMix/); + assert.match(native,/nativePublisher_\.setChannelMuteSolo/); + assert.match(native,/nativeAccepted_\.graph\.roster\.rememberLiveMix/); + assert.match(native,/nativeAccepted_\.graph\.roster\.rememberLiveMuteSolo/); + assert.match(physical,/nativeStructureLive_ \|\| nativeControlDirty_/); + assert.match(physical,/void rejectedNativeMirror\(\) noexcept \{[\s\S]*?nativeControlDirty_/); + assert.match(physical,/nativeControlDirty_=false; \/\/ fresh accepted legacy\/native/); +}); + +test('E3 stable ChannelId GROUP/FX RETURN is a real guarded physical PCM transaction',()=>{ + assert.match(physical,/NativeBusResult editNativeBus\(/); + assert.match(physical,/next\.createBusForSelected\(/); + assert.match(physical,/next\.removeBusAndRestoreSources\(/); + assert.match(physical,/DynamicChannelFxLeaseBank::reuseRevision\(/); + assert.match(physical,/nativePublisher_\.commit\(/); + assert.match(physical,/nativeAccepted_\.graph\.roster=std::move\(next\)/); + assert.match(physical,/if\(!published\.ok\(\)\)/); + assert.match(physical,/nativeStructureLive_=nativeAccepted_\.graph\.roster\.size\(\)/); + assert.match(physical,/nativeAccepted_\.hardware\.monitorEnabled/); + assert.match(physical,/topologyFault_\.store\(true,std::memory_order_release\)/); + assert.match(engine,/LiveDryRoutingLab::NativeBusResult editNativeBus\(/); + assert.match(engine,/if\(dryRoutingLab_\.nativeBusTopologyLive\(\)\)return false/); + assert.match(bridge,/juce::var processNativeBusIntent\(/); + assert.match(bridge,/nativeGraphRevision/); + assert.match(bridge,/NATIVE_CREATE_GROUP_SELECTED/); + assert.match(bridge,/NATIVE_CREATE_FX_RETURN_SELECTED/); + assert.match(bridge,/NATIVE_REMOVE_BUS/); + assert.match(host,/consoleBridge_\.processNativeBusIntent\(/); + assert.match(bridge,/w\.productionCallbackLive=false/); + assert.match(wire,/callbackOwnsChannelIds/); + assert.match(physical,/nativeBusStructural/); + assert.match(showCapture,/nativeBusStructural/); + assert.match(showRecall,/nativeBusStructural/); + assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); +}); + + + +test('E5 rejected M4 structural edit and failed re-admission preserve native BUS PCM',()=>{ + const apply=physical.slice(physical.indexOf('juce::String apply ('),physical.indexOf('juce::String repatchPhysicalSource(')); + assert.match(apply,/nativeStructureLive_ && nativeAccepted_\.deviceEpoch==epoch\(\)/, + 'same-epoch native BUS blocks legacy M4 compilation before graph publication'); + assert.match(apply,/REMOVE native GROUP\/FX RETURN buses before replacing the M4 route/); + const admission=physical.slice(physical.indexOf('bool admitChannelIdFromAcceptedM4('), + physical.indexOf('bool originalM4Aux(')); + const commit=admission.indexOf('UnifiedLegacyProductionAdmission::compileAndCommit('); + assert.ok(commit>0,'native re-admission must commit genuine PCM'); + const dynamicFence=admission.indexOf('if(nativeStructureLive_ && nativeAccepted_.deviceEpoch==epoch())'); + const fixedFallback=admission.indexOf('channelIdPcmEpoch_.store(0,std::memory_order_release)'); + assert.ok(dynamicFence>=0 && fixedFallback>dynamicFence, + 'dynamic BUS cannot be demoted, but rejected fixed M4 migration must select matching M4 PCM'); + assert.match(admission,/nativeStructureLive_=false;/); + assert.ok(admission.indexOf('channelIdPcmEpoch_.store(generation',commit)>commit); + assert.match(engine,/if \(dryRoutingLab_\.nativeBusTopologyLive\(\)\)\s*return "REMOVE native GROUP\/FX RETURN buses/); + assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); +}); + + +test('E5 native FX return cannot advertise a no-VST dry-doubling physical bus',()=>{ + const structural=physical.slice(physical.indexOf('NativeBusResult editNativeBus('), + physical.indexOf('bool nativeBusTopologyLive()')); + assert.match(structural,/role==ChannelRole::fxReturn/); + assert.match(structural,/FX_RETURN_REQUIRES_NATIVE_VST3_OWNER/); + assert.match(structural,/DynamicChannelFxLeaseBank::reuseRevision/); + const advertised=physical.slice(physical.indexOf('juce::var nativeBusStatus() const'), + physical.indexOf('void disable() noexcept')); + assert.match(advertised,/"NATIVE_CREATE_GROUP_SELECTED"/); + assert.match(advertised,/"NATIVE_REMOVE_BUS"/); + assert.doesNotMatch(advertised,/"NATIVE_CREATE_FX_RETURN_SELECTED"/, + 'physical operator cannot create a parallel return without a real native insert'); +}); + +test('E4 installed PATCH operator uses native ChannelId BUS ACK and real PCM snapshot, never ten-strip draft',()=>{ + const ui=read('web/monitor.js'); + const binding=ui.slice(ui.indexOf('// E4: The EXISTING routing workspace controls'), + ui.indexOf('// Processing channel width is independent')); + assert.ok(binding.length>3000,'real native Group/FX operator binding absent'); + assert.match(binding,/const nativeBusAccepted=\(\)=>/); + assert.match(binding,/legacy\?\.controlPlane!=='LEGACY_M4_ORDINAL'/); + assert.match(binding,/legacy\?\.pcmRenderer!=='CHANNEL_ID_10CH4AUX'/); + assert.match(binding,/busWireDecimal\(c\.id\)===null/); + assert.match(binding,/bus\.supportedOps\.includes\(op\)/); + assert.match(binding,/state\.secondaryOutputArmed/); + assert.match(binding,/state\.monitor/); + assert.match(binding,/!mixerDraftActive/); + assert.match(binding,/targetChannelId:targetChannelId\|\|null,payload/); + assert.match(binding,/selectedChannelIds:ids,sendGain:gain/); + assert.match(binding,/api\.emitEvent\('arMixConsoleIntent',command\)/); + assert.match(binding,/api\.addEventListener\('arMixConsoleAck'/); + assert.match(binding,/api\.addEventListener\('arMixConsoleSnapshot'/); + assert.match(binding,/busSnapshotSerial>busPending\.ackSnapshotSerial/); + assert.match(binding,/BigInt\(info\.bus\.graphRevision\)>=BigInt\(ack\.nativeGraphRevision\)/); + assert.match(binding,/BigInt\(info\.bus\.rosterRevision\)>=BigInt\(ack\.nativeRosterRevision\)/); + assert.match(binding,/NATIVE_CREATE_GROUP_SELECTED/); + assert.match(binding,/NATIVE_CREATE_FX_RETURN_SELECTED/); + assert.match(binding,/NATIVE_REMOVE_BUS/); + assert.match(binding,/NATIVE_SET_BUS_MIX/); + assert.doesNotMatch(binding,/productionCallbackLive\s*=\s*true|createAudioContext|AudioContext\(/, + 'operator MUST NOT fabricate universal capabilities or DSP'); + assert.match(ui,/busRequest\(\);renderNativeBus\(true\)/); + assert.match(bridge,/processNativeBusIntent/); + assert.match(physical,/nativeBusStatus\(\)/); +}); + + +test('E4 operator native Group+FX Return controls run through real ACK then newer accepted PCM snapshot',()=>{ + const ui=read('web/monitor.js'); + const start=ui.indexOf('// E4: The EXISTING routing workspace controls'); + const end=ui.indexOf('// Processing channel width is independent',start); + assert.ok(start>0&&end>start,'E4 actual route controller must exist'); + class Node { + constructor(tag){this.tag=tag;this.children=[];this.listeners={}; + this.value='';this.disabled=false;this.checked=false;this.textContent=''; + this.className='';this.id='';this.attrs={};} + setAttribute(name,value){this.attrs[name]=value;} + append(...children){this.children.push(...children);} + replaceChildren(...children){this.children=[...children];} + addEventListener(name,fn){this.listeners[name]=fn;} + insertAdjacentElement(_,child){this.children.push(child);} + } + const root=new Node('section'),nativeCap=new Node('span'),sent=[],events={}; + const doc={createElement:tag=>new Node(tag), + createTextNode:text=>({textContent:text}), + getElementById:id=>id==='arBusCapability'?root:null}; + const api={emitEvent:(name,payload)=>sent.push({name,payload}), + addEventListener:(name,fn)=>events[name]=fn}; + const ctx=vm.createContext({ + document:doc,api,window:{crypto:{getRandomValues:n=>n.fill(7)}}, + routeOverlay:{classList:{contains:()=>true}, + querySelector:selector=>selector==='[data-bus-cap="missing"]'?nativeCap:null}, + state:{monitor:false,secondaryOutputArmed:false}, + patchPending:false,mixerDraftActive:false + }); + vm.runInContext(ui.slice(start,end),ctx,{timeout:1000}); + const snap=(revision='10',roster='3',epoch='12',armed=false)=>({ + schemaVersion:6,productionCallbackLive:false, + device:{epoch,outputArmed:armed}, + legacyM4:{controlPlane:'LEGACY_M4_ORDINAL', + pcmRenderer:'CHANNEL_ID_10CH4AUX',routingRevision:'7', + nativeBus:{graphRevision:revision,rosterRevision:roster, + supportedOps:['NATIVE_CREATE_GROUP_SELECTED', + 'NATIVE_CREATE_FX_RETURN_SELECTED','NATIVE_SET_BUS_MIX', + 'NATIVE_REMOVE_BUS'], + channels:[{id:'1',role:'INPUT',name:'Microphone'}, + {id:'2',role:'INPUT',name:'Music'}, + {id:'3',role:'MAIN',name:'MAIN'}, + // Accepted original M4 AUX1 has FX_RETURN role but its owner is + // NOT the dynamic E3 BUS edit transport: must stay read-only here. + {id:'4',role:'FX_RETURN',name:'AUX 1',nativeManaged:false, + fader:1,pan:0}]}} + }); + events.arMixConsoleSnapshot(snap()); + const probe=code=>vm.runInContext(code,ctx,{timeout:1000}); + assert.equal(probe('groupCreate.disabled'),false); + assert.equal(probe('nativeBusSources.children.length'),2); + assert.equal(probe('nativeBusRows.children.length'),0, + 'original M4 AUX receiver must never expose native REMOVE/mix controls'); + assert.match(nativeCap.textContent,/NATIVE PCM ACTIVE/); + probe("nativeBusSources.children[0].children[0].checked=true"); + probe("nativeBusSources.children[0].children[0].listeners.change()"); + probe("nativeBusName.value='Vocal Group';nativeBusGain.value='.6';groupCreate.listeners.click()"); + const commands=()=>sent.filter(x=>x.name==='arMixConsoleIntent'); + assert.equal(commands().length,1); + const one=commands()[0].payload; + assert.equal(one.operation,'NATIVE_CREATE_GROUP_SELECTED'); + assert.deepEqual(Array.from(one.payload.selectedChannelIds),['1']); + assert.equal(one.deviceEpoch,'12'); + assert.equal(one.legacyRoutingRevision,'7'); + assert.equal(one.nativeGraphRevision,'10'); + assert.equal(one.nativeRosterRevision,'3'); + assert.equal(one.payload.sendGain,.6); + assert.equal(probe('groupCreate.disabled'),true); + probe('groupCreate.listeners.click()'); + assert.equal(commands().length,1,'pending request must block duplicate AUDIO graph commit'); + // Engine ACK only proves acceptance. The UI stays locked until a + // strictly newer accepted PCM publisher snapshot supplies real revisions. + events.arMixConsoleAck({ + requestId:one.requestId,status:'ACCEPTED',deviceEpoch:'12', + nativeGraphRevision:'11',nativeRosterRevision:'4',errorCode:'' + }); + assert.equal(probe('groupCreate.disabled'),true); + events.arMixConsoleSnapshot(snap('10','3')); + assert.equal(probe('groupCreate.disabled'),true); + const updated=snap('11','4'); + updated.legacyM4.nativeBus.channels.splice(2,0,{ + id:'20',role:'GROUP',name:'Vocal Group',nativeManaged:true,fader:1,pan:0}); + events.arMixConsoleSnapshot(updated); + assert.equal(probe('groupCreate.disabled'),false); + assert.equal(probe('nativeBusRows.children.length'),1); + // Browser cannot forge a BUS by sending the universal graph capability: + // authoritative namespace must be ChannelId PCM actually installed. + const bogus=snap('12','5');bogus.legacyM4.pcmRenderer='M4_COMPAT'; + events.arMixConsoleSnapshot(bogus); + assert.equal(probe('groupCreate.disabled'),true); + probe("fxReturnCreate.listeners.click()"); + assert.equal(commands().length,1,'no synthetic native BUS without production PCM'); + events.arMixConsoleSnapshot(updated); + probe("nativeBusSources.children[0].children[0].checked=true"); + probe("nativeBusSources.children[0].children[0].listeners.change()"); + probe("nativeBusName.value='Vocal Wet';fxReturnCreate.listeners.click()"); + assert.equal(commands().length,2); + assert.equal(commands()[1].payload.operation,'NATIVE_CREATE_FX_RETURN_SELECTED'); + events.arMixConsoleAck({ + requestId:commands()[1].payload.requestId,status:'REJECTED', + deviceEpoch:'12',errorCode:'NATIVE_REJECTED' + }); + assert.equal(probe('groupCreate.disabled'),false, + 'rejected native intent should unlock controls while keeping old PCM unchanged'); + assert.match(probe('nativeBusState.textContent'),/REJECTED.*NATIVE_REJECTED/); + events.arMixConsoleSnapshot(snap('11','4','11')); + assert.equal(probe('busSession'),'12','old device generation must not replace live native BUS'); + const armed=snap('11','4','12',true); + events.arMixConsoleSnapshot(armed); + assert.equal(probe('groupCreate.disabled'),true,'output armed structural edits fail closed'); + probe("groupCreate.listeners.click()"); + assert.equal(commands().length,2); +}); + +test('E4 original 4 M4 AUX return IDs are immutable under dynamic native BUS edits',()=>{ + const physical=read('src/LiveDryRoutingLab.h'); + const ui=read('web/monitor.js'); + assert.match(physical,/bool originalM4Aux\(armix::mixer::ChannelId id\) const noexcept/); + assert.match(physical,/for\(const auto aux:nativeAccepted_\.graph\.ids\.aux\)/); + assert.match(physical,/if\(remove\.value && originalM4Aux\(remove\)\)/); + assert.match(physical,/FIXED_M4_AUX_NOT_REMOVABLE/); + assert.match(physical,/originalM4Aux\(id\)/); + assert.match(physical,/row->setProperty\("nativeManaged",/); + assert.match(ui,/x\.nativeManaged===true/); + assert.doesNotMatch(ui.slice(ui.indexOf('// E4: The EXISTING routing workspace controls'), + ui.indexOf('// Processing channel width is independent')),/M4_AUX_REMOVE|legacyAUXIdByIndex/, + 'Do not invent legacy AUX identities in the browser'); +}); + +test('shipping application does not compile a second test-only native mixer',()=>{ + const app=cmake.split(/\r?\n/).find(l=>l.startsWith('target_sources(ARMixConsole PRIVATE')); + assert.ok(app,'native JUCE application source list missing'); + assert.match(app,/src\/LiveAudioEngine\.h/); + assert.match(app,/engine\/core\/NativeRenderAuthority\.h/); + assert.doesNotMatch(app,/PreparedNativeMixerSession|DynamicNativeSessionPublisher|DynamicPreparedMixerBlock|UnifiedLegacyProductionAdmission|LegacyLiveGraphMigration/, + 'prepared graph may be compiled as tests/includes, not advertised as a second application entry point'); + assert.match(cmake,/target_sources\(ARMixNativeMixerSessionTests PRIVATE tests\/prepared_native_mixer_session_test\.cpp engine\/core\/PreparedNativeMixerSession\.h\)/); +}); + +test('GUI projection cannot falsely claim the prepared ChannelId engine is live',()=>{ + assert.equal(schema.schemaVersion,6); + assert.deepEqual(schema.wire.events, + ['arMixConsoleSubscribe','arMixConsoleSnapshot','arMixConsoleIntent','arMixConsoleAck']); + for(const item of ['deviceEpoch','baseGraphRevision','baseRosterRevision','requestId','targetChannelId']) + assert.ok(schema.intentRequired.includes(item)); + assert.ok(bridge.includes('w.productionCallbackLive=false')); + assert.match(bridge,/legacyM4/); + assert.match(wire,/callbackOwnsChannelIds\\":false/); + assert.match(wire,/fullVendorFxMigration\\":false/); + assert.ok(wire.includes('supportedOps')); + assert.match(bridge,/parseNativeChannelId/); + assert.match(bridge,/validConsoleRequestId/); +}); + +test('workers handle Show IO outside the audio callback, not as a second DSP engine',()=>{ + assert.match(worker,/class NativeShowSaveWorker final : private juce::Thread/); + assert.match(worker,/store\.commit\(show,\{snapshot_\},blobs_\)/); + assert.match(worker,/void releaseJob\(\)/); + assert.doesNotMatch(callback,/NativeShowStore|\.loadWithStates\(|\.commit\(show/); +}); + +test('E2 uses exactly one installed JUCE callback with admitted native ChannelId PCM and M4 fallback',()=>{ + assert.match(engine,/dryRoutingLab_\.admitChannelIdFromAcceptedM4\(/); + assert.match(physical,/UnifiedLegacyProductionAdmission::compileAndCommit\(/); + assert.match(physical,/channelIdPcmEpoch_\.store\(generation,std::memory_order_release\)/); + assert.match(physical,/const bool channelIdRender=/); + assert.match(physical,/if\(channelIdRender\)\s*\{/); + assert.match(physical,/nativePublisher_\.render\(/); + assert.match(physical,/else \{\s*processed=snapshot->prepared->process\(/); + assert.equal(count(callback,/dryRoutingLab_\.process\(/g),1); + assert.equal(count(callback,/DynamicNativeSessionPublisher::render\(/g),0, + 'a second JUCE native renderer may not be installed'); + assert.match(physical,/channelIdPcmEpoch_\.store\(0,std::memory_order_release\)/, + 'stale epoch and structural edits must turn off the native selector'); + assert.match(physical,/channelIdPhysicalPcmActive\(/, + 'live GUI scalar control must follow the admitted native renderer'); + assert.match(engine,/dryRoutingLab_\.revokeChannelIdPcm\(\)/, + 'original CH1 FX publication must first retire native PCM authority'); + assert.match(physical,/nativePublisher_\.pollRetirement\(\)/, + 'native VST owner generations must retire off audio callback'); +}); + +test('installed M4 and future ChannelId share one nonblocking render permit',()=>{ + assert.ok(physical.includes('RealtimeRenderPermit exclusive{rendering_}')); + assert.ok(dynamic.includes('RealtimeRenderPermit exclusive{rendering_}')); + assert.ok(realtimePermit.includes('test_and_set(std::memory_order_acquire)')); + assert.ok(realtimePermit.includes('clear(std::memory_order_release)')); + assert.ok(!realtimePermit.includes('std::mutex') && !realtimePermit.includes('condition_variable')); + assert.ok(physical.includes('if(!exclusive)')); + assert.ok(dynamic.includes('if(!exclusive)')); +}); + +test('legacy M4 operations are advertised separately, not as fake universal ChannelIds',()=>{ + assert.ok(bridge.includes('LEGACY_M4_ORDINAL')); + assert.ok(bridge.includes('acceptedChannels')); + assert.ok(bridge.includes('route.getProperty("topologyFault",false)')); + assert.ok(bridge.includes('object->setProperty("supportedOps",juce::var(allowed))')); + assert.ok(bridge.includes('w.productionCallbackLive=false')); + assert.ok(wire.includes('supportedOps')); +}); + +test('legacy M4 GUI commands require accepted physical authority, not just guessed ordinal',()=>{ + assert.ok(bridge.includes('.getProperty("controlPlane","").toString()!="LEGACY_M4_ORDINAL"')); + assert.ok(bridge.includes('PRODUCTION_GRAPH_NOT_ADMITTED')); + assert.ok(bridge.includes('legacyRoutingRevision')); +}); diff --git a/tests/fx_add_contract_test.mjs b/tests/fx_add_contract_test.mjs index 2b449ac4e..50a8d09a2 100644 --- a/tests/fx_add_contract_test.mjs +++ b/tests/fx_add_contract_test.mjs @@ -33,7 +33,11 @@ test('every ADD click identifies request and reports result inside the open sele assert.match(host,/FX_LOAD_FAIL/); }); test('plugin load and preset restore both negotiate existing VST3 bus layouts',()=>{ - assert.equal((dsp.match(/prepareStereoEffectLayout/g)||[]).length,2); + // Legacy ADD + preset restore + native dynamic ChannelId insert share one + // JUCE stereo layout negotiator; no extra fake plugin host is allowed. + assert.equal((dsp.match(/prepareStereoEffectLayout/g)||[]).length,3); + assert.match(dsp,/LiveDryRoutingLab::NativeBusResult installNativeVst3/); + assert.match(dsp,/dryRoutingLab_\.attachNativeInsert/); assert.match(layout,/if \(compatible \(original\)\) return \{\};/); assert.match(layout,/requested\.inputBuses\.set \(i, disabled\)/); assert.match(layout,/processor\.setBusesLayout \(requested\)/); diff --git a/tests/live_graph_contract_test.mjs b/tests/live_graph_contract_test.mjs index 594c641cf..6edcd12f1 100644 --- a/tests/live_graph_contract_test.mjs +++ b/tests/live_graph_contract_test.mjs @@ -28,6 +28,22 @@ test('preset UI reflects callback-acknowledged state not queued state',()=>{ assert.match(m,/arMixNativePresetLoaded/); assert.match(b,/RECALL LIVE/); }); +test('single engine production selection forbids old VST processing in diagnostic fallback',()=>{ + const authority=readFileSync(new URL('../engine/core/NativeRenderAuthority.h',import.meta.url),'utf8'); + assert.match(authority,/enum class NativeRenderOwner/); + assert.match(authority,/failSilentUnpatched/); + assert.match(authority,/acceptedM4Session/); + assert.match(authority,/isolatedDiagnostic/); + assert.match(e,/NativeRenderAuthority::select\(/); + assert.match(e,/NativeRenderOwner::acceptedM4Session/); + const start=e.indexOf('// The only remaining stereo renderer is DIAGNOSTIC'); + const end=e.indexOf('const auto elapsedUs = clockMicros() - beginUs',start); + assert.ok(start>0 && end>start,'explicit diagnostic-only tail must exist'); + const fallback=e.slice(start,end); + assert.doesNotMatch(fallback,/processor->processBlock|MidiBuffer midi|make_unique|make_shared/, + 'no second legacy stereo FX chain may be executed from diagnostics'); +}); + test('ADD/REMOVE remain guarded while MOVE publishes physical-slot order',()=>{ assert.match(e,/fxMovePhase_\.load/); assert.match(e,/FxOrderPlan::moved/); @@ -36,13 +52,26 @@ test('ADD/REMOVE remain guarded while MOVE publishes physical-slot order',()=>{ assert.doesNotMatch(move,/detach\(|attach\(/); }); -test('bypass is sample-smoothed on audio callback without control-thread CPU work',()=>{ +test('bypass is sample-smoothed by one original CH1 DSP owner for M4 and native ChannelId',()=>{ assert.match(e,/bypassEnvelope/); - assert.match(e,/bypass\.request\(cycle\.graph->bypassFlags/); - assert.match(e,/bypass\.transitioning\(\)/); - assert.match(e,/dryScratch_\.setSize \(2, maxFrames/); - assert.match(e,/bypass\.next\(\)/); - assert.match(e,/bypass\.shouldProcessWet\(\)/); + const start=e.indexOf('static void renderOriginalChannelOneGraph('); + const legacy=e.indexOf('static void processLegacyChannelOne(',start); + const native=e.indexOf('static void processOwnedChannelOne(',legacy); + const end=e.indexOf('void audioDeviceIOCallbackWithContext',native); + assert.ok(start>=0&&legacy>start&&native>legacy&&end>native, + 'native and M4 must share the original CH1 sample-accurate DSP owner'); + const originalDSP=e.slice(start,legacy); + const adapters=e.slice(legacy,end); + assert.match(originalDSP,/bypass\.request\(graph\.bypassFlags/); + assert.match(originalDSP,/slot\.processor->processBlock\(buffer,midi\)/); + assert.match(originalDSP,/bypass\.transitioning\(\)/); + assert.match(originalDSP,/graph\.dryScratch\.getWritePointer\(0\)/); + assert.match(originalDSP,/bypass\.next\(\)/); + assert.match(originalDSP,/bypass\.shouldProcessWet\(\)/); + assert.match(e,/Graph\(\) \{ dryScratch\.setSize\(2,maxFrames,false,true,false\); \}/); + assert.match(adapters,/renderOriginalChannelOneGraph\(\*graph,left,right,frames\)/); + assert.match(adapters,/renderOriginalChannelOneGraph\(\s*\*static_cast\(token\)/); + assert.match(adapters,/fx\.owner=std::static_pointer_cast\(graphOwned_\)/); assert.doesNotMatch(e.slice(e.indexOf('bool setBypass'),e.indexOf('bool removeAt')),/detach\(|prepareToPlay|releaseResources/); }); @@ -52,7 +81,7 @@ test('R0B CH1 MOVE inside routed 10CH graph uses the same callback-boundary de-c assert.match(move,/FxOrderPlan::moved/); assert.match(move,/fxMovePendingOrder_\.store/); assert.doesNotMatch(move,/detach\(|attach\(|prepareToPlay|releaseResources/); - const begin=e.indexOf('if (dryRoutingLab_.active())',e.indexOf('callbackCount_.fetch_add')); + const begin=e.indexOf('if (renderOwner ==',e.indexOf('callbackCount_.fetch_add')); const end=e.indexOf('const bool enabled = monitor_',begin); const routed=e.slice(begin,end); assert.match(routed,/FxMoveRamp::gain\(\s*routedFxMove,i,samples\)/); @@ -79,7 +108,7 @@ test('R0B major milestone: ADD and REMOVE are prepared control-thread transactio assert.match(e,/ownPlugin\s*\(/); assert.match(e,/old\.reset\(\); \/\/ Vendor cleanup only on final CONTROL-owned reference/); assert.match(e,/handoff_\.stage\(stagedOwner_\.get\(\)\)/); - const callback=e.slice(e.indexOf('if (dryRoutingLab_.active())',e.indexOf('callbackCount_.fetch_add')), + const callback=e.slice(e.indexOf('if (renderOwner ==',e.indexOf('callbackCount_.fetch_add')), e.indexOf('const bool enabled = monitor_',e.indexOf('callbackCount_.fetch_add'))); assert.match(callback,/handoff_\.endCycle\(cycle\)/); assert.match(callback,/cycle\.fadeOut/); @@ -103,13 +132,14 @@ test('R0B B3 NORMAL output is fail-silent while FX graph retirement still progre const beginning=e.indexOf('void audioDeviceIOCallbackWithContext'); const fence=e.indexOf('if (!independent_.active()',beginning); const lease=e.indexOf('const auto cycle = handoff_.beginCycle()',beginning); - const failSilent=e.indexOf('if (activeDiagnosticRoute == armix::diagnostics::Route::normal',beginning); + const failSilent=e.indexOf('if (renderOwner ==',lease); const callbackMetrics=e.indexOf('const std::uint64_t beginUs = clockMicros()',beginning); assert.ok(beginning>=0 && fence>beginning && lease>fence && failSilent>lease && callbackMetrics>failSilent, 'DIRECT fence first, then FX cycle lease, then fail-silent native gate'); const gate=e.slice(failSilent,callbackMetrics); - assert.match(gate,/!dryRoutingLab_\.active\(\)/); + assert.match(e,/NativeRenderAuthority::select\(/); + assert.match(gate,/NativeRenderOwner::failSilentUnpatched/); assert.match(gate,/FloatVectorOperations::clear\(outputs\[c\], samples\)/); assert.match(gate,/outputPeakL_\.store\(0\.f/); assert.match(gate,/handoff_\.endCycle\(cycle\)/, diff --git a/tests/live_routing_ui_contract_test.mjs b/tests/live_routing_ui_contract_test.mjs index 7e3f9ac05..454b8e8e9 100644 --- a/tests/live_routing_ui_contract_test.mjs +++ b/tests/live_routing_ui_contract_test.mjs @@ -46,7 +46,7 @@ test("GUI exposes only truthful dry device routes and acknowledged commit",()=>{ }); test("STOP-race is fail closed: all outputs are written to silence without CH1 fallback",()=>{ - const enter=engine.indexOf("if (dryRoutingLab_.active())",engine.indexOf("callbackCount_.fetch_add")); + const enter=engine.indexOf("if (renderOwner ==",engine.indexOf("callbackCount_.fetch_add")); // Bound the entire routed branch by the first statement of the legacy // fallback, not by an informational comment that can change at each R0B slice. const end=engine.indexOf("const bool enabled = monitor_",enter); diff --git a/tests/p0_diagnostic_contract_test.mjs b/tests/p0_diagnostic_contract_test.mjs index 417ebd0a8..f44fd5a20 100644 --- a/tests/p0_diagnostic_contract_test.mjs +++ b/tests/p0_diagnostic_contract_test.mjs @@ -27,7 +27,12 @@ test('audio callback isolates low-amplitude oscillator from input and VST3',()=> assert.match(engine,/const bool captureTest = route == armix::diagnostics::Route::captureOnly/); assert.match(engine,/diagnosticTone_\.next \(audible\)/); assert.match(engine,/if \(!toneTest\)/); - assert.match(engine,/if \(!dry\)/); + const start=engine.indexOf('// The only remaining stereo renderer is DIAGNOSTIC'); + const end=engine.indexOf('const auto elapsedUs = clockMicros() - beginUs',start); + assert.ok(start>0&&end>start,'isolated diagnostics must have an explicit owner'); + assert.doesNotMatch(engine.slice(start,end), + /processor->processBlock|MidiBuffer midi/, + 'test tone and capture-only must never enter a legacy VST processor'); assert.match(osc,/0\.0316227766/); assert.doesNotMatch(osc,/new |malloc\(|std::vector|mutex|lock_guard|fwrite\(/); assert.match(build,/P0DiagnosticTone/); From 7f5c431fb836d3134a7c39fe2e32e1549c649628 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 07:41:12 +0700 Subject: [PATCH 153/155] ENGINE tests: retain isolated legacy G0 adapter fixture without enabling alternate production GUI --- src/ApprovedNativeV8Projection.h | 156 +++++ src/ConsoleLiveBridgeV6.h | 966 +++++++++++++++++++++++++++++++ 2 files changed, 1122 insertions(+) create mode 100644 src/ApprovedNativeV8Projection.h create mode 100644 src/ConsoleLiveBridgeV6.h diff --git a/src/ApprovedNativeV8Projection.h b/src/ApprovedNativeV8Projection.h new file mode 100644 index 000000000..ab95387fd --- /dev/null +++ b/src/ApprovedNativeV8Projection.h @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include +#include +#include +#include +#include +#include + +// Single JUCE CONTROL-thread adapter: installed PCM/ChannelId readback -> +// approved /preview/ public schema v8. No new renderer, callback or DSP. +namespace armix::console { +inline bool nativeV8Decimal(const juce::var& value) { + if(!value.isString())return false; + const auto s=value.toString().toStdString(); + if(s.empty()||s.size()>20||(s.size()>1&&s[0]=='0'))return false; + std::uint64_t n=0; + for(char c:s) { + if(c<'0'||c>'9')return false; + auto d=static_cast(c-'0'); + if(n>(std::numeric_limits::max()-d)/10)return false; + n=n*10+d; + } + return n!=0; +} +inline bool nativeV8Number(const juce::var& value,double& n) { + if(!value.isInt()&&!value.isInt64()&&!value.isDouble())return false; + n=static_cast(value); + return std::isfinite(n); +} +inline bool projectApprovedNativeV8(juce::var& snapshot,const juce::var& bus) { + const auto rawRows=bus.getProperty("channels",{}),rawEdges=bus.getProperty("edges",{}); + const auto* rows=rawRows.getArray();const auto* edges=rawEdges.getArray(); + const auto rev=bus.getProperty("graphRevision",{}),roster=bus.getProperty("rosterRevision",{}); + if(!rows||rows->isEmpty()||!edges||!nativeV8Decimal(rev)|| + !nativeV8Decimal(roster))return false; + juce::Array channels,wires,destinations; + std::unordered_set ids,edgeIds; + auto meters=std::make_unique(); + juce::String mainId; + for(const auto& row:*rows) { + const auto id=row.getProperty("id",{}),name=row.getProperty("name",{}); + const auto role=row.getProperty("role","").toString(); + const auto format=row.getProperty("format","").toString(); + const auto out=row.getProperty("primaryOutput",{}); + const auto fader=row.getProperty("fader",{}),pan=row.getProperty("pan",{}); + const auto mute=row.getProperty("mute",{}),solo=row.getProperty("solo",{}); + const auto inserts=row.getProperty("inserts",{}); + double linear=0.,p=0.; + if(!nativeV8Decimal(id)||!ids.insert(id.toString().toStdString()).second || + !name.isString()||name.toString().isEmpty()|| + (role!="INPUT"&&role!="GROUP"&&role!="FX_RETURN"&&role!="MAIN"&&role!="MONITOR")|| + (format!="MONO"&&format!="STEREO")|| + !out.isString()||!nativeV8Number(fader,linear)|| + !nativeV8Number(pan,p)||linear<0.||linear>4.||p< -1.||p>1.|| + !mute.isBool()||!solo.isBool()||!inserts.isArray())return false; + if(role=="MAIN"){if(mainId.isNotEmpty())return false;mainId=id.toString();} + auto ch=std::make_unique(); + ch->setProperty("id",id);ch->setProperty("name",name); + ch->setProperty("role",role);ch->setProperty("processingFormat",format); + if(out.toString()!="0") { + if(!nativeV8Decimal(out)||out.toString()==id.toString())return false; + ch->setProperty("primaryOutId",out); + } + const auto source=row.getProperty("source",{}); + if(source.isObject())ch->setProperty("source",source); + auto controls=std::make_unique(); + const double db=linear>0.?20.*std::log10(linear):-60.; + controls->setProperty("faderDb",juce::jlimit(-60.,12.,db)); + controls->setProperty("pan",p); + controls->setProperty("mute",mute);controls->setProperty("solo",solo); + ch->setProperty("controls",juce::var(controls.release())); + juce::Array fx; + for(const auto& item:*inserts.getArray()){ + const auto token=item.getProperty("instanceId",{}),label=item.getProperty("name",{}); + const auto bypass=item.getProperty("bypassed",{}); + if(!token.isString()||!label.isString()||!bypass.isBool())return false; + auto insert=std::make_unique(); + insert->setProperty("id",token);insert->setProperty("name",label); + insert->setProperty("bypassed",bypass); + fx.add(juce::var(insert.release())); + } + ch->setProperty("inserts",juce::var(fx)); + ch->setProperty("sends",juce::var(juce::Array{})); + if(role!="INPUT"){ + auto dst=std::make_unique(); + dst->setProperty("id",id);dst->setProperty("name",name); + dst->setProperty("role",role); + destinations.add(juce::var(dst.release())); + } + double left=0.,right=0.; + if(nativeV8Number(row.getProperty("peakL",{}),left) && + nativeV8Number(row.getProperty("peakR",{}),right) && + left>=0.&&right>=0.){ + auto peak=std::make_unique(); + peak->setProperty("peakL",left);peak->setProperty("peakR",right); + meters->setProperty(juce::Identifier(id.toString()),juce::var(peak.release())); + } + channels.add(juce::var(ch.release())); + } + if(mainId.isEmpty())return false; + for(const auto& channel:channels) { + const auto out=channel.getProperty("primaryOutId",{}); + if(out.isString()&&!ids.count(out.toString().toStdString()))return false; + } + for(const auto& edge:*edges) { + const auto id=edge.getProperty("edgeId",{}),from=edge.getProperty("from",{}), + to=edge.getProperty("to",{}),gain=edge.getProperty("gainLinear",{}); + const auto tap=edge.getProperty("tap","").toString(); + const auto primary=edge.getProperty("primaryOutput",{}); + double linear=0.; + if(!nativeV8Decimal(id)||!nativeV8Decimal(from)||!nativeV8Decimal(to)|| + from.toString()==to.toString()|| + !edgeIds.insert(id.toString().toStdString()).second|| + !ids.count(from.toString().toStdString())|| + !ids.count(to.toString().toStdString())|| + from.toString()==mainId||(tap!="PRE_FADER"&&tap!="POST_FADER")|| + !nativeV8Number(gain,linear)||linear<0.||linear>4.|| + !primary.isBool())return false; + auto w=std::make_unique(); + w->setProperty("edgeId",id);w->setProperty("from",from);w->setProperty("to",to); + w->setProperty("tap",tap);w->setProperty("gainLinear",linear); + w->setProperty("primaryOutput",primary); + w->setProperty("enabled",true);w->setProperty("signalKind","AUDIO"); + wires.add(juce::var(w.release())); + if(!static_cast(primary))for(auto& channel:channels) { + if(channel.getProperty("id","").toString()!=from.toString())continue; + auto send=std::make_unique(); + send->setProperty("id",id);send->setProperty("targetId",to); + send->setProperty("tap",tap);send->setProperty("gainLinear",linear); + const auto list=channel.getProperty("sends",{}); + if(auto* a=list.getArray())a->add(juce::var(send.release())); + break; + } + } + const auto graph=snapshot.getProperty("graph",{}); + const auto telemetry=snapshot.getProperty("telemetry",{}); + auto* g=graph.getDynamicObject();auto* t=telemetry.getDynamicObject(); + if(!g||!t)return false; + // All validation completed before anything becomes authoritative. + g->setProperty("revision",rev);g->setProperty("rosterRevision",roster); + g->setProperty("mainChannelId",mainId); + g->setProperty("channels",juce::var(channels)); + g->setProperty("destinations",juce::var(destinations)); + g->setProperty("edges",juce::var(wires)); + if(auto* caps=graph.getProperty("capabilities",{}).getDynamicObject()){ + caps->setProperty("callbackOwnsChannelIds",true); + juce::Array ops;ops.add("APPLY_WIRE_TRANSACTION"); + caps->setProperty("supportedOps",juce::var(ops)); + } + t->setProperty("channelMeterRmsPeak",juce::var(meters.release())); + // productionCallbackLive deliberately stays FALSE until full FAT. + return true; +} +} // namespace armix::console diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h new file mode 100644 index 000000000..e019f8160 --- /dev/null +++ b/src/ConsoleLiveBridgeV6.h @@ -0,0 +1,966 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include "../integration/ConsoleNativeContractV6.h" +#include "../engine/core/ConsolePuzzleV8Wire.h" +#include "ApprovedNativeV8Projection.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Native Console v6 adapter, exclusively on the JUCE MESSAGE/CONTROL thread. +// This projects the real M4 callback/device readback WITHOUT promoting its +// fixed strip indexes to fictitious ChannelIds. The production ChannelId +// migration must replace this deliberately fail-closed G0 capability gate. +// It never owns PCM, clones VST3, or calls the audio device from the browser. +namespace armix::console { +class LiveConsoleBridgeV6 final { +public: + static constexpr int schemaVersion=6; + + // Source: LiveAudioEngine::status() with its real JUCE callback telemetry, + // driver active masks and epoch. No browser invented physical pins. + static juce::var snapshot(const juce::var& live) { + // Single actual native producer for both JUCE WebView and S0 + // fixture. No JSON shape authored by the JS/GUI. + PuzzleV8Snapshot w; + const auto route=live.getProperty("dryRoutingLab",juce::var()); + // The control session has an epoch even before a driver is opened. + // 1 is the UNREADY session generation, NOT a fabricated physical + // source; any later verified device epoch supersedes this token. + auto actualEpoch=decimalFromNative(route.getProperty("epoch",juce::var())); + if(actualEpoch=="0")actualEpoch="1"; + w.epoch=actualEpoch.toStdString(); + w.legacyRoutingRevision=decimalFromNative( + route.getProperty("revision",juce::var())).toStdString(); + // The accepted fixed-M4 revision stays under legacyM4 only. + // A ChannelId revision is never copied from an ordinal M4 graph. + w.legacyActive=static_cast(route.getProperty("active",false)); + w.legacyRouteAccepted=static_cast(route.getProperty("ready",false)) && + static_cast(route.getProperty("hasAcceptedRoute",false)); + w.backend=live.getProperty("driver","").toString().toStdString(); + w.captureDevice=live.getProperty("inputDevice","").toString().toStdString(); + w.playbackDevice=live.getProperty("outputDevice","").toString().toStdString(); + const double rate=static_cast(live.getProperty("rate",0.)); + if(std::isfinite(rate) && rate>0. && rate<=384000.) + w.sampleRate=static_cast(rate); + const int frames=static_cast(live.getProperty("buffer",0)); + if(frames>0)w.bufferFrames=frames; + const bool connected=static_cast(live.getProperty("connected",false)); + w.outputArmed=connected && w.legacyRouteAccepted && + static_cast(live.getProperty("monitor",false)) && + static_cast(live.getProperty("directRouteAuthorized",false)); + const auto peak=static_cast(live.getProperty("inputPeak",0.)); + if(std::isfinite(peak) && peak>=0.)w.rawCapturePeak=peak; + w.rawCapturePresent=connected && + static_cast(live.getProperty("callbackCount",0.))>0. && + static_cast(live.getProperty("callbackInputChannels",0))>0 && + w.rawCapturePeak>0.0005; + w.mainPcmPresent=w.outputArmed && + static_cast(live.getProperty("peak",0.))>0.0002; + w.monitorPcmPresent=w.outputArmed && + static_cast(route.getProperty("monitorPeakL",0.))>0.0002; + const auto pins=route.getProperty("ports",juce::var()); + const auto peaks=live.getProperty("captureCallbackPeaks",juce::var()); + const auto* readings=peaks.getArray(); + if(const auto* physical=pins.getArray()) + for(const auto& p:*physical) { + const auto number=p.getProperty("port",juce::var()); + const auto ordinal=p.getProperty("callback",juce::var()); + if(!number.isInt()||!ordinal.isInt())continue; + PuzzleV8Pin pin; + pin.port=static_cast(number); + pin.callback=static_cast(ordinal); + if(pin.port<0 || pin.callback<0)continue; + pin.label=p.getProperty("label","").toString().toStdString(); + if(readings && pin.callbacksize()) { + const auto value=readings->getReference(pin.callback); + if(value.isInt()||value.isDouble()) { + const auto peakValue=static_cast(value); + if(std::isfinite(peakValue)&&peakValue>=0.) { + pin.hasRawPeak=true;pin.rawPeak=peakValue; + } + } + } + w.inputs.push_back(std::move(pin)); + } + const auto outputs=route.getProperty("outputPorts",juce::var()); + if(const auto* ports=outputs.getArray()) + for(int ordinal=0;ordinalsize();++ordinal) { + const auto value=ports->getReference(ordinal); + if(!value.isInt())continue; + const int physical=static_cast(value); + if(physical<0)continue; + w.outputs.push_back({physical,ordinal,{},{},0.}); + } + // The installed ABI is still M4 ordinals, but the single JUCE + // callback may now select the real native ChannelId PCM renderer + // with original CH1/Orbit lease after accepted admission. Neither + // physical mode implies universal CH11/GROUP/WIRE ownership. + w.productionCallbackLive=false; + const auto bytes=PuzzleV8Wire::snapshot(w); + auto actual=juce::JSON::parse(juce::String::fromUTF8(bytes.c_str())); + // Optional diagnosed M4 accepted controls are sourced from the + // installed JUCE control thread, not stale immutable routing faders. + // UNREADY fixture stays byte-identical; these are NOT ChannelIds. + const auto legacy=actual.getProperty("legacyM4",{}); + if(auto* object=legacy.getDynamicObject()) { + // Current native M4 (not a fake ChannelId roster): exactly the + // signal that is audible in this physical device callback. + const auto controls=route.getProperty("channelControls",juce::var()); + const auto peaksL=route.getProperty("channelPeaksL",juce::var()); + const auto peaksR=route.getProperty("channelPeaksR",juce::var()); + const auto inserts=route.getProperty("fxInstances",juce::var()); + if(controls.isArray())object->setProperty("channelControls",controls); + if(peaksL.isArray())object->setProperty("channelPeaksL",peaksL); + if(peaksR.isArray())object->setProperty("channelPeaksR",peaksR); + if(inserts.isArray())object->setProperty("fxInstances",inserts); + // The prepared/unpatched native M4 graph is a real silent route. + // It allows direct IN gesture to activate the FIRST source. + // This does not set productionCallbackLive or fake PCM. + const auto configured=route.getProperty("acceptedRoute",juce::var()); + const auto prepared=route.getProperty("preparedM4Route",juce::var()); + const auto topo=configured.isObject()?configured:prepared; + if(topo.isObject()) { + const auto sends=topo.getProperty("sends",juce::var()); + const auto returns=topo.getProperty("auxes",juce::var()); + if(sends.isArray())object->setProperty("acceptedSends",sends); + if(returns.isArray())object->setProperty("auxReturns",returns); + // Legacy M4 physical inputs/output membership are CONTROL + // readbacks from the actually admitted 10-strip route. Never + // infer them from presentation order or a UI draft. + const auto channels=topo.getProperty("channels",juce::var()); + if(connected && w.legacyActive && + (w.legacyRouteAccepted || + (static_cast(route.getProperty("ready",false)) && + prepared.isObject())) && + !static_cast(route.getProperty("topologyFault",false)) && + channels.isArray() && + channels.getArray()->size()==armix::mixer::stripCount) { + object->setProperty("acceptedChannels",channels); + object->setProperty("controlPlane","LEGACY_M4_ORDINAL"); + // Real accepted PCM provenance for FAT/GUI diagnostics. + // Read from LiveAudioEngine's installed callback, not + // guessed browser roles. This does NOT enable universal + // supportedOps, ChannelIds, or graph revision. + const bool native=static_cast(route.getProperty( + "nativeChannelIdPcmActive",false)); + object->setProperty("pcmRenderer",native + ?"CHANNEL_ID_10CH4AUX":"M4_COMPAT"); + object->setProperty("originalCh1GraphLeased", + native && static_cast(route.getProperty( + "originalCh1GraphLeased",false))); + // Separate scoped native bus transport, not universal + // v8 graph capabilities or synthetic M4 strip ordinals. + const auto bus=route.getProperty("nativeBus",juce::var()); + if(native && bus.isObject()) { + object->setProperty("nativeBus",bus); + // Native PCM is the only source of exact ChannelIds, + // EdgeIds and accepted revision for the v8 projection. + const auto channels=bus.getProperty("channels",{}); + const auto edges=bus.getProperty("edges",{}); + const auto rev=bus.getProperty("graphRevision",{}); + const auto roster=bus.getProperty("rosterRevision",{}); + const auto nativeOps=bus.getProperty("supportedOps",{}); + std::uint64_t graphId=0,rosterId=0; + const auto* ops=nativeOps.getArray(); + // Project REAL native PCM state to the public v8 ABI. + // Raw nativeBus fields must not be published verbatim: + // fader is linear, format/primaryOutput are internal, + // and native edges lack enabled/signalKind. + if(channels.isArray() && edges.isArray() && ops && + ops->contains(juce::var(juce::String( + "NATIVE_APPLY_WIRE_TRANSACTION"))) && + decodeDecimal(rev,graphId) && graphId && + decodeDecimal(roster,rosterId) && rosterId) + (void)projectApprovedNativeV8(actual,bus); + // Full product-LIVE remains gated on VST3/Show/monitor + // parity and measured hardware FAT (#15). + } + // Separate namespace: these operations mutate the one + // INSTALLED M4 JUCE PCM graph. They are NEVER universal + // graph.capabilities.supportedOps or ChannelIds. + juce::Array allowed; + for(const char* op: {"SET_SOURCE","SET_PROCESSING_FORMAT", + "SET_PRIMARY_OUT","SET_FADER","SET_PAN","SET_MUTE","SET_SOLO"}) + allowed.add(juce::var(juce::String(op))); + if(returns.isArray())allowed.add(juce::var("SET_AUX_FADER")); + if(sends.isArray()&&!sends.getArray()->isEmpty()) + allowed.add(juce::var("SET_SEND_LEVEL")); + if(inserts.isArray()) { + bool hasNativeFx=false; + for(const auto& rack:*inserts.getArray()) + if(rack.isArray()&&!rack.getArray()->isEmpty()) { + hasNativeFx=true;break; + } + if(hasNativeFx) { + allowed.add(juce::var("SET_INSERT_BYPASS")); + allowed.add(juce::var("OPEN_INSERT_EDITOR")); + } + } + object->setProperty("supportedOps",juce::var(allowed)); + } + } + const auto monitorSends=route.getProperty("monitorSends",juce::var()); + if(monitorSends.isArray()) + object->setProperty("monitorSends",monitorSends); + const auto main=route.getProperty("mainOutputs",juce::var()); + if(main.isArray())object->setProperty("mainOutputs",main); + const auto monitor=route.getProperty("monitorOutputs",juce::var()); + if(monitor.isArray()) { + object->setProperty("monitorOutputs",monitor); + if(object->hasProperty("supportedOps") && + monitor.getArray()->size()==2) { + auto operations=object->getProperty("supportedOps"); + if(auto* list=operations.getArray()) { + list->add(juce::var("SET_MONITOR_LEVEL")); + object->setProperty("supportedOps",operations); + } + } + } + } + return actual; + } + + // Exact native wire: opaque, unique-per-editor requestId and uint64 + // canonical DECIMAL STRINGS, never a lossy double / JS Number cast. + // This G0 adapter has no supported mutating operation: an invalid/stale + // request or unsupported role must preserve the currently audible M4. + juce::var rejectUnsupportedIntent(const juce::var& intent, + const juce::var& acceptedSnapshot) { + const auto request=intent.getProperty("requestId",juce::var()); + const auto id=request.isString()?request.toString():juce::String{}; + const auto requestBytes=id.toStdString(); + const auto device=acceptedSnapshot.getProperty("device",{}); + const auto graph=acceptedSnapshot.getProperty("graph",{}); + const auto epoch=device.getProperty("epoch","0").toString(); + juce::String fault="UNIVERSAL_CALLBACK_NOT_READY"; + if(!armix::integration::validConsoleRequestId(requestBytes)) + fault="INVALID_REQUEST_ID"; + else if(completed_.find(requestBytes)!=completed_.end()) + fault="DUPLICATE_REQUEST_ID"; + else { + if(recentIds_.size()==maxRecentIds) { + completed_.erase(recentIds_.front()); + recentIds_.pop_front(); + } + recentIds_.push_back(requestBytes); + completed_.insert(requestBytes); + // G0 is fail closed by design. Distinguish malformed/stale wire + // from a legitimate mutation that requires the M4->M5 cutover. + std::uint64_t asked=0,baseGraph=0,baseRoster=0; + const bool wellFormed=decodeDecimal(intent.getProperty("deviceEpoch",{}),asked) && + decodeDecimal(intent.getProperty("baseGraphRevision",{}),baseGraph) && + decodeDecimal(intent.getProperty("baseRosterRevision",{}),baseRoster) && + intent.getProperty("operation",{}).isString(); + if(!wellFormed)fault="INVALID_DECIMAL_WIRE"; + else if(intent.getProperty("deviceEpoch",{}).toString()!=epoch) + fault="STALE_DEVICE_EPOCH"; + else if(intent.getProperty("baseGraphRevision",{}).toString()!= + graph.getProperty("revision","0").toString() || + intent.getProperty("baseRosterRevision",{}).toString()!= + graph.getProperty("rosterRevision","0").toString()) + fault="STALE_GRAPH_REVISION"; + else { + const auto target=intent.getProperty("targetChannelId",juce::var()); + armix::mixer::ChannelId channel{}; + if(!target.isVoid() && + (!target.isString() || + !armix::integration::parseNativeChannelId( + target.toString().toStdString(),channel))) + fault="INVALID_CHANNEL_ID"; + } + } + PuzzleV8Ack ack; + ack.requestId=requestBytes; + ack.status="REJECTED"; + ack.deviceEpoch=epoch.toStdString(); + ack.graphRevision=graph.getProperty("revision","0").toString().toStdString(); + ack.rosterRevision=graph.getProperty("rosterRevision","0").toString().toStdString(); + ack.errorCode=fault.toStdString(); + const auto bytes=PuzzleV8Wire::ack(ack); + return juce::JSON::parse(juce::String::fromUTF8(bytes.c_str())); + } + + + // S1 production bridge: operate the ACTUALLY INSTALLED M4 graph through + // LiveAudioEngine. A Legacy M4 lane is addressed by decimal "1".."10" + // only for this explicit internal migration transport. This does NOT + // claim that callbackOwnsChannelIds, CH11, GROUP or FX_RETURN exist. + // The same native audio owner, plugin editor and Show remain installed. + template + juce::var processProductionIntent(const juce::var& intent, + const juce::var& acceptedSnapshot, + Engine& engine,OpenEditor&& openEditor) { + const auto request=intent.getProperty("requestId",{}); + const auto requestId=request.isString()?request.toString():juce::String{}; + const auto bytes=requestId.toStdString(); + const auto device=acceptedSnapshot.getProperty("device",{}); + const auto graph=acceptedSnapshot.getProperty("graph",{}); + const auto epoch=device.getProperty("epoch","0").toString(); + const auto oldRev=graph.getProperty("revision","0").toString(); + const auto oldRoster=graph.getProperty("rosterRevision","0").toString(); + const auto legacyRev=acceptedSnapshot.getProperty("legacyM4",{}) + .getProperty("routingRevision","0").toString(); + juce::String error; + bool accepted=false; + if(!armix::integration::validConsoleRequestId(bytes))error="INVALID_REQUEST_ID"; + else if(completed_.find(bytes)!=completed_.end())error="DUPLICATE_REQUEST_ID"; + else { + if(recentIds_.size()==maxRecentIds) { + completed_.erase(recentIds_.front()); + recentIds_.pop_front(); + } + recentIds_.push_back(bytes); + completed_.insert(bytes); + std::uint64_t ep=0,rev=0,roster=0,channelId=0,m4Revision=0; + const auto target=intent.getProperty("targetChannelId",{}); + const auto payload=intent.getProperty("payload",{}); + const auto operation=intent.getProperty("operation",{}).toString(); + if(!decodeDecimal(intent.getProperty("deviceEpoch",{}),ep) || + !decodeDecimal(intent.getProperty("baseGraphRevision",{}),rev) || + !decodeDecimal(intent.getProperty("baseRosterRevision",{}),roster)) + error="INVALID_DECIMAL_WIRE"; + else if(intent.getProperty("deviceEpoch",{}).toString()!=epoch) + error="STALE_DEVICE_EPOCH"; + else if(intent.getProperty("baseGraphRevision",{}).toString()!=oldRev || + intent.getProperty("baseRosterRevision",{}).toString()!=oldRoster) + error="STALE_GRAPH_REVISION"; + // M4's presentation ordinals are NOT universal ChannelIds. + // A legacy-console intent requires an explicit independent + // revision fence. Without it, reject rather than silently + // alias the ChannelId graph's revision 0 to an M4 revision. + else if(!decodeDecimal(intent.getProperty("legacyRoutingRevision",{}), + m4Revision) || + intent.getProperty("legacyRoutingRevision","").toString()!=legacyRev) + error="STALE_LEGACY_ROUTING_REVISION"; + else if(!target.isString() || !decodeDecimal(target,channelId) || + channelId<1 || + (channelId>10 && + !((operation=="SET_MONITOR_LEVEL"|| + operation=="SET_AUX_FADER")&&channelId<=14))) + error="INVALID_LEGACY_CHANNEL_ID"; + // Never trust a guessed M4 ordinal or synthetic editor status. + // Native accepted hardware, actual route rows and the current + // topology-fault bit must have produced an explicit M4 authority + // envelope in this very same status snapshot. + else if(acceptedSnapshot.getProperty("legacyM4",{}) + .getProperty("controlPlane","").toString()!="LEGACY_M4_ORDINAL" || + !engine.dryRoutingLabActive() || + engine.dryRoutingLabEpoch()!=ep || + engine.dryRoutingLabRevision()!=m4Revision) + error="PRODUCTION_GRAPH_NOT_ADMITTED"; + else if(!payload.isObject())error="INVALID_PAYLOAD"; + else { + const int lane=static_cast(channelId-1); + if(operation=="SET_SOURCE") { + const auto id=payload.getProperty("portId",{}).toString(); + int left=-1; + if(parsePortId(id,"in:",left)) { + const auto rightId=payload.getProperty("rightPortId",{}).toString(); + int right=-1; + const auto format=payload.getProperty("sourceFormat","MONO").toString(); + if(format=="STEREO" && !parsePortId(rightId,"in:",right)) + error="INVALID_STEREO_RIGHT_PIN"; + else if(format!="MONO"&&format!="STEREO") + error="INVALID_SOURCE_FORMAT"; + else error=engine.switchDryRoutingLabSource( + lane,ep,m4Revision,format,left,right); + } else error="INVALID_PHYSICAL_INPUT_PORT"; + accepted=error.isEmpty(); + } else if(operation=="SET_FADER"||operation=="SET_PAN"|| + operation=="SET_MUTE"||operation=="SET_SOLO") { + const bool binary=operation=="SET_MUTE"||operation=="SET_SOLO"; + const auto value=payload.getProperty(binary?"value":"valueDb",{}); + juce::String key; + float control=0.f; + if(binary) { + const auto b=payload.getProperty("value",{}); + const auto on=payload.getProperty("enabled",b); + if(!on.isBool())error="INVALID_BOOLEAN_CONTROL"; + else control=static_cast(on)?1.f:0.f; + } else { + const auto number=payload.getProperty( + operation=="SET_FADER"?"valueDb":"value",{}); + if(!number.isInt()&&!number.isDouble()) + error="INVALID_NUMERIC_CONTROL"; + else { + const double v=static_cast(number); + if(!std::isfinite(v))error="NON_FINITE_CONTROL"; + else control=static_cast(v); + } + } + if(error.isEmpty()) { + if(operation=="SET_FADER")key="faderDb"; + else if(operation=="SET_PAN")key="pan"; + else if(operation=="SET_MUTE")key="mute"; + else key="solo"; + accepted=engine.setDryRoutingLabParameter( + lane,ep,m4Revision,key,control); + if(!accepted)error="NATIVE_CONTROL_REJECTED"; + } + } else if(operation=="CONNECT_AUX_SEND") { + const auto bus=payload.getProperty("auxIndex",{}); + const auto tapName=payload.getProperty("tap","POST").toString(); + const auto gain=payload.getProperty("value",{}); + const auto pan=payload.getProperty("pan",juce::var(0.0)); + if(!bus.isInt()||static_cast(bus)<0|| + static_cast(bus)>=armix::mixer::auxBusCount) + error="INVALID_AUX_RETURN"; + else if(tapName!="PRE"&&tapName!="POST") + error="INVALID_SEND_TAP"; + else if((!gain.isInt()&&!gain.isDouble())|| + (!pan.isInt()&&!pan.isDouble())) + error="INVALID_SEND_GAIN_OR_PAN"; + else { + const double level=static_cast(gain); + const double balance=static_cast(pan); + if(!std::isfinite(level)||level<0.||level>1.|| + !std::isfinite(balance)||balance< -1.||balance>1.) + error="INVALID_SEND_GAIN_OR_PAN"; + else { + error=engine.connectDryRoutingLabAuxSend( + lane,static_cast(bus),ep,m4Revision, + tapName=="PRE"?armix::mixer::SendTap::preFader: + armix::mixer::SendTap::postFader, + static_cast(level),static_cast(balance)); + accepted=error.isEmpty(); + } + } + } else if(operation=="SET_AUX_FADER") { + // Native AUX return fader AFTER its real VST3 rack. + // 11..14 are explicit legacy M4 auxiliary ordinals; + // never pretend these are stable universal ChannelIds. + if(channelId<11||channelId>14) + error="INVALID_LEGACY_AUX_CHANNEL"; + else { + const auto raw=payload.getProperty("value",{}); + if(!raw.isInt()&&!raw.isDouble()) + error="INVALID_AUX_FADER"; + else { + const double gain=static_cast(raw); + if(!std::isfinite(gain)||gain<0.||gain>4.) + error="INVALID_AUX_FADER"; + else { + accepted=engine.setDryRoutingLabAuxBusGain( + static_cast(channelId-11),ep, + m4Revision,static_cast(gain)); + if(!accepted)error="AUX_RETURN_NOT_ADMITTED"; + } + } + } + } else if(operation=="SET_MONITOR_LEVEL") { + const auto raw=payload.getProperty("value",{}); + if(!raw.isInt()&&!raw.isDouble()) + error="INVALID_MONITOR_LEVEL"; + else { + const double gain=static_cast(raw); + if(!std::isfinite(gain)||gain<0.||gain>1.) + error="INVALID_MONITOR_LEVEL"; + else { + accepted=engine.setDryRoutingLabMonitorSendGain( + lane,ep,m4Revision,static_cast(gain)); + if(!accepted)error="MONITOR_BUS_NOT_ADMITTED"; + } + } + } else if(operation=="SET_SEND_LEVEL") { + // A SEND level is native realtime PCM, NOT a new graph + // edge. Existing AUX1..4 are independent FX return buses. + const auto aux=payload.getProperty("auxIndex",{}); + const auto tapName=payload.getProperty("tap","POST").toString(); + const auto raw=payload.getProperty("value",{}); + if(!aux.isInt()||static_cast(aux)<0|| + static_cast(aux)>=armix::mixer::auxBusCount) + error="INVALID_AUX_RETURN"; + else if(tapName!="PRE"&&tapName!="POST") + error="INVALID_SEND_TAP"; + else if(!raw.isInt()&&!raw.isDouble()) + error="INVALID_SEND_LEVEL"; + else { + const double value=static_cast(raw); + if(!std::isfinite(value)||value<0.||value>1.) + error="INVALID_SEND_LEVEL"; + else { + const auto tap=tapName=="PRE"? + armix::mixer::SendTap::preFader: + armix::mixer::SendTap::postFader; + accepted=engine.setDryRoutingLabAuxSendGain( + lane,static_cast(aux),ep,m4Revision, + static_cast(value),tap); + if(!accepted)error="NATIVE_SEND_NOT_ADMITTED"; + } + } + } else if(operation=="SET_PROCESSING_FORMAT"|| + operation=="SET_PRIMARY_OUT") { + const auto nativeValue=payload.getProperty( + operation=="SET_PRIMARY_OUT"?"destinationId":"format",{}) + .toString(); + error=engine.repatchDryRoutingLabChannel( + lane,ep,m4Revision,operation,nativeValue); + accepted=error.isEmpty(); + } else if(operation=="SET_INSERT_BYPASS"|| + operation=="OPEN_INSERT_EDITOR") { + // The token must match an actually prepared vendor + // AudioPluginInstance in the current accepted M4 graph. + // Never invent a GUI insert, instantiate, clone or scan + // VST3 while changing BYPASS / opening an editor. + const auto token=payload.getProperty("insertId","").toString(); + const auto statuses=engine.status().getProperty("dryRoutingLab",{}); + const auto fx=statuses.getProperty("fxInstances",{}); + const auto* lanes=fx.getArray(); + int foundSlot=-1; + if(token.isNotEmpty() && lanes && lanesize()) { + const auto bank=lanes->getReference(lane); + if(const auto* slots=bank.getArray()) + for(int k=0;ksize();++k) + if(slots->getReference(k).getProperty("instanceId","") + .toString()==token) { + if(foundSlot>=0){foundSlot=-1;break;} + foundSlot=k; + } + } + if(foundSlot<0)error="UNKNOWN_NATIVE_INSERT_INSTANCE"; + else if(operation=="SET_INSERT_BYPASS") { + const auto value=payload.getProperty("bypassed",{}); + if(!value.isBool())error="INVALID_BYPASS_VALUE"; + else { + accepted=engine.setDryRoutingLabFxBypass( + lane,foundSlot,ep,m4Revision,token,static_cast(value)); + if(!accepted)error="NATIVE_INSERT_BYPASS_REJECTED"; + } + } else { + error=openEditor(lane,foundSlot,ep,m4Revision,token); + accepted=error.isEmpty(); + } + } else error="UNSUPPORTED_UNIVERSAL_OPERATION"; + } + } + const auto after=armix::console::LiveConsoleBridgeV6::snapshot(engine.status()); + const auto afterGraph=after.getProperty("graph",{}); + PuzzleV8Ack ack; + ack.requestId=bytes; + ack.status=accepted?"ACCEPTED":"REJECTED"; + ack.deviceEpoch=after.getProperty("device",{}).getProperty("epoch",epoch).toString().toStdString(); + ack.graphRevision=afterGraph.getProperty("revision",oldRev).toString().toStdString(); + ack.rosterRevision=afterGraph.getProperty("rosterRevision",oldRoster).toString().toStdString(); + ack.errorCode=error.toStdString(); + const auto json=PuzzleV8Wire::ack(ack); + return juce::JSON::parse(juce::String::fromUTF8(json.c_str())); + } + + + // E3 scoped native bus control transport. The installed callback already + // owns this stable ChannelId graph; output is DISARMED for structural + // changes, and readback comes from the newly accepted PCM publisher. + // This is deliberately a SEPARATE legacyM4.nativeBus namespace rather + // than claiming that universal CH11/WIRE/SHOW is available. + template + juce::var processNativeBusIntent(const juce::var& intent, + const juce::var& snapshot, + Engine& engine,bool ioBusy, + NativeFxAction&& onNativeFx) { + const auto req=intent.getProperty("requestId",juce::var()); + const auto request=req.isString()?req.toString():juce::String(); + const auto key=request.toStdString(); + const bool v8Wire=intent.getProperty("operation","").toString()== + "APPLY_WIRE_TRANSACTION"; + const auto device=snapshot.getProperty("device",juce::var()); + const auto graph=snapshot.getProperty("graph",juce::var()); + const auto legacy=snapshot.getProperty("legacyM4",juce::var()); + const auto bus=legacy.getProperty("nativeBus",juce::var()); + const auto epoch=device.getProperty("epoch","0").toString(); + juce::String error; + bool applied=false; + std::uint64_t nativeRev=0,rosterRev=0,requestedEpoch=0,legacyRevision=0; + armix::mixer::ChannelId created{}; + if(!armix::integration::validConsoleRequestId(key)) + error="INVALID_REQUEST_ID"; + else if(completed_.find(key)!=completed_.end()) + error="DUPLICATE_REQUEST_ID"; + else { + if(recentIds_.size()==maxRecentIds) { + completed_.erase(recentIds_.front());recentIds_.pop_front(); + } + recentIds_.push_back(key);completed_.insert(key); + const auto operation=intent.getProperty("operation","").toString(); + const auto payload=intent.getProperty("payload",juce::var()); + // One existing decoder, one native candidate, one PCM publisher. + const auto baseGraph=v8Wire?intent.getProperty("baseGraphRevision",{}) + :intent.getProperty("nativeGraphRevision",{}); + const auto baseRoster=v8Wire?intent.getProperty("baseRosterRevision",{}) + :intent.getProperty("nativeRosterRevision",{}); + const auto legacyBase=v8Wire?legacy.getProperty("routingRevision",{}) + :intent.getProperty("legacyRoutingRevision",{}); + if(ioBusy)error="NATIVE_SHOW_OR_BACKUP_BUSY"; + else if(!decodeDecimal(intent.getProperty("deviceEpoch",{}),requestedEpoch) || + !decodeDecimal(legacyBase,legacyRevision) || + !decodeDecimal(baseGraph,nativeRev) || + !decodeDecimal(baseRoster,rosterRev) || + intent.getProperty("deviceEpoch","").toString()!=epoch || + legacyBase.toString()!=legacy.getProperty("routingRevision","").toString()) + error="STALE_NATIVE_BUS_DEVICE_OR_ROUTE"; + else if(!bus.isObject() || + bus.getProperty("graphRevision","").toString()!=baseGraph.toString() || + bus.getProperty("rosterRevision","").toString()!=baseRoster.toString() || + legacy.getProperty("controlPlane","").toString()!="LEGACY_M4_ORDINAL") + error="NATIVE_BUS_GRAPH_NOT_ADMITTED"; + else if(v8Wire && + (graph.getProperty("revision","").toString()!=baseGraph.toString() || + graph.getProperty("rosterRevision","").toString()!=baseRoster.toString())) + error="STALE_GRAPH_REVISION"; + else if(v8Wire) { + const auto caps=graph.getProperty("capabilities",{}); + const auto ops=caps.getProperty("supportedOps",{}); + const auto* allowed=ops.getArray(); + const auto rows=graph.getProperty("channels",{}); + const auto focus=intent.getProperty("targetChannelId",{}); + armix::mixer::ChannelId parsed{}; + const bool valid=focus.isString() && + armix::integration::parseNativeChannelId( + focus.toString().toStdString(),parsed); + bool admitted=false; + if(valid)if(const auto* channels=rows.getArray()) + for(const auto& row:*channels) + if(row.getProperty("id","").toString()==focus.toString()) + {admitted=true;break;} + if(!admitted || !graph.getProperty("edges",{}).isArray() || + !static_cast(caps.getProperty("callbackOwnsChannelIds",false)) || + !allowed || !allowed->contains(juce::var(juce::String( + "APPLY_WIRE_TRANSACTION")))) + error="UNIVERSAL_WIRE_NOT_ADMITTED"; + } + if(error.isEmpty() && !payload.isObject()) + error="INVALID_NATIVE_BUS_PAYLOAD"; + if(error.isNotEmpty()) { + // Do not touch installed native audio on stale requests. + } else if(operation=="NATIVE_CREATE_CHANNEL" || + operation=="NATIVE_PATCH_CHANNEL") { + if(operation=="NATIVE_CREATE_CHANNEL") { + const auto name=payload.getProperty("name","").toString(); + const auto format=payload.getProperty("format","MONO").toString(); + if(name.isEmpty()||name.length()>64|| + (format!="MONO"&&format!="STEREO")) + error="INVALID_NATIVE_CHANNEL_REQUEST"; + else { + const auto out=engine.createNativeInputChannel( + requestedEpoch,nativeRev,rosterRev,name.toStdString(), + format=="STEREO"?armix::mixer::ProcessingFormat::stereo: + armix::mixer::ProcessingFormat::mono); + applied=out.accepted; + if(!applied)error=out.error; + else {created=out.created;nativeRev=out.pcmRevision; + rosterRev=out.rosterRevision;} + } + }else{ + std::uint64_t id=0; + const auto left=payload.getProperty("physicalLeft",juce::var()); + const auto right=payload.getProperty("physicalRight",juce::var(-1)); + const auto width=payload.getProperty("sourceFormat","MONO").toString(); + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),id)|| + id==0||!left.isInt()||!right.isInt()|| + (width!="MONO"&&width!="STEREO")) + error="INVALID_NATIVE_SOURCE_REQUEST"; + else { + const auto out=engine.patchNativeInputSource( + requestedEpoch,nativeRev,rosterRev, + armix::mixer::ChannelId{id},static_cast(left), + static_cast(right),width=="STEREO"); + applied=out.accepted; + if(!applied)error=out.error; + else {nativeRev=out.pcmRevision; + rosterRev=out.rosterRevision;} + } + } + } + else if(operation=="NATIVE_LOAD_INSERT" || + operation=="NATIVE_SET_INSERT_BYPASS" || + operation=="NATIVE_OPEN_INSERT_EDITOR") { + std::uint64_t target=0; + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),target) || + !target)error="INVALID_NATIVE_VST3_TARGET_ID"; + else { + // Native catalog ownership and VST3 instance preparation + // happen exclusively on the JUCE control thread. + const auto response=onNativeFx( + operation,armix::mixer::ChannelId{target},payload, + requestedEpoch,nativeRev,rosterRev); + applied=response.accepted; + if(!applied)error=response.error; + else {nativeRev=response.pcmRevision; + rosterRev=response.rosterRevision;} + } + } + else if(operation=="NATIVE_SET_CHANNEL_MIX"|| + operation=="NATIVE_SET_CHANNEL_MUTE_SOLO"){ + std::uint64_t id=0; + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),id)||!id) + error="INVALID_DYNAMIC_INPUT_ID"; + else if(operation=="NATIVE_SET_CHANNEL_MIX"){ + const auto g=payload.getProperty("gain",juce::var()); + const auto p=payload.getProperty("pan",juce::var()); + if(!(g.isDouble()||g.isInt())|| + !(p.isDouble()||p.isInt())) + error="INVALID_DYNAMIC_MIX_VALUE"; + else { + const auto gain=static_cast(g); + const auto pan=static_cast(p); + if(!std::isfinite(gain)||gain<0.||gain>4.|| + !std::isfinite(pan)||pan< -1.||pan>1.) + error="INVALID_DYNAMIC_MIX_VALUE"; + else { + applied=engine.setNativeInputMix( + requestedEpoch,nativeRev, + armix::mixer::ChannelId{id}, + static_cast(gain),static_cast(pan)); + if(!applied)error="DYNAMIC_INPUT_MIX_REJECTED"; + } + } + }else{ + const auto m=payload.getProperty("mute",juce::var()); + const auto s=payload.getProperty("solo",juce::var()); + if(!m.isBool()||!s.isBool()) + error="INVALID_DYNAMIC_MUTE_SOLO"; + else { + applied=engine.setNativeInputMuteSolo( + requestedEpoch,nativeRev, + armix::mixer::ChannelId{id}, + static_cast(m),static_cast(s)); + if(!applied)error="DYNAMIC_INPUT_MUTE_SOLO_REJECTED"; + } + } + } + else if(operation=="NATIVE_SET_PRIMARY_OUT") { + std::uint64_t source=0,dest=0; + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),source)|| + !source||!decodeDecimal(payload.getProperty("destinationId",{}),dest)) + error="INVALID_NATIVE_WIRE_ENDPOINT"; + else { + const auto response=engine.setNativePrimaryOutput( + requestedEpoch,nativeRev,rosterRev, + armix::mixer::ChannelId{source}, + armix::mixer::ChannelId{dest}); + applied=response.accepted; + if(!applied)error=response.error; + else {nativeRev=response.pcmRevision; + rosterRev=response.rosterRevision;} + } + } + else if(operation=="NATIVE_APPLY_WIRE_TRANSACTION" || v8Wire) { + using namespace armix::mixer; + const auto raw=payload.getProperty("changes",juce::var()); + const auto* list=raw.getArray(); + if(!list || list->isEmpty() || list->size()>256) + error="INVALID_NATIVE_WIRE_BATCH"; + else { + std::vector changes; + changes.reserve(static_cast(list->size())); + for(const auto& item:*list) { + if(!item.isObject()) { + error="INVALID_NATIVE_WIRE_CHANGE";break; + } + WireChange change; + const auto action=item.getProperty("op","").toString(); + if(action=="CONNECT")change.kind=WireChange::Kind::connect; + else if(action=="REMOVE")change.kind=WireChange::Kind::remove; + else if(action=="RETARGET")change.kind=WireChange::Kind::retarget; + else if(action=="ROUTE_ONLY")change.kind=WireChange::Kind::routeOnly; + else {error="INVALID_NATIVE_WIRE_ACTION";break;} + std::uint64_t source=0,dest=0,edge=0; + if(!decodeDecimal(item.getProperty("from",{}),source) || + source==0) { + error="INVALID_NATIVE_WIRE_SOURCE";break; + } + change.from={source}; + // MAIN focus cannot disconnect someone else's edge. + if(v8Wire && item.getProperty("from",{}).toString()!= + intent.getProperty("targetChannelId",{}).toString()) { + error="UNIVERSAL_WIRE_UNFOCUSED_SOURCE";break; + } + if(change.kind!=WireChange::Kind::remove) { + if(!decodeDecimal(item.getProperty("to",{}),dest) || + dest==0) { + error="INVALID_NATIVE_WIRE_DESTINATION";break; + } + change.to={dest}; + } + if(change.kind==WireChange::Kind::remove || + change.kind==WireChange::Kind::retarget) { + if(!decodeDecimal(item.getProperty("edgeId",{}),edge)|| + edge==0) { + error="INVALID_NATIVE_WIRE_EDGE_ID";break; + } + change.edgeId=edge; + } else { + const auto tap=item.getProperty("tap","POST_FADER").toString(); + const auto gain=item.getProperty("gainLinear",juce::var(1.)); + if(tap!="POST_FADER" || + !(gain.isDouble()||gain.isInt()) || + !std::isfinite(static_cast(gain)) || + static_cast(gain)<0. || + static_cast(gain)>4.) { + error="INVALID_NATIVE_WIRE_GAIN_OR_TAP";break; + } + change.gain=static_cast(static_cast(gain)); + } + changes.push_back(change); + } + if(error.isEmpty()) { + const auto response=engine.applyNativeWireTransaction( + requestedEpoch,nativeRev,rosterRev, + std::span(changes)); + applied=response.accepted; + if(!applied)error=response.error; + else {nativeRev=response.pcmRevision; + rosterRev=response.rosterRevision;} + } + } + } + else if(operation=="NATIVE_SET_BUS_MIX") { + std::uint64_t target=0; + const auto rawGain=payload.getProperty("gain",juce::var()); + const auto rawPan=payload.getProperty("pan",juce::var()); + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),target) || + target==0 || + !(rawGain.isInt()||rawGain.isDouble()) || + !(rawPan.isInt()||rawPan.isDouble())) + error="INVALID_NATIVE_BUS_MIX"; + else { + const auto gain=static_cast(rawGain); + const auto pan=static_cast(rawPan); + if(!std::isfinite(gain)||gain<0.||gain>4. || + !std::isfinite(pan)||pan< -1.||pan>1.) + error="INVALID_NATIVE_BUS_MIX"; + else { + applied=engine.setNativeBusMix( + requestedEpoch,nativeRev, + armix::mixer::ChannelId{target}, + static_cast(gain),static_cast(pan)); + if(!applied)error="NATIVE_BUS_MIX_REJECTED"; + } + } + } + else if(operation!="NATIVE_CREATE_GROUP_SELECTED" && + operation!="NATIVE_CREATE_FX_RETURN_SELECTED" && + operation!="NATIVE_REMOVE_BUS") + error="UNSUPPORTED_NATIVE_BUS_OPERATION"; + else { + using namespace armix::mixer; + std::vector selected; + ChannelId remove{}; + auto role=ChannelRole::group; + juce::String name; + float gain=.25f; + if(operation=="NATIVE_REMOVE_BUS") { + std::uint64_t id=0; + if(!decodeDecimal(intent.getProperty("targetChannelId",{}),id) || + id==0)error="INVALID_NATIVE_BUS_ID"; + else remove={id}; + } else { + role=operation=="NATIVE_CREATE_GROUP_SELECTED" + ?ChannelRole::group:ChannelRole::fxReturn; + name=payload.getProperty("name","").toString(); + const auto raw=payload.getProperty("selectedChannelIds",juce::var()); + const auto* ids=raw.getArray(); + const auto g=payload.getProperty("sendGain",juce::var(.25)); + const double value=static_cast(g); + if(name.isEmpty()||name.length()>64 || + !ids||ids->isEmpty()||ids->size()>64 || + !(g.isDouble()||g.isInt()) || + !std::isfinite(value)||value<0.||value>4.) { + error="INVALID_NATIVE_BUS_SELECTION"; + } else { + gain=static_cast(value); + selected.reserve(static_cast(ids->size())); + for(const auto& item:*ids) { + std::uint64_t id=0; + if(!decodeDecimal(item,id)||id==0) { + error="INVALID_NATIVE_BUS_SOURCE_ID";break; + } + selected.push_back({id}); + } + } + } + if(error.isEmpty()) { + auto result=engine.editNativeBus( + requestedEpoch,nativeRev,rosterRev,role, + std::span(selected),name.toStdString(), + gain,remove); + applied=result.accepted; + if(!applied)error=result.error; + else { + created=result.created; + nativeRev=result.pcmRevision; + rosterRev=result.rosterRevision; + } + } + } + } + // Preserve universal revision 0. Provide native namespace revision + // and created stable ID ONLY after the actual hardware PCM ACK. + PuzzleV8Ack ack; + ack.requestId=key; + ack.status=applied?"ACCEPTED":"REJECTED"; + ack.deviceEpoch=epoch.toStdString(); + ack.graphRevision=v8Wire && applied?std::to_string(nativeRev): + graph.getProperty("revision","0").toString().toStdString(); + ack.rosterRevision=v8Wire && applied?std::to_string(rosterRev): + graph.getProperty("rosterRevision","0").toString().toStdString(); + ack.errorCode=error.toStdString(); + const auto json=PuzzleV8Wire::ack(ack); + auto wire=juce::JSON::parse(juce::String::fromUTF8(json.c_str())); + if(applied)if(auto* object=wire.getDynamicObject()) { + object->setProperty("nativeGraphRevision", + juce::String(std::to_string(nativeRev))); + object->setProperty("nativeRosterRevision", + juce::String(std::to_string(rosterRev))); + object->setProperty("createdChannelId", + juce::String(std::to_string(created.value))); + } + return wire; + } + + static bool parsePortId(const juce::String& wire,const char* prefix,int& physical) { + if(!wire.startsWith(prefix))return false; + const auto text=wire.substring(static_cast(std::char_traits::length(prefix))); + std::uint64_t value=0; + if(!decodeDecimal(juce::var(text),value)||value>255)return false; + physical=static_cast(value); + return true; + } + + static bool decodeDecimal(const juce::var& raw,std::uint64_t& result) noexcept { + if(!raw.isString())return false; + const auto str=raw.toString(); + if(str.isEmpty()||str.length()>20 || + (str.length()>1 && str[0]=='0'))return false; + std::uint64_t n=0; + for(int i=0;i'9')return false; + const auto digit=static_cast(c-'0'); + if(n>(std::numeric_limits::max()-digit)/10)return false; + n=n*10+digit; + } + result=n;return true; + } + +private: + static juce::String decimalFromNative(const juce::var& value) { + if(!(value.isInt()||value.isInt64()))return "0"; + const auto n=static_cast(value); + return n>=0?juce::String(n):juce::String("0"); + } + static constexpr std::size_t maxRecentIds=256; + // Bounded completed IDs on the serialized message thread, never the + // native RT callback. Replayed old requests remain nonmutating in G0. + std::unordered_set completed_; + std::deque recentIds_; +}; +} // namespace armix::console From 74dec9ee79cbac55106f14dee0b3f271683f9069 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 07:43:43 +0700 Subject: [PATCH 154/155] ENGINE tests: retain strict legacy G0 fixture validation without restoring old integration ABI --- src/ConsoleLiveBridgeV6.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index e019f8160..a30991611 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,33 @@ // fixed strip indexes to fictitious ChannelIds. The production ChannelId // migration must replace this deliberately fail-closed G0 capability gate. // It never owns PCM, clones VST3, or calls the audio device from the browser. +// Legacy G0 fixture compatibility is confined to the TEST-only bridge. +// The shipping WebView2 uses integration/ApprovedNative* instead. These two +// pure validation functions retain the old fixture's strict uint64/replay +// contract without importing the obsolete integration/ConsoleNativeContractV6 +// into the production control boundary. +namespace armix::integration { +inline bool validConsoleRequestId(std::string_view id) noexcept { + if(id.empty() || id.size()>128)return false; + return std::all_of(id.begin(),id.end(),[](unsigned char ch) noexcept { + return ch>=0x21 && ch<=0x7e; + }); +} +inline bool parseNativeChannelId(std::string_view token,ChannelId& out) noexcept { + if(token.empty() || (token.size()>1 && token.front()=='0'))return false; + std::uint64_t value=0; + for(const char ch:token) { + if(ch<'0'||ch>'9')return false; + const auto digit=static_cast(ch-'0'); + if(value>(std::numeric_limits::max()-digit)/10u) + return false; + value=value*10u+digit; + } + if(value==0)return false; // Zero is the explicit unconnected OUT sentinel. + out=ChannelId{value};return true; +} +} // namespace armix::integration + namespace armix::console { class LiveConsoleBridgeV6 final { public: From a866186dc28a9a3b7c4efaa73af786ddc3fe725e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 5 Nov 2026 07:58:51 +0700 Subject: [PATCH 155/155] ENGINE: restore deterministic native v8 fixture required by Windows CTest --- tests/fixtures/console-v8-native-unready.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/fixtures/console-v8-native-unready.json diff --git a/tests/fixtures/console-v8-native-unready.json b/tests/fixtures/console-v8-native-unready.json new file mode 100644 index 000000000..c4b3d9549 --- /dev/null +++ b/tests/fixtures/console-v8-native-unready.json @@ -0,0 +1 @@ +{"events":[{"event":"arMixConsoleSnapshot","payload":{"schemaVersion":6,"productionCallbackLive":false,"device":{"epoch":"1","backend":"","captureDevice":"","playbackDevice":"","inputEndpoints":[],"outputEndpoints":[],"enabledInputs":[],"enabledOutputs":[],"sampleRate":null,"bufferFrames":null,"outputArmed":false},"graph":{"revision":"0","rosterRevision":"0","channels":[],"destinations":[],"capabilities":{"callbackOwnsChannelIds":false,"fullVendorFxMigration":false,"showAndOutputParity":false,"physicalCaptureMapped":false,"dynamicChannels":false,"groups":false,"fxReturns":false,"monitor":false,"sendsOnFaders":false,"supportedOps":[]}},"telemetry":{"rawCapturePresent":false,"rawCapturePeak":0,"mainPcmPresent":false,"monitorPcmPresent":false,"channelMeterRmsPeak":[]},"legacyM4":{"active":false,"routeAccepted":false,"routingRevision":"0"}}},{"event":"arMixConsoleIntent","payload":{"requestId":"native-fixture-session:1","deviceEpoch":"1","baseGraphRevision":"0","baseRosterRevision":"0","operation":"SET_SOURCE","targetChannelId":null,"payload":{}}},{"event":"arMixConsoleAck","payload":{"requestId":"native-fixture-session:1","status":"REJECTED","deviceEpoch":"1","graphRevision":"0","rosterRevision":"0","errorCode":"UNIVERSAL_CALLBACK_NOT_READY"}},{"event":"arMixConsoleSnapshot","payload":{"schemaVersion":6,"productionCallbackLive":false,"device":{"epoch":"1","backend":"","captureDevice":"","playbackDevice":"","inputEndpoints":[],"outputEndpoints":[],"enabledInputs":[],"enabledOutputs":[],"sampleRate":null,"bufferFrames":null,"outputArmed":false},"graph":{"revision":"0","rosterRevision":"0","channels":[],"destinations":[],"capabilities":{"callbackOwnsChannelIds":false,"fullVendorFxMigration":false,"showAndOutputParity":false,"physicalCaptureMapped":false,"dynamicChannels":false,"groups":false,"fxReturns":false,"monitor":false,"sendsOnFaders":false,"supportedOps":[]}},"telemetry":{"rawCapturePresent":false,"rawCapturePeak":0,"mainPcmPresent":false,"monitorPcmPresent":false,"channelMeterRmsPeak":[]},"legacyM4":{"active":false,"routeAccepted":false,"routingRevision":"0"}}}]}