From c623769f767d853b87342a4e1e9faa1ada843ff2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 09:52:03 +0700 Subject: [PATCH 01/48] feat(builtin-fx): standalone ultra-light native channel EQ with RT-safe tests --- .github/workflows/native-builtin-fx.yml | 29 +++ engine/builtin_fx/BuiltInFxCatalog.h | 32 +++ engine/builtin_fx/CMakeLists.txt | 15 ++ engine/builtin_fx/ChannelEq.h | 286 ++++++++++++++++++++++++ engine/builtin_fx/README.md | 58 +++++ tests/builtin_channel_eq_test.cpp | 235 +++++++++++++++++++ 6 files changed, 655 insertions(+) create mode 100644 .github/workflows/native-builtin-fx.yml create mode 100644 engine/builtin_fx/BuiltInFxCatalog.h create mode 100644 engine/builtin_fx/CMakeLists.txt create mode 100644 engine/builtin_fx/ChannelEq.h create mode 100644 engine/builtin_fx/README.md create mode 100644 tests/builtin_channel_eq_test.cpp diff --git a/.github/workflows/native-builtin-fx.yml b/.github/workflows/native-builtin-fx.yml new file mode 100644 index 000000000..904f4eb0e --- /dev/null +++ b/.github/workflows/native-builtin-fx.yml @@ -0,0 +1,29 @@ +name: Native Built-in FX DSP +on: + pull_request: + paths: + - 'engine/builtin_fx/**' + - 'tests/builtin_channel_eq_test.cpp' + - '.github/workflows/native-builtin-fx.yml' + workflow_dispatch: +permissions: + contents: read +concurrency: + group: native-builtinfx-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + standalone-dsp: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 8 + steps: + - uses: actions/checkout@v4 + - name: Configure no-JUCE native built-in FX + run: cmake -S engine/builtin_fx -B build-builtin-fx -DCMAKE_BUILD_TYPE=Release + - name: Compile native DSP test + run: cmake --build build-builtin-fx --config Release --parallel 2 + - name: Verify native DSP + zero heap test + run: ctest --test-dir build-builtin-fx -C Release --output-on-failure diff --git a/engine/builtin_fx/BuiltInFxCatalog.h b/engine/builtin_fx/BuiltInFxCatalog.h new file mode 100644 index 000000000..23e39acbc --- /dev/null +++ b/engine/builtin_fx/BuiltInFxCatalog.h @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include +#include +#include + +// This is a compile-time catalog of NATIVE effects, not a VST3/FactoryFX manifest. +// Never advertise these as usable in the operator picker until the native PCM +// owner and ACK/snapshot adapter have actually been integrated. +namespace armix::builtin_fx { +inline constexpr std::string_view channelEqId = "armix.builtin.channel-eq.v1"; + +enum class FilterKind : std::uint8_t { highPass, lowShelf, bell, highShelf, lowPass }; +enum class Slope : std::uint8_t { db12 = 12, db24 = 24 }; +struct SlotSpec { + std::string_view id; + FilterKind kind; + float defaultHz; +}; +inline constexpr std::array channelEqSlots{{ + {"hpf", FilterKind::highPass, 80.0f}, + {"low-shelf", FilterKind::lowShelf, 160.0f}, + {"peq-1", FilterKind::bell, 250.0f}, + {"peq-2", FilterKind::bell, 500.0f}, + {"peq-3", FilterKind::bell, 1500.0f}, + {"peq-4", FilterKind::bell, 4500.0f}, + {"high-shelf",FilterKind::highShelf, 9500.0f}, + {"lpf", FilterKind::lowPass, 18000.0f} +}}; +static_assert(channelEqSlots.size() == 8); +} // namespace armix::builtin_fx diff --git a/engine/builtin_fx/CMakeLists.txt b/engine/builtin_fx/CMakeLists.txt new file mode 100644 index 000000000..a13274320 --- /dev/null +++ b/engine/builtin_fx/CMakeLists.txt @@ -0,0 +1,15 @@ +# Optional JUCE-independent developer/CI gate for the built-in DSP module. +# cmake -S engine/builtin_fx -B build/builtin_fx +# cmake --build build/builtin_fx --config Release +# ctest --test-dir build/builtin_fx -C Release --output-on-failure +cmake_minimum_required(VERSION 3.22) +project(ArSonMixBuiltInFX LANGUAGES CXX) +enable_testing() +add_executable(ArSonMixBuiltInEQTests ../../tests/builtin_channel_eq_test.cpp) +target_compile_features(ArSonMixBuiltInEQTests PRIVATE cxx_std_20) +if(MSVC) + target_compile_options(ArSonMixBuiltInEQTests PRIVATE /W4) +else() + target_compile_options(ArSonMixBuiltInEQTests PRIVATE -Wall -Wextra -Wpedantic) +endif() +add_test(NAME BuiltInChannelEqIndependentRealtimeDSP COMMAND ArSonMixBuiltInEQTests) diff --git a/engine/builtin_fx/ChannelEq.h b/engine/builtin_fx/ChannelEq.h new file mode 100644 index 000000000..b67841f74 --- /dev/null +++ b/engine/builtin_fx/ChannelEq.h @@ -0,0 +1,286 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "BuiltInFxCatalog.h" +#include +#include +#include +#include +#include +#include +#include + +// Channel strip EQ for the main native mixer ONLY. Deliberately no JUCE, +// VST3, ArSonEQ, FFT, WebView2, heap allocation or audio callback ownership. +// prepare() and setBand()/resetToFlat() must be called by the SAME exclusive +// audio/graph owner at safe block boundaries, never concurrently with process(). +namespace armix::builtin_fx { +struct Band { + bool enabled = false; + float frequencyHz = 1000.0f; + float gainDb = 0.0f; + float q = 0.70710678f; + Slope slope = Slope::db12; // HPF/LPF only; other types ignore it. +}; + +class ChannelEq final { +public: + static constexpr std::size_t bandCount = channelEqSlots.size(); + static constexpr float maxGainDb = 18.0f; + static constexpr float minQ = 0.2f; + static constexpr float maxQ = 12.0f; + + ChannelEq() noexcept { + for (std::size_t i = 0; i < bandCount; ++i) { + current_.settings[i].frequencyHz = channelEqSlots[i].defaultHz; + current_.settings[i].q = channelEqSlots[i].kind == FilterKind::bell ? 1.0f : 0.70710678f; + } + } + + // Prepares without allocating. Enabled filters above the new Nyquist guard + // cause rejection (caller must explicitly choose a safe setting). + bool prepare(double sampleRate) noexcept { + if (!std::isfinite(sampleRate) || sampleRate < 8000.0 || sampleRate > 384000.0) + return false; + const float maxHz = static_cast(std::min(20000.0, sampleRate * 0.45)); + Bank next = current_; + for (std::size_t i = 0; i < bandCount; ++i) { + auto& band = next.settings[i]; + if (!band.enabled) band.frequencyHz = std::min(band.frequencyHz, maxHz); + if (!validBand(i, band, maxHz)) return false; + } + next.activeCount = 0; + for (std::size_t i = 0; i < bandCount; ++i) { + next.slots[i] = Slot{}; + if (next.settings[i].enabled) { + if (!makeSlot(channelEqSlots[i].kind, next.settings[i], sampleRate, next.slots[i])) + return false; + next.active[next.activeCount++] = static_cast(i); + } + } + sampleRate_ = sampleRate; + current_ = next; + previous_ = Bank{}; + fadeLength_ = std::max(1, static_cast(std::round(sampleRate * 0.005))); + fadeRemaining_ = 0; + prepared_ = true; + return true; + } + + bool setBand(std::size_t index, const Band& band) noexcept { + if (!prepared_ || index >= bandCount || + !validBand(index, band, maxFrequencyHz())) return false; + const auto& old = current_.settings[index]; + if (old.enabled == band.enabled && old.frequencyHz == band.frequencyHz && + old.gainDb == band.gainDb && old.q == band.q && old.slope == band.slope) return true; + Bank next = current_; // bounded stack copy, no allocation + next.settings[index] = band; + next.slots[index] = Slot{}; + if (band.enabled && !makeSlot(channelEqSlots[index].kind, band, sampleRate_, next.slots[index])) + return false; // existing DSP and settings remain untouched + next.activeCount = 0; + for (std::size_t i = 0; i < bandCount; ++i) + if (next.settings[i].enabled) + next.active[next.activeCount++] = static_cast(i); + previous_ = current_; // old path retains its filter state during crossfade + current_ = next; + fadeRemaining_ = fadeLength_; + return true; + } + + bool resetToFlat() noexcept { + if (!prepared_) return false; + if (current_.activeCount == 0) return true; + previous_ = current_; + for (std::size_t i = 0; i < bandCount; ++i) { + current_.settings[i].enabled = false; + current_.slots[i] = Slot{}; + } + current_.activeCount = 0; + fadeRemaining_ = fadeLength_; + return true; + } + + [[nodiscard]] Band band(std::size_t index) const noexcept { + return index < bandCount ? current_.settings[index] : Band{}; + } + [[nodiscard]] bool isPrepared() const noexcept { return prepared_; } + [[nodiscard]] double sampleRate() const noexcept { return sampleRate_; } + [[nodiscard]] float maxFrequencyHz() const noexcept { + return static_cast(std::min(20000.0, sampleRate_ * 0.45)); + } + [[nodiscard]] std::size_t activeBands() const noexcept { return current_.activeCount; } + [[nodiscard]] int addedLatencySamples() const noexcept { return 0; } + [[nodiscard]] bool transitioning() const noexcept { return fadeRemaining_ > 0; } + + // Processing and all biquad histories are audio-owner exclusive. + // left==right is explicitly one mono buffer, never double processed. + void processStereo(float* left, float* right, std::size_t frames) noexcept { + if (!prepared_ || !left || !right || frames == 0) return; + if (left == right) { processMono(left, frames); return; } + if (current_.activeCount == 0 && fadeRemaining_ == 0) return; // exact bitwise bypass + for (std::size_t i = 0; i < frames; ++i) { + const float dryL = left[i], dryR = right[i]; + const float wetL = render(current_, 0, dryL), wetR = render(current_, 1, dryR); + if (fadeRemaining_ > 0) { + const float oldL = render(previous_, 0, dryL); + const float oldR = render(previous_, 1, dryR); + const float mix = 1.0f - static_cast(fadeRemaining_ - 1) / + static_cast(fadeLength_); + left[i] = oldL + (wetL - oldL) * mix; + right[i] = oldR + (wetR - oldR) * mix; + --fadeRemaining_; + } else { left[i] = wetL; right[i] = wetR; } + } + clearTiny(current_); + if (fadeRemaining_ != 0) clearTiny(previous_); + } + + void processMono(float* samples, std::size_t frames) noexcept { + if (!prepared_ || !samples || frames == 0 || + (current_.activeCount == 0 && fadeRemaining_ == 0)) return; + for (std::size_t i = 0; i < frames; ++i) { + const float dry = samples[i]; + const float wet = render(current_, 0, dry); + if (fadeRemaining_ > 0) { + const float old = render(previous_, 0, dry); + const float mix = 1.0f - static_cast(fadeRemaining_ - 1) / + static_cast(fadeLength_); + samples[i] = old + (wet - old) * mix; + --fadeRemaining_; + } else samples[i] = wet; + } + clearTiny(current_); + if (fadeRemaining_ != 0) clearTiny(previous_); + } + + // Control-side visualization only. Never call while an audio callback is + // mutating this instance. Host should snapshot coefficients off callback. + [[nodiscard]] double responseDb(double frequencyHz) const noexcept { + if (!prepared_ || !std::isfinite(frequencyHz) || frequencyHz <= 0.0 || + frequencyHz >= sampleRate_ * 0.5) return 0.0; + const double w = twoPi * frequencyHz / sampleRate_; + const std::complex z1 = std::polar(1.0, -w); + const auto z2 = z1 * z1; + double result = 0.0; + for (std::uint8_t k = 0; k < current_.activeCount; ++k) { + const auto& s = current_.slots[current_.active[k]]; + for (std::uint8_t j = 0; j < s.count; ++j) { + const auto& c = s.section[j]; + const auto numerator = c.b0 + c.b1 * z1 + c.b2 * z2; + const auto denominator = 1.0 + c.a1 * z1 + c.a2 * z2; + const double mag = std::abs(numerator / denominator); + result += 20.0 * std::log10(std::max(1.0e-12, mag)); + } + } + return std::clamp(result, -160.0, 80.0); + } + +private: + static constexpr double twoPi = 6.283185307179586476925286766559; + struct Section { + double b0=1, b1=0, b2=0, a1=0, a2=0; + double z1[2]{}, z2[2]{}; + float process(int channel, float input) noexcept { + const double x = static_cast(input); + const double out = b0 * x + z1[channel]; + z1[channel] = b1 * x - a1 * out + z2[channel]; + z2[channel] = b2 * x - a2 * out; + return static_cast(out); + } + void denormalGuard() noexcept { + for (int i = 0; i < 2; ++i) { + if (std::abs(z1[i]) < 1.0e-24) z1[i] = 0; + if (std::abs(z2[i]) < 1.0e-24) z2[i] = 0; + } + } + }; + struct Slot { std::array section{}; std::uint8_t count=0; }; + struct Bank { + std::array settings{}; + std::array slots{}; + std::array active{}; + std::uint8_t activeCount=0; + }; + Bank current_{}, previous_{}; + double sampleRate_ = 0.0; + int fadeLength_ = 1, fadeRemaining_ = 0; + bool prepared_ = false; + + static bool validBand(std::size_t i, const Band& b, float maxHz) noexcept { + if (i >= bandCount || !std::isfinite(b.frequencyHz) || + !std::isfinite(b.gainDb) || !std::isfinite(b.q) || + b.frequencyHz < 20.0f || b.frequencyHz > maxHz || + b.gainDb < -maxGainDb || b.gainDb > maxGainDb || + b.q < minQ || b.q > maxQ) return false; + return b.slope == Slope::db12 || b.slope == Slope::db24; + } + static bool normalized(Section& s, double b0, double b1, double b2, + double a0, double a1, double a2) noexcept { + if (!std::isfinite(a0) || std::abs(a0) < 1.0e-12) return false; + s.b0 = b0 / a0; s.b1 = b1 / a0; s.b2 = b2 / a0; + s.a1 = a1 / a0; s.a2 = a2 / a0; + return std::isfinite(s.b0) && std::isfinite(s.b1) && std::isfinite(s.b2) && + std::isfinite(s.a1) && std::isfinite(s.a2); + } + static bool makeBiquad(FilterKind kind, const Band& b, double sampleRate, + double q, Section& out) noexcept { + const double omega = twoPi * b.frequencyHz / sampleRate; + const double c = std::cos(omega), s = std::sin(omega); + const double a = std::pow(10.0, static_cast(b.gainDb) / 40.0); + const double alpha = s / (2.0 * q); + switch (kind) { + case FilterKind::bell: + return normalized(out, 1.0+alpha*a, -2.0*c, 1.0-alpha*a, + 1.0+alpha/a, -2.0*c, 1.0-alpha/a); + case FilterKind::highPass: + return normalized(out, (1+c)*0.5, -(1+c), (1+c)*0.5, + 1+alpha, -2*c, 1-alpha); + case FilterKind::lowPass: + return normalized(out, (1-c)*0.5, 1-c, (1-c)*0.5, + 1+alpha, -2*c, 1-alpha); + case FilterKind::lowShelf: { + const double edge = s * std::sqrt(a) * std::sqrt(2.0); + return normalized(out, + a*((a+1)-(a-1)*c+edge), 2*a*((a-1)-(a+1)*c), + a*((a+1)-(a-1)*c-edge), + (a+1)+(a-1)*c+edge, -2*((a-1)+(a+1)*c), + (a+1)+(a-1)*c-edge); + } + case FilterKind::highShelf: { + const double edge = s * std::sqrt(a) * std::sqrt(2.0); + return normalized(out, + a*((a+1)+(a-1)*c+edge), -2*a*((a-1)+(a+1)*c), + a*((a+1)+(a-1)*c-edge), + (a+1)-(a-1)*c+edge, 2*((a-1)-(a+1)*c), + (a+1)-(a-1)*c-edge); + } + } + return false; + } + static bool makeSlot(FilterKind kind, const Band& b, double rate, Slot& result) noexcept { + const bool cut = kind == FilterKind::highPass || kind == FilterKind::lowPass; + result.count = static_cast(cut && b.slope == Slope::db24 ? 2 : 1); + if (result.count == 2) { + return makeBiquad(kind, b, rate, 0.541196100146197, result.section[0]) && + makeBiquad(kind, b, rate, 1.306562964876377, result.section[1]); + } + return makeBiquad(kind, b, rate, cut ? 0.7071067811865476 : b.q, + result.section[0]); + } + static float render(Bank& bank, int channel, float sample) noexcept { + for (std::uint8_t i = 0; i < bank.activeCount; ++i) { + auto& slot = bank.slots[bank.active[i]]; + for (std::uint8_t j = 0; j < slot.count; ++j) + sample = slot.section[j].process(channel, sample); + } + return sample; + } + static void clearTiny(Bank& bank) noexcept { + for (std::uint8_t i = 0; i < bank.activeCount; ++i) { + auto& slot = bank.slots[bank.active[i]]; + for (std::uint8_t j = 0; j < slot.count; ++j) + slot.section[j].denormalGuard(); + } + } +}; +} // namespace armix::builtin_fx diff --git a/engine/builtin_fx/README.md b/engine/builtin_fx/README.md new file mode 100644 index 000000000..f1d0bc1d8 --- /dev/null +++ b/engine/builtin_fx/README.md @@ -0,0 +1,58 @@ +# ArSonMix native built-in FX (not FactoryFX/VST3) + +This folder is owned by `masarray/arsonmix`. **It does not depend on or modify +ArSonEQ**, whose advanced 24-band/dynamic/M-S/FabFilter-class development remains +independent. `FactoryFX/` elsewhere means separately packaged user/factory +**VST3 plugins**, not native mixer effects. Do not put this source into VST3 +scan/packaging flows. + +## Initial native DSP module + +- `BuiltInFxCatalog.h`: compile-time identity `armix.builtin.channel-eq.v1` + and stable 8-slot IDs: HPF / low shelf / PEQ 1–4 / high shelf / LPF. +- `ChannelEq.h`: minimal portable C++20, eight fixed slots, max ten IIR biquad + sections, active-slot fast path, 12/24 dB/oct HPF/LPF, +/-18 dB PEQ/shelves, + frequency/Q validation, per-instance stereo filter memories, 5ms old/new + bank crossfade. No analyzer, dynamic EQ, M/S, oversampling, WebView, JUCE, + VST3 loader, heap allocations, mutexes, FFT or additional sample buffering. +- `CMakeLists.txt`: self-contained standalone headless native CTest using the + same `tests/builtin_channel_eq_test.cpp` as the main project; no JUCE needed. + +## Safe integration contract (not implemented by this folder-only candidate) + +One `ChannelEq` per **accepted ChannelId** and audio epoch, initialized at the +actual device sample rate. The existing **single** native audio callback owns +`processMono/processStereo` in-place on its existing prepared channel PCM. An +accepted control command is scheduled at an **audio block boundary**; call +`setBand`/`resetToFlat` only on that exclusive owner. **Never call those from a +WebView/UI/control thread while processing**. DSP has no independent callback or +worker and cannot obtain an audio input device. + +Typical chain is verified hardware IN -> trim -> channel EQ -> existing vendor +FX rack -> fader -> PRE/POST sends -> MAIN, but binding this point requires +review of the current single-owner native graph. Default disabled EQ must be +bitwise-transparent. The rack-wide FX bypass is separate from the channel EQ +and must preserve individual insert states. UI is added to the **one approved** +`/preview/` component system only when native snapshot/ACK and Show recall +are implemented; a browser illustration must never claim live audio. + +Control packet must carry validated decimal-string ChannelId, device epoch and +base graph revision. After native accept, browser still needs a matching +snapshot with all 8 band settings and computed response. Readback and response +must be prepared from the exclusive owner or an immutable copy off callback; +never sample live biquad histories on another thread. Show save/restore owns +logical settings, not a plugin binary, and must preserve applied revision. +Rapid automation during an unfinished 5ms transition needs explicit owner +queue/coalescing validation before host integration; this candidate does not +claim click-free arbitrary multiwriter automation. + +## Validation and release status + +This is a **real native DSP and tests**, but **not yet wired to ArSonMix audio +PCM or UI**. No new buttons, routes or VST3 scan are installed by this code. +This is intentionally separate from ongoing P0 mixer recovery and native FX +rack/WIRE PRs. Run standalone CTest; Windows final host build, actual CPU +benchmarks, physical ASIO/driver FAT and accepted GUI integration are separate +release gates. `addedLatencySamples()==0` means no DSP buffering/lookahead; +minimum-phase IIR still has frequency-dependent group delay, and hardware +roundtrip latency is not zero. diff --git a/tests/builtin_channel_eq_test.cpp b/tests/builtin_channel_eq_test.cpp new file mode 100644 index 000000000..effc079e4 --- /dev/null +++ b/tests/builtin_channel_eq_test.cpp @@ -0,0 +1,235 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#include "../engine/builtin_fx/ChannelEq.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { +std::atomic noHeap{false}; +[[noreturn]] void fail(const char* test) noexcept { + std::fprintf(stderr, "FAIL: %s\n", test); + std::abort(); +} +void check(bool ok, const char* test) noexcept { if (!ok) fail(test); } +bool near(double actual, double expected, double tolerance) noexcept { + return std::abs(actual-expected) <= tolerance; +} +} // namespace + +// Optional hard tripwire: processing/configuration must never request heap. +void* operator new(std::size_t n) { + if (noHeap.load(std::memory_order_relaxed)) fail("heap allocation in built-in DSP"); + if (auto* p=std::malloc(n?n:1)) return p; + throw std::bad_alloc(); +} +void* operator new[](std::size_t n) { + if (noHeap.load(std::memory_order_relaxed)) fail("heap allocation in built-in DSP[]"); + if (auto* p=std::malloc(n?n:1)) return p; + throw std::bad_alloc(); +} +void operator delete(void* p) noexcept { std::free(p); } +void operator delete[](void* p) noexcept { std::free(p); } +void operator delete(void* p, std::size_t) noexcept { std::free(p); } +void operator delete[](void* p, std::size_t) noexcept { std::free(p); } + +using namespace armix::builtin_fx; +static Band onBand(ChannelEq& eq, std::size_t slot, float freq, float gain=0.0f, + float q=1.0f, Slope slope=Slope::db12) { + Band b=eq.band(slot); + b.enabled=true; b.frequencyHz=freq; b.gainDb=gain; b.q=q; b.slope=slope; + check(eq.setBand(slot,b),"set band accepted"); + return b; +} +static void runUntilSettled(ChannelEq& eq) { + std::array l{},r{}; + while(eq.transitioning())eq.processStereo(l.data(),r.data(),l.size()); +} +static void testCatalogAndDefault() { + check(channelEqId=="armix.builtin.channel-eq.v1","stable built-in ID"); + check(ChannelEq::bandCount==8,"eight slots exactly"); + check(channelEqSlots[0].kind==FilterKind::highPass,"fixed HPF slot"); + check(channelEqSlots[7].kind==FilterKind::lowPass,"fixed LPF slot"); + for(int rate : {44100,48000,96000}) { + ChannelEq eq; + check(eq.prepare(rate),"prepare sample rate"); + check(eq.activeBands()==0,"all filters off on first launch"); + check(eq.addedLatencySamples()==0,"no buffering/lookahead"); + std::array l{},r{}; + for (std::size_t i=0;i(i)*0.001f - 0.05f; + r[i]=1.0f-l[i]; + } + const auto unchangedL=l,unchangedR=r; + eq.processStereo(l.data(),r.data(),l.size()); + check(l==unchangedL&&r==unchangedR,"exact transparent disabled stereo"); + eq.processMono(l.data(),l.size()); + check(l==unchangedL,"exact transparent disabled mono"); + eq.processStereo(nullptr,nullptr,128); + eq.processMono(nullptr,128); + } + ChannelEq lowSample; + check(lowSample.prepare(8000),"8k rate supported"); + check(lowSample.band(7).frequencyHz<=3600.f,"disabled default clamps below Nyquist"); + check(!lowSample.prepare(0)&&!lowSample.prepare(std::numeric_limits::infinity()),"invalid sample rate rejected"); +} +static void testResponse() { + ChannelEq eq; + check(eq.prepare(48000),"prepare"); + check(near(eq.responseDb(1000),0,1e-10),"off response flat"); + onBand(eq,2,1000,6,1); + check(near(eq.responseDb(1000),6,0.07),"PEQ +6 dB center"); + check(std::abs(eq.responseDb(30))<1,"bell does not affect DC region much"); + onBand(eq,1,160,5,1); + check(eq.responseDb(30)>4,"low shelf +5dB low frequency"); + onBand(eq,6,8000,-5,1); + check(eq.responseDb(15000)<-3,"high shelf attenuates high frequencies"); + ChannelEq cuts; + check(cuts.prepare(48000),"prepare cuts"); + onBand(cuts,0,100,0,.707f,Slope::db12); + const double hpf12=cuts.responseDb(25); + check(hpf12<-22 && hpf12>-29,"HPF 12 dB/oct falloff"); + onBand(cuts,0,100,0,.707f,Slope::db24); + check(cuts.responseDb(25)::infinity(), + std::numeric_limits::quiet_NaN()}) { + auto b=base;b.enabled=true;b.frequencyHz=invalid; + check(!eq.setBand(3,b),"invalid frequency rejected"); + } + auto b=base;b.enabled=true;b.gainDb=21.f; + check(!eq.setBand(3,b),"invalid gain rejected"); + b=base;b.enabled=true;b.q=0.0f; + check(!eq.setBand(3,b),"invalid q rejected"); + b=base;b.enabled=true;b.slope=static_cast(99); + check(!eq.setBand(3,b),"invalid slope rejected"); + check(!eq.setBand(8,base),"invalid slot rejected"); + check(eq.activeBands()==0,"failed writes leave existing state unchanged"); + onBand(eq,2,1000,9); + runUntilSettled(eq); + const auto before=eq.band(2); + auto wrong=before;wrong.frequencyHz=30000; + check(!eq.setBand(2,wrong),"failed update leaves active filter untouched"); + check(eq.band(2).frequencyHz==before.frequencyHz,"readback unchanged on rejected edit"); + check(eq.resetToFlat(),"reset all in one transition"); + runUntilSettled(eq); + check(eq.activeBands()==0 && near(eq.responseDb(1000),0,0.0001),"flat reset"); + check(!eq.transitioning(),"reset fade completed"); +} +static void testAudibleProcessingAndIndependence() { + ChannelEq eq; + check(eq.prepare(48000),"prepare"); + onBand(eq,2,1000,12,0.7f); + runUntilSettled(eq); + constexpr int n=128; + std::array left{}, right{}; + left[0]=1.0f; + eq.processStereo(left.data(),right.data(),left.size()); + check(left[0]>0.0f,"first sample delivered, no initial buffer/latency"); + check(std::all_of(right.begin(),right.end(),[](float v){return v==0.f;}),"no L->R leakage"); + ChannelEq mono; + check(mono.prepare(48000),"mono prepare"); + onBand(mono,2,1000,12,0.7f); + runUntilSettled(mono); + std::array x{};x[0]=1; + mono.processStereo(x.data(),x.data(),x.size()); // alias -> once only + check(near(x[0],left[0],1e-6),"alias-safe stereo uses mono path once"); + + ChannelEq gate; + check(gate.prepare(48000),"gate prepare"); + onBand(gate,1,160,6,1); + runUntilSettled(gate); + std::array held{};held.fill(1.f); + for(int i=0;i<16;++i) { held.fill(1.f); gate.processMono(held.data(),held.size()); } + check(held.back()>1.7,"actual LF shelf modifies PCM"); + const float previousWet = held.back(); + check(gate.resetToFlat(),"bypass request"); + held.fill(1.f); + gate.processMono(held.data(),held.size()); + check(std::abs(held[0]-previousWet)<0.1f,"start bypass transition follows last wet output"); + check(near(held.back(),1.0,1e-6),"finished bypass returns exact dry PCM"); + check(!gate.transitioning(),"bypass ramp completed"); +} +static void testFourteenIndependentChannels() { + // 10 CH + 4 AUX. Test per-channel filter/history isolation, not 14 EQs + // accidentally chained into a single PCM buffer. + std::array lanes{}; + for(auto& eq:lanes)check(eq.prepare(48000),"14 independent preparations"); + onBand(lanes[0],2,1000,9,0.7f); + runUntilSettled(lanes[0]); + onBand(lanes[13],0,120,0,0.707f,Slope::db24); + runUntilSettled(lanes[13]); + std::array,14> left{},right{}; + std::array reference1000{},reference60{}; + for(unsigned repeat=0;repeat<64;++repeat) { + for(std::size_t i=0;i(repeat*reference1000.size()+i)/48000.0; + reference1000[i]=0.1f*std::sin(6.283185307179586*t*1000.0); + reference60[i]=0.1f*std::sin(6.283185307179586*t*60.0); + } + for(std::size_t lane=0;lane(reference1000[i])*reference1000[i]; + boost1000+=static_cast(left[0][i])*left[0][i]; + dry60+=static_cast(reference60[i])*reference60[i]; + cut60+=static_cast(left[13][i])*left[13][i]; + } + check(boost1000>dry1000*4,"CH01 independent PEQ boost is audible PCM"); + check(cut60 l{},r{}; + for (auto count : {32u,64u,128u,512u}) { + l.fill(0.12f);r.fill(-0.07f); + auto hp=eq.band(0);hp.enabled=true;hp.frequencyHz=90+static_cast(count)/10.f; + hp.slope=Slope::db24; + noHeap.store(true,std::memory_order_release); + const bool ok=eq.setBand(0,hp); + if(ok)eq.processStereo(l.data(),r.data(),count); + noHeap.store(false,std::memory_order_release); + check(ok,"parameter writes without allocation"); + check(std::isfinite(l[0])&&std::isfinite(l[count-1])&& + std::isfinite(r[count-1]),"variable quantum finite stereo"); + } +} +int main() { + testCatalogAndDefault(); + testResponse(); + testValidationAndReset(); + testAudibleProcessingAndIndependence(); + testNoHeapAndVariableQuantum(); + testFourteenIndependentChannels(); + std::puts("PASS: ArSonMix built-in 8-slot native Channel EQ; no ArSonEQ/VST3 dependency"); +} From 1d4c38566fef89aa1ea904268048185e87b4494c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 09:59:05 +0700 Subject: [PATCH 02/48] fix(builtin-eq): precompute coefficients off audio callback; apply bounded validated packet on RT owner --- engine/builtin_fx/ChannelEq.h | 103 ++++++++++++++++++++++++------ engine/builtin_fx/README.md | 17 +++-- tests/builtin_channel_eq_test.cpp | 38 ++++++++++- 3 files changed, 132 insertions(+), 26 deletions(-) diff --git a/engine/builtin_fx/ChannelEq.h b/engine/builtin_fx/ChannelEq.h index b67841f74..1ba53b149 100644 --- a/engine/builtin_fx/ChannelEq.h +++ b/engine/builtin_fx/ChannelEq.h @@ -11,8 +11,10 @@ // Channel strip EQ for the main native mixer ONLY. Deliberately no JUCE, // VST3, ArSonEQ, FFT, WebView2, heap allocation or audio callback ownership. -// prepare() and setBand()/resetToFlat() must be called by the SAME exclusive -// audio/graph owner at safe block boundaries, never concurrently with process(). +// prepare()/setBand() operate on UNPUBLISHED instances (or in offline tests). +// For live edits, prepareBandEdit() performs all trig on CONTROL; applyPreparedBand() +// performs only bounded copies on the exclusive audio owner at a block boundary. +// No state mutation may race process(), and no UI thread reads live histories. namespace armix::builtin_fx { struct Band { bool enabled = false; @@ -36,6 +38,79 @@ class ChannelEq final { } } + // CONTROL creates a precomputed change without accessing a live EQ. + // A bounded queue/immutable handoff outside this module transports it to + // the audio owner. sampleRate acts as a device-epoch-independent fence; + // the mixer adapter must ALSO validate ChannelId, epoch, and revision. + struct PreparedBandEdit final { + Band band{}; + std::size_t index=bandCount; + double sampleRate=0.0; + std::array,2> coefficients{}; // b0,b1,b2,a1,a2 + std::uint8_t sections=0; + bool valid=false; + }; + + static bool prepareBandEdit(std::size_t index, const Band& band, + double sampleRate, PreparedBandEdit& output) noexcept { + if (!std::isfinite(sampleRate) || sampleRate < 8000.0 || + sampleRate > 384000.0 || + !validBand(index,band,static_cast(std::min(20000.0,sampleRate*0.45)))) + return false; + Slot compiled{}; + if (band.enabled && !makeSlot(channelEqSlots[index].kind,band,sampleRate,compiled)) + return false; + PreparedBandEdit candidate{}; + candidate.band=band; + candidate.index=index; + candidate.sampleRate=sampleRate; + candidate.sections=compiled.count; + for (std::uint8_t i=0;i=bandCount || + edit.sampleRate!=sampleRate_ || + !validBand(edit.index,edit.band,maxFrequencyHz())) return false; + const auto kind=channelEqSlots[edit.index].kind; + const bool cut=kind==FilterKind::highPass||kind==FilterKind::lowPass; + const std::uint8_t expected=edit.band.enabled ? + static_cast(cut && edit.band.slope==Slope::db24 ? 2 : 1) : 0; + if (edit.sections!=expected) return false; + Slot newSlot{}; + newSlot.count=expected; + for(std::uint8_t i=0;i(i); + previous_=current_; + current_=next; + fadeRemaining_=fadeLength_; + return true; + } + // Prepares without allocating. Enabled filters above the new Nyquist guard // cause rejection (caller must explicitly choose a safe setting). bool prepare(double sampleRate) noexcept { @@ -66,25 +141,13 @@ class ChannelEq final { return true; } + // Offline/unpublished convenience, NOT for the live audio callback: + // this computes trigonometric coefficients. Use prepareBandEdit() on the + // CONTROL thread and applyPreparedBand() on AUDIO for live automation. bool setBand(std::size_t index, const Band& band) noexcept { - if (!prepared_ || index >= bandCount || - !validBand(index, band, maxFrequencyHz())) return false; - const auto& old = current_.settings[index]; - if (old.enabled == band.enabled && old.frequencyHz == band.frequencyHz && - old.gainDb == band.gainDb && old.q == band.q && old.slope == band.slope) return true; - Bank next = current_; // bounded stack copy, no allocation - next.settings[index] = band; - next.slots[index] = Slot{}; - if (band.enabled && !makeSlot(channelEqSlots[index].kind, band, sampleRate_, next.slots[index])) - return false; // existing DSP and settings remain untouched - next.activeCount = 0; - for (std::size_t i = 0; i < bandCount; ++i) - if (next.settings[i].enabled) - next.active[next.activeCount++] = static_cast(i); - previous_ = current_; // old path retains its filter state during crossfade - current_ = next; - fadeRemaining_ = fadeLength_; - return true; + if(!prepared_)return false; + PreparedBandEdit edit{}; + return prepareBandEdit(index,band,sampleRate_,edit) && applyPreparedBand(edit); } bool resetToFlat() noexcept { diff --git a/engine/builtin_fx/README.md b/engine/builtin_fx/README.md index f1d0bc1d8..fc67f7810 100644 --- a/engine/builtin_fx/README.md +++ b/engine/builtin_fx/README.md @@ -13,8 +13,10 @@ scan/packaging flows. - `ChannelEq.h`: minimal portable C++20, eight fixed slots, max ten IIR biquad sections, active-slot fast path, 12/24 dB/oct HPF/LPF, +/-18 dB PEQ/shelves, frequency/Q validation, per-instance stereo filter memories, 5ms old/new - bank crossfade. No analyzer, dynamic EQ, M/S, oversampling, WebView, JUCE, - VST3 loader, heap allocations, mutexes, FFT or additional sample buffering. + bank crossfade. Live `prepareBandEdit()` computes coefficients on CONTROL; + `applyPreparedBand()` applies them on AUDIO without trigonometry. No analyzer, + dynamic EQ, M/S, oversampling, WebView, JUCE, VST3 loader, heap allocations, + mutexes, FFT or additional sample buffering. - `CMakeLists.txt`: self-contained standalone headless native CTest using the same `tests/builtin_channel_eq_test.cpp` as the main project; no JUCE needed. @@ -23,9 +25,14 @@ scan/packaging flows. One `ChannelEq` per **accepted ChannelId** and audio epoch, initialized at the actual device sample rate. The existing **single** native audio callback owns `processMono/processStereo` in-place on its existing prepared channel PCM. An -accepted control command is scheduled at an **audio block boundary**; call -`setBand`/`resetToFlat` only on that exclusive owner. **Never call those from a -WebView/UI/control thread while processing**. DSP has no independent callback or +accepted control command is first compiled using +`ChannelEq::prepareBandEdit()` **off callback**. Its small immutable packet is +handed to the existing bounded control queue and then +`applyPreparedBand()` is invoked on the exclusive audio owner **at a block +boundary**. `setBand()` is an offline / unpublished-graph convenience only, +never invoke it in the live callback (it computes trig). The audio owner can +also call the cheap `resetToFlat()` at a safe block boundary. **Never mutate +the live instance from the WebView/UI/control thread while processing**. DSP has no independent callback or worker and cannot obtain an audio input device. Typical chain is verified hardware IN -> trim -> channel EQ -> existing vendor diff --git a/tests/builtin_channel_eq_test.cpp b/tests/builtin_channel_eq_test.cpp index effc079e4..bd6c280d4 100644 --- a/tests/builtin_channel_eq_test.cpp +++ b/tests/builtin_channel_eq_test.cpp @@ -207,6 +207,39 @@ static void testFourteenIndependentChannels() { check(lanes[1].activeBands()==0 && lanes[0].activeBands()==1 && lanes[13].activeBands()==1,"stable per-channel configuration state"); } +static void testPrecomputedControlToAudioBoundary() { + ChannelEq eq; + check(eq.prepare(48000),"precompute destination prepared"); + auto band=eq.band(4); + band.enabled=true;band.frequencyHz=2000;band.gainDb=7.0f;band.q=1.2f; + ChannelEq::PreparedBandEdit packet{}; + check(ChannelEq::prepareBandEdit(4,band,48000,packet),"precompute control packet"); + check(packet.valid&&packet.sections==1,"precomputed one PEQ biquad"); + std::array l{},r{}; + l[0]=1.f; + noHeap.store(true,std::memory_order_release); + const bool accepted=eq.applyPreparedBand(packet); + if(accepted)eq.processStereo(l.data(),r.data(),l.size()); + noHeap.store(false,std::memory_order_release); + check(accepted,"audio owner applies precomputed packet"); + check(eq.activeBands()==1&&eq.band(4).gainDb==7.0f,"accepted DSP readback"); + check(l[0]>0.0f,"precomputed audio sample delivered"); + + ChannelEq changedRate; + check(changedRate.prepare(44100),"changed rate instance"); + check(!changedRate.applyPreparedBand(packet),"stale sample rate packet rejected"); + check(changedRate.activeBands()==0,"stale packet no partial application"); + ChannelEq::PreparedBandEdit invalidPacket=packet; + invalidPacket.sections=99; + check(!eq.applyPreparedBand(invalidPacket),"untrusted section count rejected"); + invalidPacket=packet; + invalidPacket.coefficients[0][0]=std::numeric_limits::quiet_NaN(); + // Force meaningful change so duplicate same-state shortcut cannot conceal + // a malformed coefficient payload. + invalidPacket.band.gainDb=8.0f; + check(!eq.applyPreparedBand(invalidPacket),"malformed filter coefficient rejected"); + check(eq.band(4).gainDb==7.0f,"rejected packet does not replace DSP state"); +} static void testNoHeapAndVariableQuantum() { ChannelEq eq; check(eq.prepare(48000),"prepare"); @@ -215,8 +248,10 @@ static void testNoHeapAndVariableQuantum() { l.fill(0.12f);r.fill(-0.07f); auto hp=eq.band(0);hp.enabled=true;hp.frequencyHz=90+static_cast(count)/10.f; hp.slope=Slope::db24; + ChannelEq::PreparedBandEdit prepared{}; + check(ChannelEq::prepareBandEdit(0,hp,48000,prepared),"control precomputes HPF"); noHeap.store(true,std::memory_order_release); - const bool ok=eq.setBand(0,hp); + const bool ok=eq.applyPreparedBand(prepared); if(ok)eq.processStereo(l.data(),r.data(),count); noHeap.store(false,std::memory_order_release); check(ok,"parameter writes without allocation"); @@ -229,6 +264,7 @@ int main() { testResponse(); testValidationAndReset(); testAudibleProcessingAndIndependence(); + testPrecomputedControlToAudioBoundary(); testNoHeapAndVariableQuantum(); testFourteenIndependentChannels(); std::puts("PASS: ArSonMix built-in 8-slot native Channel EQ; no ArSonEQ/VST3 dependency"); From 5531018566cb9c0799f52e92771cabdddb67b743 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 10:26:26 +0700 Subject: [PATCH 03/48] feat(builtin-eq): real PCM hook in single render graph, RT-safe 14-lane DSP/ACK queues --- engine/builtin_fx/CMakeLists.txt | 9 ++ engine/builtin_fx/ChannelEqBank.h | 136 +++++++++++++++++++++++++ engine/builtin_fx/README.md | 25 +++++ engine/core/LiveChannelFxGraph.h | 16 +++ src/LiveDryRoutingLab.h | 26 ++++- tests/builtin_channel_eq_bank_test.cpp | 75 ++++++++++++++ tests/live_channel_fx_graph_test.cpp | 42 ++++++++ 7 files changed, 328 insertions(+), 1 deletion(-) create mode 100644 engine/builtin_fx/ChannelEqBank.h create mode 100644 tests/builtin_channel_eq_bank_test.cpp diff --git a/engine/builtin_fx/CMakeLists.txt b/engine/builtin_fx/CMakeLists.txt index a13274320..558812cc0 100644 --- a/engine/builtin_fx/CMakeLists.txt +++ b/engine/builtin_fx/CMakeLists.txt @@ -13,3 +13,12 @@ else() target_compile_options(ArSonMixBuiltInEQTests PRIVATE -Wall -Wextra -Wpedantic) endif() add_test(NAME BuiltInChannelEqIndependentRealtimeDSP COMMAND ArSonMixBuiltInEQTests) + +add_executable(ArSonMixBuiltInEQBankTests ../../tests/builtin_channel_eq_bank_test.cpp) +target_compile_features(ArSonMixBuiltInEQBankTests PRIVATE cxx_std_20) +if(MSVC) + target_compile_options(ArSonMixBuiltInEQBankTests PRIVATE /W4) +else() + target_compile_options(ArSonMixBuiltInEQBankTests PRIVATE -Wall -Wextra -Wpedantic) +endif() +add_test(NAME BuiltInChannelEqFourteenChannelAudioOwnerAndAck COMMAND ArSonMixBuiltInEQBankTests) diff --git a/engine/builtin_fx/ChannelEqBank.h b/engine/builtin_fx/ChannelEqBank.h new file mode 100644 index 000000000..5ddcffef1 --- /dev/null +++ b/engine/builtin_fx/ChannelEqBank.h @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "ChannelEq.h" +#include +#include +#include +#include +#include + +// Real-time bridge between one JUCE control-thread owner and the ONLY native +// audio callback. The DSP is native; this is NOT a VST3 loader or second engine. +namespace armix::builtin_fx { +namespace detail { +template class SpscRing final { + static_assert(Capacity > 1 && Capacity < 65536); +public: + // Exactly ONE producer and ONE consumer; serial control events only. + bool push(const T& value) noexcept { + const auto write = write_.load(std::memory_order_relaxed); + if (write - read_.load(std::memory_order_acquire) >= Capacity) return false; + storage_[write % Capacity] = value; + write_.store(write + 1, std::memory_order_release); + return true; + } + bool pop(T& value) noexcept { + const auto read = read_.load(std::memory_order_relaxed); + if (read == write_.load(std::memory_order_acquire)) return false; + value = storage_[read % Capacity]; + read_.store(read + 1, std::memory_order_release); + return true; + } + [[nodiscard]] bool canPush() const noexcept { + return write_.load(std::memory_order_relaxed) - + read_.load(std::memory_order_acquire) < Capacity; + } +private: + alignas(64) std::atomic write_{0}; + alignas(64) std::atomic read_{0}; + std::array storage_{}; +}; +} // namespace detail + +class ChannelEqBank final { +public: + static constexpr std::size_t laneCount = 14; // 10 physical CH + 4 AUX; no fake MASTER + static constexpr std::size_t maxPendingPerLane = 32; + struct Ack final { + std::uint64_t requestId = 0; + std::uint64_t deviceEpoch = 0; + std::uint64_t graphRevision = 0; + std::uint8_t lane = 0; + std::uint8_t slot = 0; + Band accepted{}; + bool applied = false; + }; + ChannelEqBank() = default; + ChannelEqBank(const ChannelEqBank&) = delete; + ChannelEqBank& operator=(const ChannelEqBank&) = delete; + + // Call BEFORE publishing a graph to the audio callback. Never prepare a + // published graph; its state is exclusively advanced by the audio owner. + bool prepare(double sampleRate) noexcept { + if (ready_) return false; + if (!std::isfinite(sampleRate) || sampleRate < 8000.0 || sampleRate > 384000.0) + return false; + for (auto& eq : eqs_) if (!eq.prepare(sampleRate)) return false; + sampleRate_ = sampleRate; + ready_ = true; + return true; + } + [[nodiscard]] bool ready() const noexcept { return ready_; } + [[nodiscard]] double sampleRate() const noexcept { return sampleRate_; } + [[nodiscard]] int addedLatencySamples() const noexcept { return 0; } + + // Control thread: trigonometry/validation happens HERE, never on audio. + // Success only means QUEUED, not applied. Host must wait for pollAck() + // and then publish an authoritative accepted snapshot to the GUI. + bool queueBandEdit(std::size_t lane, std::size_t slot, const Band& band, + std::uint64_t requestId, std::uint64_t deviceEpoch, + std::uint64_t graphRevision) noexcept { + if (!ready_ || lane >= laneCount || slot >= ChannelEq::bandCount || + requestId == 0 || deviceEpoch == 0 || graphRevision == 0) + return false; + ChannelEq::PreparedBandEdit prepared{}; + if (!ChannelEq::prepareBandEdit(slot, band, sampleRate_, prepared)) return false; + return pending_[lane].push(Command{requestId,deviceEpoch,graphRevision, + static_cast(lane),static_cast(slot),prepared}); + } + // Only on UNPUBLISHED graphs / offline fixtures. No concurrent callback. + bool setBandOffline(std::size_t lane, std::size_t slot,const Band& band) noexcept { + return ready_ && lane < laneCount && eqs_[lane].setBand(slot,band); + } + // AUDIO OWNER ONLY. At most one filter change per strip per block, and + // never start another 5ms topology fade before the previous one ends. + // A full acknowledgement ring BACKPRESSURES the request queue; it must + // never silently apply a command whose ACK was lost. + void render(std::size_t lane, float* left, float* right, + std::size_t frames) noexcept { + if (!ready_ || lane >= laneCount || !left || !right || frames == 0) return; + auto& eq = eqs_[lane]; + if (!eq.transitioning() && acknowledgements_[lane].canPush()) { + Command command{}; + if (pending_[lane].pop(command)) { + const bool applied = eq.applyPreparedBand(command.edit); + Ack ack{command.requestId,command.deviceEpoch,command.graphRevision, + command.lane,command.slot,command.edit.band,applied}; + // Can only fail if another thread illegally writes the same + // SPSC consumer ACK ring. The producer cannot fill it. + (void)acknowledgements_[lane].push(ack); + } + } + eq.processStereo(left,right,frames); + } + // Control thread: drain after audio block; validate the ACK's graph epoch + // and revision AGAIN before changing the public accepted UI state. + bool pollAck(std::size_t lane, Ack& result) noexcept { + return lane < laneCount && acknowledgements_[lane].pop(result); + } + // Tests and UNPUBLISHED topology authoring only; querying while render() + // runs is a data race. Live readbacks MUST use the ACK value. + [[nodiscard]] Band offlineBand(std::size_t lane, std::size_t slot) const noexcept { + return lane < laneCount ? eqs_[lane].band(slot) : Band{}; + } +private: + struct Command final { + std::uint64_t requestId=0,deviceEpoch=0,graphRevision=0; + std::uint8_t lane=0,slot=0; + ChannelEq::PreparedBandEdit edit{}; + }; + std::array eqs_{}; + std::array,laneCount> pending_{}; + std::array,laneCount> acknowledgements_{}; + double sampleRate_=0.0; + bool ready_=false; +}; +} // namespace armix::builtin_fx diff --git a/engine/builtin_fx/README.md b/engine/builtin_fx/README.md index fc67f7810..9120817fa 100644 --- a/engine/builtin_fx/README.md +++ b/engine/builtin_fx/README.md @@ -63,3 +63,28 @@ benchmarks, physical ASIO/driver FAT and accepted GUI integration are separate release gates. `addedLatencySamples()==0` means no DSP buffering/lookahead; minimum-phase IIR still has frequency-dependent group delay, and hardware roundtrip latency is not zero. + +## Live PCM seam (P1 integration on the PR branch only) + +The existing `LiveChannelFxGraph` is the ONLY native audio owner. The graph +prepares a `ChannelEqBank` using the ACTUAL negotiated sample rate on its +control thread, then calls `render(strip,L,R,frames)` immediately before the +existing vendor FX racks in the SAME `PreparedMixerBlock::process` channel +callback. All 14 lanes are flat and bitwise transparent on first launch. +A new SPSC control-to-audio queue accepts precomputed immutable edits and +an independent bounded ACK ring communicates actual applied settings back +to the message thread, with request ID + original device epoch + graph +revision. When a previous 5ms fade is running, the next edit waits for the +next block; queue saturation rejects without mutating DSP. Never treat a +QUEUED command as applied, or ACK from an old epoch as a new accepted state. + +The isolated graph seam is **not an operator feature** until a host command +adapter, stable ChannelId lookup, state preservation across topology changes, +Show recall and the sole approved `/preview/` control with matching accepted +ACK/snapshot have been proven. This PR must not be merged as a finished EQ +plugin or released as an audible operator feature before those gates pass. +See `tests/builtin_channel_eq_bank_test.cpp` for bounded queue / ACK fixtures. + +Reference mathematics: W3C Audio EQ Cookbook (RBJ), 2021, +https://www.w3.org/TR/audio-eq-cookbook/ . Interaction inspiration: FL Studio +Fruity Parametric EQ, **not a copy of its source code, icons, or artwork**. diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index 281b172f9..5f5212813 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -2,6 +2,7 @@ #pragma once #include "PreparedMixerBlock.h" #include "FxBypassEnvelope.h" +#include "../builtin_fx/ChannelEqBank.h" #include #include #include @@ -191,6 +192,16 @@ class LiveChannelFxGraph final { bool setAuxSendGain(int source,int bus,float gain) noexcept { return setAuxSendGain(source,bus,SendTap::postFader,gain); } + using BuiltInEqAck=armix::builtin_fx::ChannelEqBank::Ack; + bool prepareBuiltInEq(double rate) noexcept {return builtinEq_.prepare(rate);} + bool queueBuiltInEqEdit(int lane,std::size_t slot,const armix::builtin_fx::Band& b, + std::uint64_t req,std::uint64_t epoch,std::uint64_t rev) noexcept { + return lane>=0&&lane(lane),slot,b,req,epoch,rev); + } // producer on control; success = queued, not applied + bool pollBuiltInEqAck(int lane,BuiltInEqAck& ack) noexcept { + return lane>=0&&lane(lane),ack); + } // control-only, validate epoch/rev before UI use int activeInserts() const noexcept{return activeInserts_;} bool setStripControl(int channel,float gain,float pan, bool mono,bool mute,bool solo) noexcept { @@ -294,6 +305,10 @@ class LiveChannelFxGraph final { auto channelFx=[this,externalContext,externalFx] (int strip,float* l,float* r,int samples) noexcept { if(strip<0||strip>=fxSlots)return; + // In-place channel EQ before existing vendor VST3 inserts/PRE sends. + // Default OFF is bitwise-transparent; no second callback. + builtinEq_.render(static_cast(strip),l,r, + static_cast(samples)); const int count=counts_[strip]; // immutable, prepared OFF RT if(count>0) { for(int slot=0;slot block_; RealtimeStripControls controls_ {}; FxBank processors_ {}; diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 82f5ea88b..bd8addf78 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -308,6 +308,9 @@ class LiveDryRoutingLab final { juce::jlimit(32,Block::hardFrameLimit,deviceFrames)); if(!next->prepared || next->prepared->capacity()==0) return "Cannot allocate routing workspace"; + // Must use verified active hardware rate, never assume 48k. + if(!next->prepared->prepareBuiltInEq(sampleRate)) + return "Invalid native channel EQ device sample rate"; if(!next->prepared->setMainOutputPair( mainLeft,mainRight,callbackOutputCount_.load(std::memory_order_acquire))) return "MAIN output patch references invalid callback channels"; @@ -1842,7 +1845,28 @@ class LiveDryRoutingLab final { } // Status / control thread only. An empty prepared graph is ready, but // cannot be advertised as a LIVE patched route or a savable Show. - bool hasExplicitRoute() const noexcept { + using BuiltInEqAck=FxGraph::BuiltInEqAck; + // CONTROL enqueue via the existing published graph lease, never change + // live coefficients from UI; one SPSC producer and one audio consumer. + bool queueBuiltInEqEdit(int lane,std::size_t slot, + const armix::builtin_fx::Band& band, + std::uint64_t requestId,std::uint64_t expectedEpoch, + std::uint64_t expectedRevision) noexcept { + if(!ready()||!hasExplicitRoute()||requestId==0||lane<0||lane>=fxSlots|| + expectedEpoch!=epoch()||expectedRevision!=revision())return false; + return publisher_.updateActiveControl(expectedEpoch,expectedRevision, + [&](FxGraph& graph) noexcept {return graph.queueBuiltInEqEdit( + lane,slot,band,requestId,expectedEpoch,expectedRevision);}); + } + bool pollBuiltInEqAck(int lane,std::uint64_t expectedEpoch, + std::uint64_t expectedRevision,BuiltInEqAck& ack) noexcept { + if(!ready()||lane<0||lane>=fxSlots|| + expectedEpoch!=epoch()||expectedRevision!=revision())return false; + return publisher_.updateActiveControl(expectedEpoch,expectedRevision, + [&](FxGraph& graph) noexcept {return graph.pollBuiltInEqAck(lane,ack);}) && + ack.deviceEpoch==expectedEpoch&&ack.graphRevision==expectedRevision; + } + bool hasExplicitRoute() const noexcept { return ready() && acceptedRoute_.isObject(); } std::uint64_t epoch() const noexcept { diff --git a/tests/builtin_channel_eq_bank_test.cpp b/tests/builtin_channel_eq_bank_test.cpp new file mode 100644 index 000000000..81f5f7293 --- /dev/null +++ b/tests/builtin_channel_eq_bank_test.cpp @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#include "../engine/builtin_fx/ChannelEqBank.h" +#include +#include + +#include +#include +#include +#include +static std::atomic denyHeap{false}; +void* operator new(std::size_t n) {if(denyHeap.load()) std::abort();if(void* p=std::malloc(n?n:1))return p;throw std::bad_alloc();} +void* operator new[](std::size_t n) {if(denyHeap.load())std::abort();if(void* p=std::malloc(n?n:1))return p;throw std::bad_alloc();} +void operator delete(void* p) noexcept {std::free(p);}void operator delete[](void* p) noexcept{std::free(p);} +void operator delete(void* p,std::size_t) noexcept{std::free(p);}void operator delete[](void* p,std::size_t) noexcept{std::free(p);} +static void require(bool v, const char* expression, int line) {if(!v){std::fprintf(stderr,"FAIL at %d: %s\n",line,expression);std::abort();}} +#define CHECK(e) require(bool(e),#e,__LINE__) +using namespace armix::builtin_fx; +int main() { + ChannelEqBank bank; + CHECK(!bank.ready());CHECK(!bank.queueBandEdit(0,2,Band{},1,1,1)); + CHECK(bank.prepare(48000));CHECK(!bank.prepare(44100)); + CHECK(bank.addedLatencySamples()==0); + std::array l{},r{}; + for(std::size_t i=0;iaudio/ACK, no realtime heap"); +} diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index 515c7481c..5f9441ff9 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -1874,6 +1874,47 @@ static void verifyChannelIdGroupPreservesHostedFx() { live.unpublish();live.pollRetirement(); } + +static void verifyBuiltInEqRealPcmHook() { + constexpr std::array physicalPorts{2,5}; + ChannelRoutingConfig config; + config.stripsAndMaster.strips[0]={SourceMode::mono,2,-1,1.f,0.f,false,false}; + SendRequest sends; + PreparedRenderGraph plan;RenderError error; + assert(PreparedRenderGraph::compile(config,physicalPorts,sends,plan,error)); + auto wet=std::make_unique(plan,128,128); + auto dry=std::make_unique(plan,128,128); + assert(wet->prepareBuiltInEq(48000)&&dry->prepareBuiltInEq(48000)); + armix::builtin_fx::Band b{}; + b.enabled=true;b.frequencyHz=1000;b.gainDb=9;b.q=1; + assert(!wet->queueBuiltInEqEdit(0,2,b,0,7,2)); + assert(wet->queueBuiltInEqEdit(0,2,b,101,7,2)); + std::array pcm{},silent{},wl{},wr{},dl{},dr{}; + const float* pins[]{pcm.data(),silent.data()}; + double dryPower=0,wetPower=0; + for(int block=0;block<64;++block) { + for(int i=0;i<128;++i) { + pcm[static_cast(i)]=static_cast( + .1*std::sin(6.283185307179586*1000*(block*128+i)/48000.0)); + } + const auto before=heapCalls.load(std::memory_order_relaxed); + assert(wet->process(pins,2,wl.data(),wr.data(),128)); + assert(dry->process(pins,2,dl.data(),dr.data(),128)); + assert(heapCalls.load(std::memory_order_relaxed)==before); + if(block==0) { + LiveChannelFxGraph::BuiltInEqAck ack{}; + assert(wet->pollBuiltInEqAck(0,ack)); + assert(ack.applied&&ack.requestId==101&&ack.deviceEpoch==7&& + ack.graphRevision==2&&ack.slot==2); + } + if(block>=48)for(int i=0;i<128;++i) { + dryPower+=dl[static_cast(i)]*dl[static_cast(i)]; + wetPower+=wl[static_cast(i)]*wl[static_cast(i)]; + } + } + assert(dryPower>0.001&&wetPower>dryPower*4); +} + int main(int argc,char** argv) { if(argc==2 && std::string(argv[1])=="--emit-console-s0-json") { verifyNativePuzzleV8FixtureAndWire(); @@ -2250,6 +2291,7 @@ int main(int argc,char** argv) { // 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. + verifyBuiltInEqRealPcmHook(); verifyUniversalChannelIdFxLeaseAndLivePcm(); verifyMU1LegacyM4FxFullMigrationAndMonitorPcm(); verifyOccupiedExternalCh1Owner(); From 38873c26e4fc744b0ef923dbf6749aecb31c66a1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 10:37:43 +0700 Subject: [PATCH 04/48] fix(builtin-eq): preserve one EQ bank across M4 and accepted ChannelId PCM with exact IDs --- engine/core/DynamicNativeSessionPublisher.h | 61 ++++++++++++++++++- engine/core/LiveChannelFxGraph.h | 15 +++-- .../core/UnifiedLegacyProductionAdmission.h | 7 +++ src/LiveDryRoutingLab.h | 21 ++++++- 4 files changed, 96 insertions(+), 8 deletions(-) diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index c767600af..ea1536573 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -4,6 +4,8 @@ #include "DynamicConsoleRoutingView.h" #include "RealtimeRoutePublisher.h" #include "RealtimeRenderPermit.h" +#include "../builtin_fx/ChannelEqBank.h" +#include #include #include #include @@ -28,6 +30,10 @@ class DynamicNativeSessionPublisher final { 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; + // Built-in native EQ is independent of the vendor VST3 plan. + // Populated on initial M4→ChannelId admission, never on callback. + std::shared_ptr builtInEq; + std::array builtInEqIds{}; bool valid() const noexcept { return (!owner&&!context&&!render&&!deviceEpoch&&!graphRevision) || (owner&&context==owner.get()&&render&& @@ -39,6 +45,8 @@ class DynamicNativeSessionPublisher final { DynamicPreparedMixerBlock graph; DynamicConsoleRoutingView routing; FxPlan fx; // SAME lifetime and revision as native PCM graph + std::shared_ptr builtInEq; + std::array builtInEqIds{}; int physicalInputs=0; bool monitor=false; }; @@ -102,6 +110,17 @@ class DynamicNativeSessionPublisher final { report.fault=Fault::invalidGraph;return report; } prepared->physicalInputs=request.physicalInputs; + // Preserve the single RT-owned EQ state across native graph changes. + // The old/new graph leases hold the same prepared bank; the existing + // render gate ensures only one producer can mutate filter histories. + const auto* prior=publisher_.controlPrepared(proposedDeviceEpoch,expectedRevision); + if(prior && prior->builtInEq) { + prepared->builtInEq=prior->builtInEq; // CONTROL refcount only + prepared->builtInEqIds=prior->builtInEqIds; // exact stable IDs + } else { + prepared->builtInEq=fx.builtInEq; + prepared->builtInEqIds=fx.builtInEqIds; + } prepared->fx=std::move(fx); // one accepted control-plane publication prepared->monitor=std::any_of(roster.channels().begin(), roster.channels().end(),[](const ChannelStripDefinition& row) { @@ -178,6 +197,17 @@ class DynamicNativeSessionPublisher final { // 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 { + // Independent minimum-phase EQ BEFORE vendor inserts, exactly + // once per native ChannelId strip. Unmapped extra native buses + // pass through flat; never guess their identity by strip index. + if(auto* eq=snap->prepared->builtInEq.get()) { + for(std::size_t lane=0;laneprepared->builtInEqIds.size();++lane) { + if(snap->prepared->builtInEqIds[lane]==id) { + eq->render(lane,l,r,static_cast(n)); + break; + } + } + } const auto& acceptedFx=snap->prepared->fx; if(acceptedFx.render) acceptedFx.render(acceptedFx.context,id,l,r,n); @@ -199,7 +229,36 @@ class DynamicNativeSessionPublisher final { return current?¤t->routing:nullptr; } - // M3C realtime parameters on the accepted ChannelId graph ONLY. + // CONTROL APIs: actual native ChannelId identity, no ordinal fallback. + // success = queued only; ACK is generated exclusively by AUDIO render. + bool queueBuiltInEqEdit(std::uint64_t epoch,std::uint64_t revision,ChannelId id, + std::size_t slot,const armix::builtin_fx::Band& band, + std::uint64_t requestId) noexcept { + if(!requestId||!id.value)return false; + return publisher_.updateActiveControl(epoch,revision, + [&](Prepared& p) noexcept { + if(!p.builtInEq)return false; + for(std::size_t lane=0;lanequeueBandEdit(lane,slot,band, + requestId,epoch,revision); + return false; + }); + } + bool pollBuiltInEqAck(std::uint64_t epoch,std::uint64_t revision,ChannelId id, + armix::builtin_fx::ChannelEqBank::Ack& ack) noexcept { + if(!id.value)return false; + return publisher_.updateActiveControl(epoch,revision, + [&](Prepared& p) noexcept { + if(!p.builtInEq)return false; + for(std::size_t lane=0;lanepollAck(lane,ack); + return false; + }) && ack.deviceEpoch==epoch && ack.graphRevision==revision; + } + + // 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, diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index 5f5212813..5a1ac651a 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -193,14 +193,18 @@ class LiveChannelFxGraph final { return setAuxSendGain(source,bus,SendTap::postFader,gain); } using BuiltInEqAck=armix::builtin_fx::ChannelEqBank::Ack; - bool prepareBuiltInEq(double rate) noexcept {return builtinEq_.prepare(rate);} + bool prepareBuiltInEq(double rate) noexcept {return builtinEq_ && builtinEq_->prepare(rate);} + // CONTROL-only lease for migration to the accepted native ChannelId + // renderer. Lifetime pinned by BOTH graph publishers, not the GUI. + std::shared_ptr + builtInEqLease() const noexcept {return builtinEq_;} bool queueBuiltInEqEdit(int lane,std::size_t slot,const armix::builtin_fx::Band& b, std::uint64_t req,std::uint64_t epoch,std::uint64_t rev) noexcept { - return lane>=0&&lane=0&&lanequeueBandEdit( static_cast(lane),slot,b,req,epoch,rev); } // producer on control; success = queued, not applied bool pollBuiltInEqAck(int lane,BuiltInEqAck& ack) noexcept { - return lane>=0&&lane(lane),ack); + return lane>=0&&lanepollAck(static_cast(lane),ack); } // control-only, validate epoch/rev before UI use int activeInserts() const noexcept{return activeInserts_;} bool setStripControl(int channel,float gain,float pan, @@ -307,7 +311,7 @@ class LiveChannelFxGraph final { if(strip<0||strip>=fxSlots)return; // In-place channel EQ before existing vendor VST3 inserts/PRE sends. // Default OFF is bitwise-transparent; no second callback. - builtinEq_.render(static_cast(strip),l,r, + builtinEq_->render(static_cast(strip),l,r, static_cast(samples)); const int count=counts_[strip]; // immutable, prepared OFF RT if(count>0) { @@ -326,7 +330,8 @@ class LiveChannelFxGraph final { } private: - armix::builtin_fx::ChannelEqBank builtinEq_{}; + std::shared_ptr builtinEq_{ + std::make_shared()}; std::unique_ptr block_; RealtimeStripControls controls_ {}; FxBank processors_ {}; diff --git a/engine/core/UnifiedLegacyProductionAdmission.h b/engine/core/UnifiedLegacyProductionAdmission.h index 37d431806..a48ed6c2d 100644 --- a/engine/core/UnifiedLegacyProductionAdmission.h +++ b/engine/core/UnifiedLegacyProductionAdmission.h @@ -181,6 +181,13 @@ class UnifiedLegacyProductionAdmission final { (*static_cast(ctx))(id,l,r,n); }; plan.deviceEpoch=deviceEpoch;plan.graphRevision=expectedPcmRevision+1; + // One shared lightweight native DSP owner across M4→ChannelId + // cutover. Do NOT instantiate ArSonEQ/VST3 or reset user curves. + plan.builtInEq=acceptedM4Fx.builtInEqLease(); + for(int i=0;i(i)]=candidate.ids.inputs[i]; + for(int b=0;b(stripCount+b)]=candidate.ids.aux[b]; result.native=publisher.commit(candidate.roster,candidate.request, expectedPcmRevision,deviceEpoch,currentHardwareEpoch, allOutputsDisarmed,std::move(plan)); diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index bd8addf78..3c5d86e55 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1853,7 +1853,16 @@ class LiveDryRoutingLab final { std::uint64_t requestId,std::uint64_t expectedEpoch, std::uint64_t expectedRevision) noexcept { if(!ready()||!hasExplicitRoute()||requestId==0||lane<0||lane>=fxSlots|| - expectedEpoch!=epoch()||expectedRevision!=revision())return false; + expectedEpoch!=epoch())return false; + if(channelIdPhysicalPcmActive()) { + if(expectedRevision!=nativeAccepted_.pcmRevision)return false; + const auto id=lane(lane)] + :nativeAccepted_.graph.ids.aux[static_cast(lane-count)]; + return nativePublisher_.queueBuiltInEqEdit(expectedEpoch,expectedRevision, + id,slot,band,requestId); + } + if(expectedRevision!=revision())return false; return publisher_.updateActiveControl(expectedEpoch,expectedRevision, [&](FxGraph& graph) noexcept {return graph.queueBuiltInEqEdit( lane,slot,band,requestId,expectedEpoch,expectedRevision);}); @@ -1861,7 +1870,15 @@ class LiveDryRoutingLab final { bool pollBuiltInEqAck(int lane,std::uint64_t expectedEpoch, std::uint64_t expectedRevision,BuiltInEqAck& ack) noexcept { if(!ready()||lane<0||lane>=fxSlots|| - expectedEpoch!=epoch()||expectedRevision!=revision())return false; + expectedEpoch!=epoch())return false; + if(channelIdPhysicalPcmActive()) { + if(expectedRevision!=nativeAccepted_.pcmRevision)return false; + const auto id=lane(lane)] + :nativeAccepted_.graph.ids.aux[static_cast(lane-count)]; + return nativePublisher_.pollBuiltInEqAck(expectedEpoch,expectedRevision,id,ack); + } + if(expectedRevision!=revision())return false; return publisher_.updateActiveControl(expectedEpoch,expectedRevision, [&](FxGraph& graph) noexcept {return graph.pollBuiltInEqAck(lane,ack);}) && ack.deviceEpoch==expectedEpoch&&ack.graphRevision==expectedRevision; From fd45be7e3b38a834a5c83d64f6885370424cffd9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 10:41:34 +0700 Subject: [PATCH 05/48] test(builtin-eq): native ChannelId PCM owner regression + stale revision rejection --- engine/builtin_fx/ChannelEqBank.h | 12 ++++- engine/core/DynamicNativeSessionPublisher.h | 3 +- engine/core/LiveChannelFxGraph.h | 14 ++++- src/LiveDryRoutingLab.h | 2 + tests/live_channel_fx_graph_test.cpp | 57 +++++++++++++++++++++ 5 files changed, 84 insertions(+), 4 deletions(-) diff --git a/engine/builtin_fx/ChannelEqBank.h b/engine/builtin_fx/ChannelEqBank.h index 5ddcffef1..943f53e46 100644 --- a/engine/builtin_fx/ChannelEqBank.h +++ b/engine/builtin_fx/ChannelEqBank.h @@ -95,13 +95,21 @@ class ChannelEqBank final { // A full acknowledgement ring BACKPRESSURES the request queue; it must // never silently apply a command whose ACK was lost. void render(std::size_t lane, float* left, float* right, - std::size_t frames) noexcept { + std::size_t frames, + std::uint64_t activeEpoch=0, + std::uint64_t activeRevision=0) noexcept { if (!ready_ || lane >= laneCount || !left || !right || frames == 0) return; auto& eq = eqs_[lane]; if (!eq.transitioning() && acknowledgements_[lane].canPush()) { Command command{}; if (pending_[lane].pop(command)) { - const bool applied = eq.applyPreparedBand(command.edit); + // Structural re-publication may inherit this bank. Do not + // apply a queued edit from a superseded epoch/revision. + const bool sessionMatches = (activeEpoch==0 && activeRevision==0) || + (command.deviceEpoch==activeEpoch && + command.graphRevision==activeRevision); + const bool applied = sessionMatches && + eq.applyPreparedBand(command.edit); Ack ack{command.requestId,command.deviceEpoch,command.graphRevision, command.lane,command.slot,command.edit.band,applied}; // Can only fail if another thread illegally writes the same diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index ea1536573..009637cf2 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -203,7 +203,8 @@ class DynamicNativeSessionPublisher final { if(auto* eq=snap->prepared->builtInEq.get()) { for(std::size_t lane=0;laneprepared->builtInEqIds.size();++lane) { if(snap->prepared->builtInEqIds[lane]==id) { - eq->render(lane,l,r,static_cast(n)); + eq->render(lane,l,r,static_cast(n), + snap->deviceEpoch,snap->graphRevision); break; } } diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index 5a1ac651a..3af0dd8ce 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -198,6 +198,16 @@ class LiveChannelFxGraph final { // renderer. Lifetime pinned by BOTH graph publishers, not the GUI. std::shared_ptr builtInEqLease() const noexcept {return builtinEq_;} + // CONTROL on an UNPUBLISHED candidate only. Share the same RT histories + // across same-rate routing revisions, not an independent EQ sound. + void inheritBuiltInEqFrom(const LiveChannelFxGraph& prior) noexcept { + if(builtinEq_ && prior.builtinEq_ && + builtinEq_->sampleRate()==prior.builtinEq_->sampleRate()) + builtinEq_=prior.builtinEq_; + } + void setBuiltInEqSession(std::uint64_t ep,std::uint64_t rev) noexcept { + builtinEqEpoch_=ep;builtinEqRevision_=rev; + } bool queueBuiltInEqEdit(int lane,std::size_t slot,const armix::builtin_fx::Band& b, std::uint64_t req,std::uint64_t epoch,std::uint64_t rev) noexcept { return lane>=0&&lanequeueBandEdit( @@ -312,7 +322,8 @@ class LiveChannelFxGraph final { // In-place channel EQ before existing vendor VST3 inserts/PRE sends. // Default OFF is bitwise-transparent; no second callback. builtinEq_->render(static_cast(strip),l,r, - static_cast(samples)); + static_cast(samples), + builtinEqEpoch_,builtinEqRevision_); const int count=counts_[strip]; // immutable, prepared OFF RT if(count>0) { for(int slot=0;slot builtinEq_{ std::make_shared()}; + std::uint64_t builtinEqEpoch_=0,builtinEqRevision_=0; // set BEFORE publishing std::unique_ptr block_; RealtimeStripControls controls_ {}; FxBank processors_ {}; diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 3c5d86e55..f0a15723d 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -311,6 +311,7 @@ class LiveDryRoutingLab final { // Must use verified active hardware rate, never assume 48k. if(!next->prepared->prepareBuiltInEq(sampleRate)) return "Invalid native channel EQ device sample rate"; + next->prepared->setBuiltInEqSession(currentEpoch,revision); if(!next->prepared->setMainOutputPair( mainLeft,mainRight,callbackOutputCount_.load(std::memory_order_acquire))) return "MAIN output patch references invalid callback channels"; @@ -340,6 +341,7 @@ class LiveDryRoutingLab final { // and FxInstance has an atomic try-enter to guard against overlap. // Never reuse across a device epoch or changed device quantum. const auto* prior=publisher_.controlPrepared(currentEpoch,expectedRevision); + if(prior)next->prepared->inheritBuiltInEqFrom(*prior); int insertCount=0,reusedCount=0; for(int lane=0;lane0.001&&wetPower>dryPower*4); } + +static void verifyBuiltInEqNativeChannelIdAndRevisionFence() { + DynamicChannelRoster roster; + std::array adds{}; + adds[0].kind=ChannelEdit::Kind::add;adds[0].role=ChannelRole::input; + adds[0].position=0;adds[0].format=ProcessingFormat::mono; + adds[1].kind=ChannelEdit::Kind::add;adds[1].role=ChannelRole::main; + adds[1].position=1;adds[1].format=ProcessingFormat::stereo; + const auto made=roster.edit(0,adds); + assert(made.ok() && made.createdIds.size()==2); + const auto ch=made.createdIds[0],main=made.createdIds[1]; + ChannelEdit link; + link.kind=ChannelEdit::Kind::addSendReference; + link.id=ch;link.target=main;link.value=1.f;link.primaryOutput=true; + assert(roster.edit(roster.revision(),std::span(&link,1)).ok()); + DynamicGraphRequest req; + req.physicalInputs=1;req.maxFrames=128;req.sources={{ch,0,-1,false}}; + auto eq=std::make_shared(); + assert(eq->prepare(48000)); + DynamicNativeSessionPublisher::FxPlan plan; + plan.builtInEq=eq;plan.builtInEqIds[0]=ch; + DynamicNativeSessionPublisher native; + assert(native.commit(roster,req,0,9,9,true,plan).ok()); + armix::builtin_fx::Band b{}; + b.enabled=true;b.frequencyHz=1000;b.gainDb=9;b.q=1.f; + assert(!native.queueBuiltInEqEdit(9,1,main,2,b,101)); + assert(native.queueBuiltInEqEdit(9,1,ch,2,b,101)); + std::array pcm{},left{},right{}; + const float* pins[]{pcm.data()}; + auto noFx=[](ChannelId,float*,float*,int) noexcept {}; + double power=0; + for(int block=0;block<64;++block) { + for(int i=0;i<128;++i) + pcm[static_cast(i)]=static_cast( + .1*std::sin(6.283185307179586*1000*(block*128+i)/48000.0)); + const auto before=heapCalls.load(std::memory_order_relaxed); + assert(native.render(9,pins,1,left.data(),right.data(),128,false,noFx)); + assert(heapCalls.load(std::memory_order_relaxed)==before); + if(block==0) { + armix::builtin_fx::ChannelEqBank::Ack ack{}; + assert(native.pollBuiltInEqAck(9,1,ch,ack)); + assert(ack.applied&&ack.requestId==101&&ack.slot==2); + } + if(block>=48)for(float y:left)power+=y*y; + } + // Mono input uses equal-power route; 9 dB bell must boost 1 kHz + // regardless of whether a native VST owner is present. + assert(power>1.0); + // Native publisher revision swaps retain the ONE EQ owner and history. + assert(native.commit(roster,req,1,9,9,true).ok()); + assert(native.queueBuiltInEqEdit(9,2,ch,2,b,103)); + assert(native.render(9,pins,1,left.data(),right.data(),128,false,noFx)); + armix::builtin_fx::ChannelEqBank::Ack ack{}; + assert(native.pollBuiltInEqAck(9,2,ch,ack)&&ack.applied&&ack.requestId==103); +} + int main(int argc,char** argv) { if(argc==2 && std::string(argv[1])=="--emit-console-s0-json") { verifyNativePuzzleV8FixtureAndWire(); @@ -2292,6 +2348,7 @@ int main(int argc,char** argv) { // M5 before them changes those historical baseline counts, not DSP. // M5 additionally asserts zero heap and valid vendor leases itself. verifyBuiltInEqRealPcmHook(); + verifyBuiltInEqNativeChannelIdAndRevisionFence(); verifyUniversalChannelIdFxLeaseAndLivePcm(); verifyMU1LegacyM4FxFullMigrationAndMonitorPcm(); verifyOccupiedExternalCh1Owner(); From 821dcab877ee92cfc8c922361625ba9284d89f56 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 10:47:33 +0700 Subject: [PATCH 06/48] feat(builtin-eq): admitted ChannelId intent and applied PCM ACK with deferred GUI readback --- src/LiveAudioEngine.h | 23 ++++++ src/LiveDryRoutingLab.h | 9 +++ src/Main.cpp | 152 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+) diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 20bc4039e..9b31677bb 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1433,6 +1433,29 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback armix::diagnostics::Route::normal)return false; return dryRoutingLab_.setNativeBusMix(epoch,revision,id,gain,pan); } + using BuiltInEqAck=LiveDryRoutingLab::BuiltInEqAck; + bool builtInEqIdentity(armix::mixer::ChannelId id,int& lane, + std::uint64_t& ep,std::uint64_t& rev) const 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_.builtInEqIdentity(id,lane,ep,rev); + } + bool queueBuiltInEqEdit(int lane,std::size_t slot, + const armix::builtin_fx::Band& b, + std::uint64_t requestId,std::uint64_t ep, + std::uint64_t rev) 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_.queueBuiltInEqEdit(lane,slot,b,requestId,ep,rev); + } + bool pollBuiltInEqAck(int lane,std::uint64_t ep, + std::uint64_t rev,BuiltInEqAck& ack) noexcept { + return dryRoutingLab_.pollBuiltInEqAck(lane,ep,rev,ack); + } bool dryRoutingLabActive() const noexcept {return dryRoutingLab_.active();} void pollDryRoutingLab() noexcept {dryRoutingLab_.poll();} diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index f0a15723d..5199d3c27 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1848,6 +1848,15 @@ class LiveDryRoutingLab final { // Status / control thread only. An empty prepared graph is ready, but // cannot be advertised as a LIVE patched route or a savable Show. using BuiltInEqAck=FxGraph::BuiltInEqAck; + // Native ChannelId to the 14 original hardware/aux EQ owners only. + bool builtInEqIdentity(armix::mixer::ChannelId id,int& lane, + std::uint64_t& ep,std::uint64_t& rev) const noexcept { + if(!id.value||!ready()||!channelIdPhysicalPcmActive()|| + nativeAccepted_.deviceEpoch!=epoch())return false; + const auto index=nativeAccepted_.graph.ids.legacyFxIndex(id); + if(index<0||index>=fxSlots)return false; + lane=index;ep=epoch();rev=nativeAccepted_.pcmRevision;return true; + } // CONTROL enqueue via the existing published graph lease, never change // live coefficients from UI; one SPSC producer and one audio consumer. bool queueBuiltInEqEdit(int lane,std::size_t slot, diff --git a/src/Main.cpp b/src/Main.cpp index 90d494f60..162c5aa06 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -282,6 +282,154 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr bool initialStateSent_ = false; bool consoleSubscribed_ = false; // Real snapshot subscription; not FAT certification juce::StringArray acceptedControlRequests_; // bounded request replay fence + struct EqPending final { + armix::mixer::ChannelId channel{}; + std::uint64_t request=0,epoch=0,revision=0,started=0; + int slot=-1;bool active=false; + }; + std::array eqPending_{}; + std::array eqSnapshotDue_{}; + std::array eqLastApplied_{}; + std::array,14> eqAccepted_{}; + std::uint64_t eqCacheEpoch_=0; + void syncEqEpoch(std::uint64_t ep) { + if(eqCacheEpoch_==ep)return; + eqCacheEpoch_=ep;eqSnapshotDue_.fill(false);eqLastApplied_.fill(0); + for(auto& pending:eqPending_)pending={}; + for(auto& lane:eqAccepted_) + for(std::size_t i=0;i20)return false; + std::uint64_t n=0; + for(int i=0;i'9')return false; + const auto digit=static_cast(c-'0'); + if(n>(UINT64_MAX-digit)/10u)return false; + n=n*10u+digit; + } + result=n;return n>0; + } + static bool eqFloat(const juce::var& v,float& out) noexcept { + if(!(v.isInt()||v.isInt64()||v.isDouble()))return false; + const auto n=static_cast(v); + if(!std::isfinite(n)||std::abs(n)>1000000.)return false; + out=static_cast(n);return true; + } + void emitEqSnapshot(armix::mixer::ChannelId id) { + int lane=-1;std::uint64_t ep=0,rev=0; + if(!browser_.loaded || !engine_.builtInEqIdentity(id,lane,ep,rev))return; + syncEqEpoch(ep); + auto out=std::make_unique(); + out->setProperty("schemaVersion",1); + out->setProperty("channelId",juce::String(std::to_string(id.value))); + out->setProperty("deviceEpoch",juce::String(std::to_string(ep))); + out->setProperty("graphRevision",juce::String(std::to_string(rev))); + out->setProperty("appliedRequestId",juce::String( + std::to_string(eqLastApplied_[static_cast(lane)]))); + juce::Array bands; + for(const auto& band:eqAccepted_[static_cast(lane)]) { + auto row=std::make_unique(); + row->setProperty("enabled",band.enabled); + row->setProperty("frequencyHz",band.frequencyHz); + row->setProperty("gainDb",band.gainDb); + row->setProperty("q",band.q); + row->setProperty("slope",static_cast(band.slope)); + bands.add(juce::var(row.release())); + } + out->setProperty("bands",juce::var(bands)); + browser_.emitEventIfBrowserIsVisible("arMixBuiltinEqSnapshot", + juce::var(out.release())); + } + void onEqAction(const juce::var& a) { + std::uint64_t number=0,ep=0,rev=0,req=0; + const auto hasId=eqUInt(a.getProperty("channelId",{}),number); + const armix::mixer::ChannelId ch{number}; + int lane=-1;std::uint64_t liveEp=0,liveRev=0; + const bool available=hasId&&engine_.builtInEqIdentity(ch,lane,liveEp,liveRev); + if(a.getProperty("action",{}).toString()=="builtinEqSnapshot") { + if(available)emitEqSnapshot(ch); + return; + } + bool queued=false; + if(available&&eqUInt(a.getProperty("deviceEpoch",{}),ep)&& + eqUInt(a.getProperty("graphRevision",{}),rev)&& + eqUInt(a.getProperty("requestId",{}),req)&& + ep==liveEp&&rev==liveRev&&!studioBackupBusy_&&!nativeShowBusy_ && + (a.getProperty("slot",{}).isInt()||a.getProperty("slot",{}).isInt64())) { + syncEqEpoch(ep); + const auto slot=static_cast(a.getProperty("slot",-1)); + const auto b=a.getProperty("band",{}); + const auto enabled=b.getProperty("enabled",{}); + float freq=0,gain=0,q=0,slope=0; + auto& pending=eqPending_[static_cast(lane)]; + if(!pending.active&&slot>=0&&slot<8&&b.isObject()&&enabled.isBool()&& + eqFloat(b.getProperty("frequencyHz",{}),freq)&& + eqFloat(b.getProperty("gainDb",{}),gain)&& + eqFloat(b.getProperty("q",{}),q)&& + eqFloat(b.getProperty("slope",{}),slope)&& + (slope==12.f||slope==24.f)) { + armix::builtin_fx::Band band{}; + band.enabled=static_cast(enabled); + band.frequencyHz=freq;band.gainDb=gain;band.q=q; + band.slope=slope==24.f?armix::builtin_fx::Slope::db24: + armix::builtin_fx::Slope::db12; + queued=engine_.queueBuiltInEqEdit(lane,static_cast(slot), + band,req,ep,rev); + if(queued) pending={ch,req,ep,rev,monotonicMilliseconds(),slot,true}; + } + } + auto reply=std::make_unique(); + reply->setProperty("schemaVersion",1); + reply->setProperty("requestId",juce::String(std::to_string(req))); + reply->setProperty("channelId",juce::String(std::to_string(number))); + reply->setProperty("status",queued?"QUEUED":"REJECTED"); + browser_.emitEventIfBrowserIsVisible("arMixBuiltinEqQueue", + juce::var(reply.release())); + } + void serviceEqAck() { + if(!browser_.loaded)return; + for(int lane=0;lane<14;++lane)if(eqSnapshotDue_[static_cast(lane)]) { + eqSnapshotDue_[static_cast(lane)]=false; + emitEqSnapshot(eqPending_[static_cast(lane)].channel); + } + const auto now=monotonicMilliseconds(); + for(int lane=0;lane<14;++lane) { + auto& pending=eqPending_[static_cast(lane)]; + if(!pending.active)continue; + LiveAudioEngine::BuiltInEqAck ack{}; + const bool got=engine_.pollBuiltInEqAck(lane,pending.epoch, + pending.revision,ack); + if(!got&&now-pending.started<4000u)continue; + const bool ok=got&&ack.applied&&ack.requestId==pending.request && + ack.slot==pending.slot && ack.lane==lane; + auto reply=std::make_unique(); + reply->setProperty("schemaVersion",1); + reply->setProperty("requestId",juce::String(std::to_string(pending.request))); + reply->setProperty("channelId",juce::String(std::to_string(pending.channel.value))); + reply->setProperty("deviceEpoch",juce::String(std::to_string(pending.epoch))); + reply->setProperty("graphRevision",juce::String(std::to_string(pending.revision))); + reply->setProperty("status",ok?"APPLIED":"REJECTED"); + if(ok) { + eqAccepted_[static_cast(lane)] + [static_cast(pending.slot)]=ack.accepted; + eqLastApplied_[static_cast(lane)]=pending.request; + eqSnapshotDue_[static_cast(lane)]=true; + } + browser_.emitEventIfBrowserIsVisible("arMixBuiltinEqAck", + juce::var(reply.release())); + pending.active=false; + } + } + bool webViewPeerWarmed_ = false; bool webViewStartupNoticeSent_ = false; juce::uint32 webViewStartupTick_ = 0; @@ -1404,6 +1552,9 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr void onAction (const juce::var& args) { const auto action = args.getProperty ("action", {}).toString(); + if(action=="builtinEqSetBand"||action=="builtinEqSnapshot") { + onEqAction(args);return; + } const auto value = args.getProperty ("value", {}); const int slot = static_cast (args.getProperty ("slot", -1)); // User may adjust live levels, but cannot alter the persisted VST @@ -2668,6 +2819,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr } } if (!browser_.loaded) return; + serviceEqAck(); // exact DSP-apply ACK, deferred readback, no new poll thread if (!initialStateSent_) { initialStateSent_ = true; From aafe6835344966044a1a9791d4e64d0e8b1f109b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 10:55:01 +0700 Subject: [PATCH 07/48] feat(builtin-eq): compact accepted-state editor inside canonical ArSonMix /preview/ --- .github/workflows/native-builtin-fx.yml | 6 + site/preview-v2/assets/mixer-builtin-eq.css | 30 ++++ site/preview-v2/assets/mixer-builtin-eq.js | 151 ++++++++++++++++++++ site/preview-v2/index.html | 5 +- tests/builtin_eq_gui_contract_test.mjs | 21 +++ web/approved-native-bridge.js | 11 ++ 6 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 site/preview-v2/assets/mixer-builtin-eq.css create mode 100644 site/preview-v2/assets/mixer-builtin-eq.js create mode 100644 tests/builtin_eq_gui_contract_test.mjs diff --git a/.github/workflows/native-builtin-fx.yml b/.github/workflows/native-builtin-fx.yml index 904f4eb0e..38f1fd1d2 100644 --- a/.github/workflows/native-builtin-fx.yml +++ b/.github/workflows/native-builtin-fx.yml @@ -2,6 +2,8 @@ name: Native Built-in FX DSP on: pull_request: paths: + - 'site/preview-v2/assets/mixer-builtin-eq.*' + - 'tests/builtin_eq_gui_contract_test.mjs' - 'engine/builtin_fx/**' - 'tests/builtin_channel_eq_test.cpp' - '.github/workflows/native-builtin-fx.yml' @@ -21,6 +23,10 @@ jobs: timeout-minutes: 8 steps: - uses: actions/checkout@v4 + - name: Console EQ GUI syntax and ownership contract + run: | + node --check site/preview-v2/assets/mixer-builtin-eq.js + node tests/builtin_eq_gui_contract_test.mjs - name: Configure no-JUCE native built-in FX run: cmake -S engine/builtin_fx -B build-builtin-fx -DCMAKE_BUILD_TYPE=Release - name: Compile native DSP test diff --git a/site/preview-v2/assets/mixer-builtin-eq.css b/site/preview-v2/assets/mixer-builtin-eq.css new file mode 100644 index 000000000..da33b8339 --- /dev/null +++ b/site/preview-v2/assets/mixer-builtin-eq.css @@ -0,0 +1,30 @@ +/* ArSonMix: one optional BUILT-IN CHANNEL EQ overlay, never a second mixer. + * Material palette is scoped and derived from the approved /preview/ hardware + * chassis and FX glass. All sizes are compact, no blur/spectrum GPU loop. */ +.mx-eq-open{height:17px;min-width:30px;padding:0 5px;border:1px solid #56717b;border-radius:2px;background:linear-gradient(#3e555f,#283c46);color:#bce0e8;font:600 9px/15px "Segoe UI",Arial,sans-serif;letter-spacing:.3px;cursor:pointer} +.mx-eq-open:hover{border-color:#77afbd;color:#e7fcff}.mx-eq-open:focus-visible{outline:2px solid #9bd9e8;outline-offset:1px} +#mxBuiltinEq[hidden]{display:none!important} +#mxBuiltinEq{--eq-cyan:#60c8df;--eq-ink:#d9e7ed;--eq-mute:#93a5af;position:fixed;z-index:90;left:50%;top:50%;transform:translate(-50%,-50%);width:min(770px,calc(100vw - 18px));height:min(465px,calc(100dvh - 18px));min-width:0;min-height:325px;display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box;border:1px solid #566a78;border-radius:6px;background:#18232c;color:var(--eq-ink);box-shadow:0 14px 40px #000c,0 0 0 1px #0a151a,inset 0 1px #73838e;font:11px/1.25 "Segoe UI",Arial,sans-serif} +#mxBuiltinEq button,#mxBuiltinEq input,#mxBuiltinEq select{font:inherit}#mxBuiltinEq button{cursor:pointer}#mxBuiltinEq button:disabled,#mxBuiltinEq input:disabled,#mxBuiltinEq select:disabled{opacity:.55;cursor:default} +#mxBuiltinEq button:focus-visible,#mxBuiltinEq input:focus-visible,#mxBuiltinEq select:focus-visible{outline:2px solid #85d1e6;outline-offset:1px} +.mx-eq-top{height:30px;flex:0 0 30px;display:flex;align-items:center;gap:10px;padding:0 10px;background:linear-gradient(#575d62,#393f46 54%,#292f35 54%,#333c44);border-bottom:1px solid #101820;box-shadow:inset 0 1px #92999d} +.mx-eq-top .mx-eq-mark{width:4px;height:14px;background:#5fc6da}.mx-eq-top strong{font-size:12px;font-weight:600;letter-spacing:.3px;color:#eff4f6}.mx-eq-top .mx-eq-channel{color:#b9c9d0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px} +.mx-eq-top .mx-eq-spacer{flex:1}.mx-eq-top .mx-eq-mode{font:9px/1 Consolas,monospace;color:#aad3df;white-space:nowrap}.mx-eq-close{border:1px solid #1a3039;border-radius:2px;background:linear-gradient(#64737e,#394c58);color:#f3f8fa;height:22px;width:25px;font:16px/19px Arial!important;padding:0} +.mx-eq-workspace{flex:1;min-height:0;display:flex;flex-direction:column;background:#101a22} +.mx-eq-chart{position:relative;flex:1;min-height:116px;box-sizing:border-box;background:radial-gradient(ellipse at 45% 20%,#21333c 0%,#17242e 50%,#101c25 100%);overflow:hidden;border-bottom:1px solid #445560} +.mx-eq-chart canvas{display:block;width:100%;height:100%;touch-action:none;cursor:crosshair} +.mx-eq-hint{pointer-events:none;position:absolute;left:10px;top:8px;font:9px/1.1 Consolas,monospace;color:#8da6b4}.mx-eq-legend{pointer-events:none;position:absolute;right:11px;top:8px;font:9px/1.2 Consolas,monospace;color:#95b8c4} +.mx-eq-rail{flex:0 0 31px;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:3px;padding:4px 8px;background:linear-gradient(#222e38,#18232c);border-bottom:1px solid #46505a} +.mx-eq-band{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:5px;border:1px solid #3c515e;border-radius:2px;color:#94a8b6;background:#202c36;font:9px/1 "Segoe UI",Arial,sans-serif!important} +.mx-eq-band i{display:inline-block;height:6px;width:6px;flex:0 0 6px;border-radius:50%;background:var(--eq-band,#69c9dd);opacity:.35} +.mx-eq-band.on{color:#e2f3f7;background:#293f4e;border-color:#527c8c}.mx-eq-band.on i{opacity:1}.mx-eq-band.selected{outline:1px solid #a0d8e5;outline-offset:-2px;color:#f4feff} +.mx-eq-controls{flex:0 0 83px;min-height:83px;display:grid;grid-template-columns:88px repeat(4,minmax(0,1fr)) 66px;gap:10px;align-items:center;padding:7px 12px;background:linear-gradient(165deg,#394954,#273943 45%,#1d2d37);box-shadow:inset 0 1px #657a85} +.mx-eq-controls label{min-width:0;display:block;color:#9db7c2;font:9px/1.3 "Segoe UI",Arial,sans-serif;letter-spacing:.55px}.mx-eq-controls input,.mx-eq-controls select{box-sizing:border-box;margin-top:5px;min-width:0;width:100%;height:29px;padding:0 6px;border:1px solid #536674;border-radius:3px;background:linear-gradient(#0f1c26,#243542);box-shadow:inset 0 1px 3px #0008;color:#eaf3f7;font:12px/1 Consolas,monospace!important;text-align:center} +.mx-eq-controls input::-webkit-inner-spin-button{-webkit-appearance:none}.mx-eq-controls .mx-eq-switch,.mx-eq-controls .mx-eq-reset{width:100%;height:29px;border:1px solid #5b7480;border-radius:3px;color:#b4c7d0;background:linear-gradient(#3d5561,#263d48);font:10px/1 "Segoe UI",Arial,sans-serif!important} +.mx-eq-controls .mx-eq-switch[aria-pressed="true"]{background:linear-gradient(#275b59,#19413c);border-color:#4d947d;color:#adf5ce}.mx-eq-controls .mx-eq-reset{margin-top:4px;height:24px;font-size:9px!important} +.mx-eq-controls .mx-eq-vertical{display:flex;flex-direction:column;justify-content:center;align-items:stretch;gap:2px} +.mx-eq-footer{flex:0 0 24px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 10px;background:linear-gradient(#303f49,#1e2c37);border-top:1px solid #586572;color:#9bb2bf;font:9px/1 Consolas,monospace;white-space:nowrap} +.mx-eq-footer .mx-eq-status{min-width:0;overflow:hidden;text-overflow:ellipsis}.mx-eq-footer .mx-eq-status.good{color:#8de0bb}.mx-eq-footer .mx-eq-status.warn{color:#f2c28a}.mx-eq-footer .mx-eq-footnote{color:#829ba8} +@media(max-width:760px){#mxBuiltinEq{width:calc(100vw - 12px);height:min(440px,calc(100dvh - 12px))}.mx-eq-controls{gap:5px;padding:6px;grid-template-columns:66px repeat(4,minmax(0,1fr)) 51px}.mx-eq-rail{padding:3px;gap:2px}.mx-eq-band{gap:2px;font-size:8px!important}.mx-eq-controls input,.mx-eq-controls select{font-size:10px!important;padding:0 2px}.mx-eq-controls label{font-size:8px}.mx-eq-footer .mx-eq-footnote{display:none}} +@media(max-height:440px){.mx-eq-top{height:25px;flex-basis:25px}.mx-eq-controls{flex-basis:68px;min-height:68px}.mx-eq-rail{flex-basis:27px}.mx-eq-footer{flex-basis:20px}} +@media(prefers-reduced-motion:reduce){#mxBuiltinEq *{transition:none!important;animation:none!important}} diff --git a/site/preview-v2/assets/mixer-builtin-eq.js b/site/preview-v2/assets/mixer-builtin-eq.js new file mode 100644 index 000000000..8a79de605 --- /dev/null +++ b/site/preview-v2/assets/mixer-builtin-eq.js @@ -0,0 +1,151 @@ +/* ArSonMix Built-in Channel EQ: small operator overlay in the ONLY /preview/. + * Browser renders RESPONSE FROM ACCEPTED PARAMETERS, never audio/FFT/WebAudio. + * Static Pages is explicitly a visual DESIGN DEMO. Native uses ACK + LATER + * authoritative snapshot; browser drafts never enter the mixer graph. */ +(()=>{ + 'use strict'; + const LABELS=['HPF','LOW','P1','P2','P3','P4','HIGH','LPF']; + const TYPES=['hp','ls','bell','bell','bell','bell','hs','lp']; + const DEFAULT=[80,160,250,500,1500,4500,9500,18000]; + const COLORS=['#9dc7ff','#eabb80','#e0a5db','#8eace8','#86d4ac','#e0b67c','#d99da8','#86cfe4']; + const empty=()=>DEFAULT.map((f,i)=>({enabled:false,frequencyHz:f,gainDb:0,q:i>=2&&i<=5?1:.70710678,slope:12})); + const clamp=(v,lo,hi)=>Math.max(lo,Math.min(hi,v)); + const hzToX=(hz,w)=>28+Math.log(clamp(hz,20,20000)/20)/Math.log(1000)*(w-58); + const xToHz=(x,w)=>20*Math.pow(1000,clamp((x-28)/(w-58),0,1)); + const dbToY=(db,h)=>h/2-clamp(db,-18,18)*(h-39)/36; + const yToDb=(y,h)=>clamp((h/2-y)*36/(h-39),-18,18); + const isCut=i=>i===0||i===7; + const gainEnabled=i=>i!==0&&i!==7; + const mk=(tag,cl,text)=>{const el=document.createElement(tag);if(cl)el.className=cl;if(text!==undefined)el.textContent=text;return el;}; + const root=mk('section');root.id='mxBuiltinEq';root.hidden=true;root.setAttribute('role','dialog');root.setAttribute('aria-modal','false');root.setAttribute('aria-label','Built-in channel equalizer'); + const head=mk('header','mx-eq-top'),mark=mk('i','mx-eq-mark'),brand=mk('strong','', 'ArSonMix · Channel EQ'); + const channelLabel=mk('span','mx-eq-channel'),spacer=mk('span','mx-eq-spacer'),mode=mk('span','mx-eq-mode'); + const close=mk('button','mx-eq-close','×');close.type='button';close.title='Close channel EQ';head.append(mark,brand,channelLabel,spacer,mode,close); + const workspace=mk('div','mx-eq-workspace'); + const graph=mk('div','mx-eq-chart'),canvas=mk('canvas'),hint=mk('div','mx-eq-hint','LOG FREQUENCY · RESPONSE (NOT SPECTRUM)'),legend=mk('div','mx-eq-legend','±18 dB');canvas.setAttribute('aria-label','Parametric EQ frequency response graph');graph.append(canvas,hint,legend); + const rail=mk('div','mx-eq-rail'),buttons=[];LABELS.forEach((title,i)=>{const b=mk('button','mx-eq-band',title);b.type='button';b.dataset.slot=String(i);b.style.setProperty('--eq-band',COLORS[i]);const led=mk('i');b.prepend(led);rail.append(b);buttons.push(b);}); + const controls=mk('div','mx-eq-controls'); + const powerCol=mk('div','mx-eq-vertical');const power=mk('button','mx-eq-switch','ENABLE');power.type='button';power.setAttribute('aria-pressed','false');const flat=mk('button','mx-eq-reset','FLAT BAND');flat.type='button';powerCol.append(power,flat); + const field=(label,type,min,max,step)=>{const wrap=mk('label','',label),v=mk(type==='slope'?'select':'input');v.setAttribute('aria-label',label);if(type==='slope'){[12,24].forEach(n=>{const o=mk('option','',`${n} dB/oct`);o.value=String(n);v.append(o);});}else{v.type='number';v.min=String(min);v.max=String(max);v.step=String(step);}wrap.append(v);return {wrap,v};}; + const freq=field('FREQUENCY · Hz','frequency',20,20000,1),gain=field('GAIN · dB','gain',-18,18,.1),q=field('Q · WIDTH','q',.2,12,.01),slope=field('CUT SLOPE','slope'); + const resetCol=mk('div','mx-eq-vertical');const typeName=mk('div','mx-eq-channel','BAND');resetCol.append(typeName); + controls.append(powerCol,freq.wrap,gain.wrap,q.wrap,slope.wrap,resetCol); + const footer=mk('footer','mx-eq-footer'),status=mk('span','mx-eq-status'),footerNote=mk('span','mx-eq-footnote','IIR · NO LOOKAHEAD · NO FFT');footer.append(status,footerNote); + workspace.append(graph,rail,controls,footer);root.append(head,workspace); + const attach=()=>{if(!root.isConnected)document.body.append(root);}; + if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',attach,{once:true});else attach(); + const ctx=canvas.getContext('2d',{alpha:false}); + let current=null,channelId=null,epoch=null,revision=null,bands=empty(),slot=2; + let pending=null,waitingAck=false,snapshotReady=false,reqSeq=1,activeGesture=null,demonstration=true; + const nativeBackend=()=>window.__JUCE__?.backend; + const nativeRoute=()=>window.__ARMIX_BUILTIN_EQ_CHANNEL; + const setStatus=(message,kind='')=>{status.textContent=message;status.className='mx-eq-status '+kind;}; + const isOpen=()=>!root.hidden; + const isEditable=()=>demonstration||Boolean(channelId&&snapshotReady&&!pending); + const resetNative=()=>{channelId=null;epoch=null;revision=null;pending=null;waitingAck=false;snapshotReady=false;bands=empty();setStatus('NATIVE: WAITING FOR ACCEPTED CHANNEL', 'warn');render();}; + const updateInputs=()=>{ + const b=bands[slot]; + buttons.forEach((node,i)=>{node.classList.toggle('selected',slot===i);node.classList.toggle('on',bands[i].enabled);node.setAttribute('aria-pressed',String(bands[i].enabled));}); + power.setAttribute('aria-pressed',String(b.enabled));power.textContent=b.enabled?'ENABLED':'ENABLE'; + freq.v.value=String(Math.round(b.frequencyHz));gain.v.value=b.gainDb.toFixed(1);q.v.value=b.q.toFixed(2);slope.v.value=String(b.slope); + typeName.textContent=LABELS[slot];gain.v.disabled=isCut(slot)||!isEditable();q.v.disabled=isCut(slot)||!isEditable(); + slope.v.disabled=!isCut(slot)||!isEditable();freq.v.disabled=!isEditable();power.disabled=!isEditable();flat.disabled=!isEditable(); + buttons.forEach(x=>{x.disabled=false;}); + }; + const num=(x,d)=>Number.isFinite(Number(x))?Number(x):d; + const validBand=(i,b)=>Boolean(b)&&typeof b.enabled==='boolean'&&Number.isFinite(b.frequencyHz)&&b.frequencyHz>=20&&b.frequencyHz<=20000&&Number.isFinite(b.gainDb)&&Math.abs(b.gainDb)<=18&&Number.isFinite(b.q)&&b.q>=.2&&b.q<=12&&(b.slope===12||b.slope===24); + const coeff=(type,b,sr,q)=>{ + const w=2*Math.PI*b.frequencyHz/sr,c=Math.cos(w),sin=Math.sin(w),a=Math.pow(10,b.gainDb/40),al=sin/(2*q),edge=sin*Math.sqrt(a)*Math.SQRT2; + let v; + if(type==='bell')v=[1+al*a,-2*c,1-al*a,1+al/a,-2*c,1-al/a]; + else if(type==='hp')v=[(1+c)/2,-(1+c),(1+c)/2,1+al,-2*c,1-al]; + else if(type==='lp')v=[(1-c)/2,1-c,(1-c)/2,1+al,-2*c,1-al]; + else if(type==='ls')v=[a*((a+1)-(a-1)*c+edge),2*a*((a-1)-(a+1)*c),a*((a+1)-(a-1)*c-edge),(a+1)+(a-1)*c+edge,-2*((a-1)+(a+1)*c),(a+1)+(a-1)*c-edge]; + else v=[a*((a+1)+(a-1)*c+edge),-2*a*((a-1)+(a+1)*c),a*((a+1)+(a-1)*c-edge),(a+1)-(a-1)*c+edge,2*((a-1)-(a+1)*c),(a+1)-(a-1)*c-edge]; + const a0=v[3];return [v[0]/a0,v[1]/a0,v[2]/a0,1,v[4]/a0,v[5]/a0]; + }; + const responseDb=(hz)=>{ + let result=0; + for(let i=0;i<8;++i){const b=bands[i];if(!b.enabled)continue; + const cut=isCut(i),qs=cut&&b.slope===24?[.541196100146197,1.306562964876377]:[cut?Math.SQRT1_2:b.q]; + for(const q of qs){const c=coeff(TYPES[i],b,48000,q),w=2*Math.PI*hz/48000,cos=Math.cos(w),sin=Math.sin(w),cos2=Math.cos(2*w),sin2=Math.sin(2*w); + const nr=c[0]+c[1]*cos+c[2]*cos2,ni=-(c[1]*sin+c[2]*sin2),dr=1+c[4]*cos+c[5]*cos2,di=-(c[4]*sin+c[5]*sin2); + result+=10*Math.log10(Math.max(1e-24,(nr*nr+ni*ni)/Math.max(1e-24,dr*dr+di*di))); + } + }return result; + }; + const draw=()=>{ + if(root.hidden||!ctx)return; + const r=canvas.getBoundingClientRect();if(r.width<100||r.height<80)return; + const dpr=Math.min(window.devicePixelRatio||1,2),w=r.width,h=r.height; + canvas.width=Math.round(w*dpr);canvas.height=Math.round(h*dpr);ctx.setTransform(dpr,0,0,dpr,0,0); + ctx.fillStyle='#15212a';ctx.fillRect(0,0,w,h);const y0=dbToY(0,h); + ctx.font='9px Consolas,monospace';ctx.textBaseline='top'; + for(const f of [20,50,100,200,500,1000,2000,5000,10000,20000]){ + const x=hzToX(f,w);ctx.strokeStyle=f===1000?'#334c57':'#273a45';ctx.lineWidth=.75;ctx.beginPath();ctx.moveTo(x,17);ctx.lineTo(x,h-20);ctx.stroke();ctx.fillStyle='#78919f';ctx.fillText(f>=1000?`${f/1000}k`:String(f),x-8,h-15); + } + for(const db of [-18,-12,-6,0,6,12,18]){ + const y=dbToY(db,h);ctx.strokeStyle=db===0?'#587581':'#2b3b45';ctx.lineWidth=db===0?1.2:.7;ctx.beginPath();ctx.moveTo(23,y);ctx.lineTo(w-28,y);ctx.stroke();ctx.fillStyle='#8ca5b3';ctx.fillText(db>0?'+'+db:String(db),3,y-5); + } + const steps=Math.max(80,Math.floor(w-58)),points=[]; + for(let i=0;i<=steps;i++){const f=xToHz(28+(w-58)*i/steps,w);points.push([hzToX(f,w),dbToY(responseDb(f),h)]);} + ctx.beginPath();points.forEach(([x,y],i)=>i?ctx.lineTo(x,y):ctx.moveTo(x,y));ctx.lineTo(w-28,y0);ctx.lineTo(28,y0);ctx.closePath();ctx.fillStyle='rgba(79,174,207,.09)';ctx.fill(); + ctx.beginPath();points.forEach(([x,y],i)=>i?ctx.lineTo(x,y):ctx.moveTo(x,y));ctx.strokeStyle='#67d3e5';ctx.lineWidth=2;ctx.stroke(); + for(let i=0;i{updateInputs();if(frame)cancelAnimationFrame(frame);frame=requestAnimationFrame(()=>{frame=0;draw();});}; + const apply=(candidate)=>{ + if(!isEditable()||!validBand(slot,candidate))return; + if(demonstration){bands[slot]={...candidate};setStatus('DESIGN DEMO · VISUAL ONLY · NO AUDIO','warn');render();return;} + if(!nativeBackend()?.emitEvent||!channelId||!epoch||!revision)return; + const id=String(reqSeq++),command={action:'builtinEqSetBand',channelId,deviceEpoch:epoch,graphRevision:revision,requestId:id,slot,band:candidate}; + pending={id,channelId,epoch,revision,slot};waitingAck=false; + setStatus('NATIVE: REQUEST SENT · WAITING FOR AUDIO CALLBACK','warn');render();nativeBackend().emitEvent('arMixAction',command); + }; + const selected=()=>bands[slot]; + const update=(patch)=>apply({...selected(),...patch}); + power.addEventListener('click',()=>update({enabled:!selected().enabled})); + flat.addEventListener('click',()=>update({...empty()[slot]})); + freq.v.addEventListener('change',()=>update({frequencyHz:clamp(num(freq.v.value,selected().frequencyHz),20,20000)})); + gain.v.addEventListener('change',()=>update({gainDb:clamp(num(gain.v.value,selected().gainDb),-18,18)})); + q.v.addEventListener('change',()=>update({q:clamp(num(q.v.value,selected().q),.2,12)})); + slope.v.addEventListener('change',()=>update({slope:num(slope.v.value,12)===24?24:12})); + rail.addEventListener('click',e=>{const btn=e.target.closest('[data-slot]');if(!btn)return;slot=Number(btn.dataset.slot);render();}); + const locate=e=>{const r=canvas.getBoundingClientRect();return {x:e.clientX-r.left,y:e.clientY-r.top,w:r.width,h:r.height};}; + const pick=(p)=>{let index=-1,d=17*17;bands.forEach((b,i)=>{const x=hzToX(b.frequencyHz,p.w),y=dbToY(isCut(i)?0:b.gainDb,p.h),dist=(x-p.x)**2+(y-p.y)**2;if(dist{if(e.button!==0)return;const p=locate(e),i=pick(p);if(i<0)return;slot=i;activeGesture={id:e.pointerId,slot:i,original:bands[i],p};canvas.setPointerCapture?.(e.pointerId);render();}); + canvas.addEventListener('pointerup',e=>{if(!activeGesture||activeGesture.id!==e.pointerId)return;const gesture=activeGesture;activeGesture=null;const p=locate(e);if(!isEditable())return;const changedHz=Math.round(xToHz(p.x,p.w)),changedDb=isCut(slot)?0:Math.round(yToDb(p.y,p.h)*10)/10; + update({enabled:true,frequencyHz:clamp(changedHz,20,20000),gainDb:changedDb});}); + canvas.addEventListener('pointercancel',()=>{activeGesture=null;}); + canvas.addEventListener('wheel',e=>{const p=locate(e),i=pick(p);if(i<0||!isEditable())return;e.preventDefault();slot=i;const b=bands[i];if(isCut(i))update({slope:b.slope===12?24:12,enabled:true});else update({q:clamp(Math.round((b.q+(e.deltaY<0?.08:-.08))*100)/100,.2,12),enabled:true});},{passive:false}); + close.addEventListener('click',()=>{root.hidden=true;activeGesture=null;}); + root.addEventListener('keydown',e=>{if(e.key==='Escape'){e.stopPropagation();root.hidden=true;}}); + if(typeof ResizeObserver!=='undefined'){new ResizeObserver(()=>{if(isOpen())render();}).observe(graph);}else window.addEventListener('resize',()=>{if(isOpen())render();},{passive:true}); + const validateSnap=s=>s?.schemaVersion===1&&s.channelId===channelId&&/^\d+$/.test(String(s.deviceEpoch||''))&&/^\d+$/.test(String(s.graphRevision||''))&&Array.isArray(s.bands)&&s.bands.length===8&&s.bands.every((b,i)=>validBand(i,b)); + const backend=nativeBackend(); + if(backend?.addEventListener){ + backend.addEventListener('arMixBuiltinEqQueue',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='REJECTED'){pending=null;setStatus('NATIVE: EDIT REJECTED; STATE UNCHANGED','warn');render();}else setStatus('QUEUED · WAITING FOR DSP APPLY ACK','warn');}); + backend.addEventListener('arMixBuiltinEqAck',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='APPLIED'&&r.deviceEpoch===pending.epoch&&r.graphRevision===pending.revision){waitingAck=true;setStatus('DSP APPLIED · AWAITING ACCEPTED READBACK','warn');}else {pending=null;waitingAck=false;setStatus('NATIVE: NOT APPLIED; STATE UNCHANGED','warn');render();}}); + backend.addEventListener('arMixBuiltinEqSnapshot',s=>{if(!isOpen()||demonstration||!validateSnap(s))return; + if(pending&&(!waitingAck||s.appliedRequestId!==pending.id))return; + bands=s.bands.map(b=>({...b}));epoch=s.deviceEpoch;revision=s.graphRevision;pending=null;waitingAck=false;snapshotReady=true; + setStatus('NATIVE · ACK + ACCEPTED PARAMETER READBACK','good');render(); + }); + } + window.ArSonMixBuiltinEq=Object.freeze({open(track){ + if(!track||track.kind==='master')return; + current=track;channelLabel.textContent=String(track.name||'Channel');root.hidden=false;slot=2;pending=null;waitingAck=false; + const host=nativeRoute(),resolved=host?.resolve?.(track.id),s=host?.state?.(); + demonstration=!nativeBackend(); + if(demonstration){channelId=null;snapshotReady=false;bands=empty();mode.textContent='UI DEMO · NO AUDIO';setStatus('DESIGN DEMO · NO AUDIO SIGNAL','warn');} + else if(resolved&&s?.admitted){channelId=resolved;epoch=s.device?.epoch;revision=s.graph?.revision;bands=empty();pending=null;snapshotReady=false; + // Control disabled until real native snapshot arrives; never pretend + // that a screenshot/browser fixture is already loaded as channel state. + mode.textContent='NATIVE · CHANNEL ID '+channelId;setStatus('NATIVE · LOADING ACCEPTED PARAMETERS','warn');nativeBackend()?.emitEvent('arMixAction',{action:'builtinEqSnapshot',channelId}); + }else{mode.textContent='NATIVE · UNAVAILABLE';resetNative();} + render();root.querySelector('.mx-eq-close')?.focus(); + },close(){root.hidden=true;}}); +})(); diff --git a/site/preview-v2/index.html b/site/preview-v2/index.html index 7be436edb..28211ea38 100644 --- a/site/preview-v2/index.html +++ b/site/preview-v2/index.html @@ -14,6 +14,8 @@ + + @@ -323,7 +325,7 @@ const used=t.fx.map((name,i)=>({name,i})).filter(x=>x.name!=='None'); const first=t.fx.findIndex(x=>x==='None'); const rows=used.concat(first<0?[]:[{name:'None',i:first}]); - let out='
fxFX '+used.length+'
'; + let out='
fxFX '+used.length+''+(t.kind==='master'?'':'')+'
'; for(const {name,i} of rows){ out+='
'+ (name==='None'?'': @@ -1998,6 +2000,7 @@ } if(a==='rename'||a==='editIdentity')return; // double-click edits; single-click selects if(a==='format'&&t.kind==='audio'){t.format=t.format==='mono'?'stereo':'mono';refreshStrip(t);say(t.name+' processing → '+t.format.toUpperCase()+' · physical source '+t.input+' unchanged (reference only)');return;} + if(a==='openBuiltinEq'){window.ArSonMixBuiltinEq?.open(t);return;} if(a==='openPlugin'){openFastPicker(t,Number(btn.dataset.slot),btn);return;} if(a==='removeFx'){if(deferNativeFxIntent('Remove FX insert'))return;const i=Number(btn.dataset.slot);t.fx[i]='None';t.slotBypass[i]=false;if(t.fxInsertIds)t.fxInsertIds[i]=null;fxReorderUndo=null;refreshStrip(t);say(t.name+' · cleared FX insert '+(i+1));return;} if(a==='slotPower'){if(deferNativeFxIntent('FX insert bypass'))return;const slot=Number(btn.dataset.slot);if(t.fx[slot]==='None'){say(t.name+': choose an effect before toggling bypass');return;}t.slotBypass[slot]=!t.slotBypass[slot];refreshStrip(t);say(t.name+': FX '+(slot+1)+(t.slotBypass[slot]?' bypassed':' enabled'));return;} diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs new file mode 100644 index 000000000..b7dd514ce --- /dev/null +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -0,0 +1,21 @@ +// The built-in EQ editor is an independent component inside the ONE +// approved ArSonMix /preview/ renderer. No duplicate audio or route UI. +import fs from 'node:fs'; +import assert from 'node:assert/strict'; +const html=fs.readFileSync('site/preview-v2/index.html','utf8'); +const js=fs.readFileSync('site/preview-v2/assets/mixer-builtin-eq.js','utf8'); +const css=fs.readFileSync('site/preview-v2/assets/mixer-builtin-eq.css','utf8'); +const native=fs.readFileSync('web/approved-native-bridge.js','utf8'); +for(const asset of ['mixer-builtin-eq.css','mixer-builtin-eq.js']){ + assert.equal((html.match(new RegExp('assets/'+asset.replace('.', '\\.'),'g'))||[]).length,1); +} +assert.match(html,/data-action="openBuiltinEq"/); +assert.match(html,/ArSonMixBuiltinEq\\?\\.open/); +assert.match(native,/__ARMIX_BUILTIN_EQ_CHANNEL__/); +assert.match(js,/arMixBuiltinEqAck/); +assert.match(js,/arMixBuiltinEqSnapshot/); +assert.match(js,/DESIGN DEMO · NO AUDIO/); +assert.match(js,/snapshotReady/); +assert.doesNotMatch(js,/AudioContext|webkitAudioContext|createScriptProcessor|new Worker\\(/); +assert.match(css,/#mxBuiltinEq\\[hidden\\]/); +console.log('Built-in Channel EQ GUI contract: PASS (isolated from VST3 and alt mixer)'); diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index 212cd2d9f..b726e480f 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -477,6 +477,17 @@ state:()=>controller?.state() || null }); window.__ARMIX_NATIVE_M2__ = nativeHooks; + // Narrow, read-only adapter: the EQ editor must never guess the native + // ChannelId from a UI strip ordinal. The accepted console projection + // supplies exact identity; this adapter does NOT publish audio data. + Object.defineProperty(window,"__ARMIX_BUILTIN_EQ_CHANNEL__",{ + configurable:false,writable:false, + value:Object.freeze({ + resolve(uiId){return connected&&flags.acceptedGraphConnected? + nativeByUiId.get(Number(uiId))||null:null;}, + state(){return connected?controller?.state().current||null:null;} + }) + }); const descriptor = Object.freeze({ source:"site/preview-v2 + site/preview-buttons", pagesRoute:"/preview/", From 05f24490f0254cff8d00d1129e63bd5932033b59 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 10:57:51 +0700 Subject: [PATCH 08/48] fix(builtin-eq): browser contract syntax, native bridge identity and actual samplerate curve --- engine/builtin_fx/README.md | 14 ++++++++++++++ site/preview-v2/assets/mixer-builtin-eq.js | 10 +++++----- src/Main.cpp | 2 ++ tests/builtin_eq_gui_contract_test.mjs | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/engine/builtin_fx/README.md b/engine/builtin_fx/README.md index 9120817fa..7e5f1fe70 100644 --- a/engine/builtin_fx/README.md +++ b/engine/builtin_fx/README.md @@ -88,3 +88,17 @@ See `tests/builtin_channel_eq_bank_test.cpp` for bounded queue / ACK fixtures. Reference mathematics: W3C Audio EQ Cookbook (RBJ), 2021, https://www.w3.org/TR/audio-eq-cookbook/ . Interaction inspiration: FL Studio Fruity Parametric EQ, **not a copy of its source code, icons, or artwork**. + +## Built-in EQ native product adapter — PR #423 + +The DSP is owned by this ArSonMix repository; no code, build product, CI or plugin identity in `masarray/arson-eq` is modified. It is **not a VST3 module** and does not appear in the user-owned plugin scanner or FactoryFX. + +The 8 fixed slots (HPF/LOW/PEQ1–4/HIGH/LPF) are processed in-place before vendor inserts on the original M4 10CH+4AUX graph and the admitted ChannelId native graph. M4→ChannelId and structural native revisions retain one shared EQ bank and correct stable input/aux ChannelIds. Extra dynamic channels, MAIN and MONITOR are **not** mapped to the 14 legacy EQ lanes; the controls fail closed rather than borrowing a strip's EQ. Structural changes inherit the bank only for the same hardware clock; stale revisions are rejected at the actual DSP apply boundary. Never insert a second callback, FFT, latency buffer or ArSonEQ 24-band engine. + +### Operator UI + +The approved `/preview/` mixer has a small **EQ** button beside each supported channel FX rack header; the separate compact EQ overlay is implemented in `site/preview-v2/assets/mixer-builtin-eq.{js,css}` as an INTERNAL source of the approved deterministic Pages/JUCE renderer. The `/preview/` page marks controls as **UI DEMO / NO AUDIO**. The native JUCE bridge resolves the actual accepted decimal-string `ChannelId`, current epoch and PCM graph revision; no browser-inferred lane or active VST insert. A control command is `builtinEqSetBand` through the existing `arMixAction` bridge, returning QUEUED (not applied). Only the audio callback ACK plus a subsequent native parameter snapshot updates the browser's accepted EQ state. A failed/stale/busy/unsupported edit leaves accepted parameters unchanged, and hardware routing is never activated by opening the EQ editor. + +### Remaining release qualification + +Native Windows exact-SHA executable, CTest, visual equivalence against the user-approved deployed `/preview/`, no-allocation xrun stress, device reconnect, scenario/Show restoration, and real ASIO hardware ears-on FAT must all be independently verified. These gates are **not** inferred from native DSP unit success or from a static browser rendering. Draft PR is not a production release; no merge without accepting multi-PR conflict with the active product integration owner. diff --git a/site/preview-v2/assets/mixer-builtin-eq.js b/site/preview-v2/assets/mixer-builtin-eq.js index 8a79de605..fa7b96ade 100644 --- a/site/preview-v2/assets/mixer-builtin-eq.js +++ b/site/preview-v2/assets/mixer-builtin-eq.js @@ -35,10 +35,10 @@ const attach=()=>{if(!root.isConnected)document.body.append(root);}; if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',attach,{once:true});else attach(); const ctx=canvas.getContext('2d',{alpha:false}); - let current=null,channelId=null,epoch=null,revision=null,bands=empty(),slot=2; + let current=null,channelId=null,epoch=null,revision=null,bands=empty(),slot=2,sampleRate=48000; let pending=null,waitingAck=false,snapshotReady=false,reqSeq=1,activeGesture=null,demonstration=true; const nativeBackend=()=>window.__JUCE__?.backend; - const nativeRoute=()=>window.__ARMIX_BUILTIN_EQ_CHANNEL; + const nativeRoute=()=>window.__ARMIX_BUILTIN_EQ_CHANNEL__; const setStatus=(message,kind='')=>{status.textContent=message;status.className='mx-eq-status '+kind;}; const isOpen=()=>!root.hidden; const isEditable=()=>demonstration||Boolean(channelId&&snapshotReady&&!pending); @@ -68,7 +68,7 @@ let result=0; for(let i=0;i<8;++i){const b=bands[i];if(!b.enabled)continue; const cut=isCut(i),qs=cut&&b.slope===24?[.541196100146197,1.306562964876377]:[cut?Math.SQRT1_2:b.q]; - for(const q of qs){const c=coeff(TYPES[i],b,48000,q),w=2*Math.PI*hz/48000,cos=Math.cos(w),sin=Math.sin(w),cos2=Math.cos(2*w),sin2=Math.sin(2*w); + for(const q of qs){const c=coeff(TYPES[i],b,sampleRate,q),w=2*Math.PI*hz/48000,cos=Math.cos(w),sin=Math.sin(w),cos2=Math.cos(2*w),sin2=Math.sin(2*w); const nr=c[0]+c[1]*cos+c[2]*cos2,ni=-(c[1]*sin+c[2]*sin2),dr=1+c[4]*cos+c[5]*cos2,di=-(c[4]*sin+c[5]*sin2); result+=10*Math.log10(Math.max(1e-24,(nr*nr+ni*ni)/Math.max(1e-24,dr*dr+di*di))); } @@ -109,7 +109,7 @@ const update=(patch)=>apply({...selected(),...patch}); power.addEventListener('click',()=>update({enabled:!selected().enabled})); flat.addEventListener('click',()=>update({...empty()[slot]})); - freq.v.addEventListener('change',()=>update({frequencyHz:clamp(num(freq.v.value,selected().frequencyHz),20,20000)})); + freq.v.addEventListener('change',()=>update({frequencyHz:clamp(num(freq.v.value,selected().frequencyHz),20,Math.min(20000,Math.floor(sampleRate*.45)))})); gain.v.addEventListener('change',()=>update({gainDb:clamp(num(gain.v.value,selected().gainDb),-18,18)})); q.v.addEventListener('change',()=>update({q:clamp(num(q.v.value,selected().q),.2,12)})); slope.v.addEventListener('change',()=>update({slope:num(slope.v.value,12)===24?24:12})); @@ -131,7 +131,7 @@ backend.addEventListener('arMixBuiltinEqAck',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='APPLIED'&&r.deviceEpoch===pending.epoch&&r.graphRevision===pending.revision){waitingAck=true;setStatus('DSP APPLIED · AWAITING ACCEPTED READBACK','warn');}else {pending=null;waitingAck=false;setStatus('NATIVE: NOT APPLIED; STATE UNCHANGED','warn');render();}}); backend.addEventListener('arMixBuiltinEqSnapshot',s=>{if(!isOpen()||demonstration||!validateSnap(s))return; if(pending&&(!waitingAck||s.appliedRequestId!==pending.id))return; - bands=s.bands.map(b=>({...b}));epoch=s.deviceEpoch;revision=s.graphRevision;pending=null;waitingAck=false;snapshotReady=true; + bands=s.bands.map(b=>({...b}));epoch=s.deviceEpoch;revision=s.graphRevision;sampleRate=Number(s.sampleRate)||48000;pending=null;waitingAck=false;snapshotReady=true; setStatus('NATIVE · ACK + ACCEPTED PARAMETER READBACK','good');render(); }); } diff --git a/src/Main.cpp b/src/Main.cpp index 162c5aa06..c1e644e61 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -335,6 +335,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr out->setProperty("graphRevision",juce::String(std::to_string(rev))); out->setProperty("appliedRequestId",juce::String( std::to_string(eqLastApplied_[static_cast(lane)]))); + if(auto* device=engine_.devices().getCurrentAudioDevice()) + out->setProperty("sampleRate",device->getCurrentSampleRate()); juce::Array bands; for(const auto& band:eqAccepted_[static_cast(lane)]) { auto row=std::make_unique(); diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index b7dd514ce..feb57575d 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -16,6 +16,6 @@ assert.match(js,/arMixBuiltinEqAck/); assert.match(js,/arMixBuiltinEqSnapshot/); assert.match(js,/DESIGN DEMO · NO AUDIO/); assert.match(js,/snapshotReady/); -assert.doesNotMatch(js,/AudioContext|webkitAudioContext|createScriptProcessor|new Worker\\(/); +assert.ok(!['AudioContext','webkitAudioContext','createScriptProcessor','new Worker('].some(s=>js.includes(s)), 'Browser EQ must not own audio callback'); assert.match(css,/#mxBuiltinEq\\[hidden\\]/); console.log('Built-in Channel EQ GUI contract: PASS (isolated from VST3 and alt mixer)'); From e84719d566a59640d263b69ac6d5ed2d536e7467 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 11:01:00 +0700 Subject: [PATCH 09/48] fix(builtin-eq): respect canonical FX CSS owner and deterministic GUI source-contract tests --- site/preview-v2/assets/mixer-builtin-eq.css | 30 ------------------ site/preview-v2/assets/mixer-fx-rack.css | 35 +++++++++++++++++++++ site/preview-v2/index.html | 1 - tests/builtin_eq_gui_contract_test.mjs | 10 +++--- 4 files changed, 41 insertions(+), 35 deletions(-) delete mode 100644 site/preview-v2/assets/mixer-builtin-eq.css diff --git a/site/preview-v2/assets/mixer-builtin-eq.css b/site/preview-v2/assets/mixer-builtin-eq.css deleted file mode 100644 index da33b8339..000000000 --- a/site/preview-v2/assets/mixer-builtin-eq.css +++ /dev/null @@ -1,30 +0,0 @@ -/* ArSonMix: one optional BUILT-IN CHANNEL EQ overlay, never a second mixer. - * Material palette is scoped and derived from the approved /preview/ hardware - * chassis and FX glass. All sizes are compact, no blur/spectrum GPU loop. */ -.mx-eq-open{height:17px;min-width:30px;padding:0 5px;border:1px solid #56717b;border-radius:2px;background:linear-gradient(#3e555f,#283c46);color:#bce0e8;font:600 9px/15px "Segoe UI",Arial,sans-serif;letter-spacing:.3px;cursor:pointer} -.mx-eq-open:hover{border-color:#77afbd;color:#e7fcff}.mx-eq-open:focus-visible{outline:2px solid #9bd9e8;outline-offset:1px} -#mxBuiltinEq[hidden]{display:none!important} -#mxBuiltinEq{--eq-cyan:#60c8df;--eq-ink:#d9e7ed;--eq-mute:#93a5af;position:fixed;z-index:90;left:50%;top:50%;transform:translate(-50%,-50%);width:min(770px,calc(100vw - 18px));height:min(465px,calc(100dvh - 18px));min-width:0;min-height:325px;display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box;border:1px solid #566a78;border-radius:6px;background:#18232c;color:var(--eq-ink);box-shadow:0 14px 40px #000c,0 0 0 1px #0a151a,inset 0 1px #73838e;font:11px/1.25 "Segoe UI",Arial,sans-serif} -#mxBuiltinEq button,#mxBuiltinEq input,#mxBuiltinEq select{font:inherit}#mxBuiltinEq button{cursor:pointer}#mxBuiltinEq button:disabled,#mxBuiltinEq input:disabled,#mxBuiltinEq select:disabled{opacity:.55;cursor:default} -#mxBuiltinEq button:focus-visible,#mxBuiltinEq input:focus-visible,#mxBuiltinEq select:focus-visible{outline:2px solid #85d1e6;outline-offset:1px} -.mx-eq-top{height:30px;flex:0 0 30px;display:flex;align-items:center;gap:10px;padding:0 10px;background:linear-gradient(#575d62,#393f46 54%,#292f35 54%,#333c44);border-bottom:1px solid #101820;box-shadow:inset 0 1px #92999d} -.mx-eq-top .mx-eq-mark{width:4px;height:14px;background:#5fc6da}.mx-eq-top strong{font-size:12px;font-weight:600;letter-spacing:.3px;color:#eff4f6}.mx-eq-top .mx-eq-channel{color:#b9c9d0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px} -.mx-eq-top .mx-eq-spacer{flex:1}.mx-eq-top .mx-eq-mode{font:9px/1 Consolas,monospace;color:#aad3df;white-space:nowrap}.mx-eq-close{border:1px solid #1a3039;border-radius:2px;background:linear-gradient(#64737e,#394c58);color:#f3f8fa;height:22px;width:25px;font:16px/19px Arial!important;padding:0} -.mx-eq-workspace{flex:1;min-height:0;display:flex;flex-direction:column;background:#101a22} -.mx-eq-chart{position:relative;flex:1;min-height:116px;box-sizing:border-box;background:radial-gradient(ellipse at 45% 20%,#21333c 0%,#17242e 50%,#101c25 100%);overflow:hidden;border-bottom:1px solid #445560} -.mx-eq-chart canvas{display:block;width:100%;height:100%;touch-action:none;cursor:crosshair} -.mx-eq-hint{pointer-events:none;position:absolute;left:10px;top:8px;font:9px/1.1 Consolas,monospace;color:#8da6b4}.mx-eq-legend{pointer-events:none;position:absolute;right:11px;top:8px;font:9px/1.2 Consolas,monospace;color:#95b8c4} -.mx-eq-rail{flex:0 0 31px;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:3px;padding:4px 8px;background:linear-gradient(#222e38,#18232c);border-bottom:1px solid #46505a} -.mx-eq-band{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:5px;border:1px solid #3c515e;border-radius:2px;color:#94a8b6;background:#202c36;font:9px/1 "Segoe UI",Arial,sans-serif!important} -.mx-eq-band i{display:inline-block;height:6px;width:6px;flex:0 0 6px;border-radius:50%;background:var(--eq-band,#69c9dd);opacity:.35} -.mx-eq-band.on{color:#e2f3f7;background:#293f4e;border-color:#527c8c}.mx-eq-band.on i{opacity:1}.mx-eq-band.selected{outline:1px solid #a0d8e5;outline-offset:-2px;color:#f4feff} -.mx-eq-controls{flex:0 0 83px;min-height:83px;display:grid;grid-template-columns:88px repeat(4,minmax(0,1fr)) 66px;gap:10px;align-items:center;padding:7px 12px;background:linear-gradient(165deg,#394954,#273943 45%,#1d2d37);box-shadow:inset 0 1px #657a85} -.mx-eq-controls label{min-width:0;display:block;color:#9db7c2;font:9px/1.3 "Segoe UI",Arial,sans-serif;letter-spacing:.55px}.mx-eq-controls input,.mx-eq-controls select{box-sizing:border-box;margin-top:5px;min-width:0;width:100%;height:29px;padding:0 6px;border:1px solid #536674;border-radius:3px;background:linear-gradient(#0f1c26,#243542);box-shadow:inset 0 1px 3px #0008;color:#eaf3f7;font:12px/1 Consolas,monospace!important;text-align:center} -.mx-eq-controls input::-webkit-inner-spin-button{-webkit-appearance:none}.mx-eq-controls .mx-eq-switch,.mx-eq-controls .mx-eq-reset{width:100%;height:29px;border:1px solid #5b7480;border-radius:3px;color:#b4c7d0;background:linear-gradient(#3d5561,#263d48);font:10px/1 "Segoe UI",Arial,sans-serif!important} -.mx-eq-controls .mx-eq-switch[aria-pressed="true"]{background:linear-gradient(#275b59,#19413c);border-color:#4d947d;color:#adf5ce}.mx-eq-controls .mx-eq-reset{margin-top:4px;height:24px;font-size:9px!important} -.mx-eq-controls .mx-eq-vertical{display:flex;flex-direction:column;justify-content:center;align-items:stretch;gap:2px} -.mx-eq-footer{flex:0 0 24px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 10px;background:linear-gradient(#303f49,#1e2c37);border-top:1px solid #586572;color:#9bb2bf;font:9px/1 Consolas,monospace;white-space:nowrap} -.mx-eq-footer .mx-eq-status{min-width:0;overflow:hidden;text-overflow:ellipsis}.mx-eq-footer .mx-eq-status.good{color:#8de0bb}.mx-eq-footer .mx-eq-status.warn{color:#f2c28a}.mx-eq-footer .mx-eq-footnote{color:#829ba8} -@media(max-width:760px){#mxBuiltinEq{width:calc(100vw - 12px);height:min(440px,calc(100dvh - 12px))}.mx-eq-controls{gap:5px;padding:6px;grid-template-columns:66px repeat(4,minmax(0,1fr)) 51px}.mx-eq-rail{padding:3px;gap:2px}.mx-eq-band{gap:2px;font-size:8px!important}.mx-eq-controls input,.mx-eq-controls select{font-size:10px!important;padding:0 2px}.mx-eq-controls label{font-size:8px}.mx-eq-footer .mx-eq-footnote{display:none}} -@media(max-height:440px){.mx-eq-top{height:25px;flex-basis:25px}.mx-eq-controls{flex-basis:68px;min-height:68px}.mx-eq-rail{flex-basis:27px}.mx-eq-footer{flex-basis:20px}} -@media(prefers-reduced-motion:reduce){#mxBuiltinEq *{transition:none!important;animation:none!important}} diff --git a/site/preview-v2/assets/mixer-fx-rack.css b/site/preview-v2/assets/mixer-fx-rack.css index afc444a1a..f182de6c3 100644 --- a/site/preview-v2/assets/mixer-fx-rack.css +++ b/site/preview-v2/assets/mixer-fx-rack.css @@ -166,3 +166,38 @@ color:#849ca7!important; } .console-body .strip .fx-section.is-chain-bypassed>.subhead [data-util-kind="fx-main"]{opacity:.65} + +/* Native built-in Channel EQ is an FX component, NOT an extra stylesheet owner. + All selectors are new and scoped; historical material and VST rack geometry + remain unchanged. The Stage B CSS non-stacking gate must remain enabled. */ +/* ArSonMix: one optional BUILT-IN CHANNEL EQ overlay, never a second mixer. + * Material palette is scoped and derived from the approved /preview/ hardware + * chassis and FX glass. All sizes are compact, no blur/spectrum GPU loop. */ +.mx-eq-open{height:17px;min-width:30px;padding:0 5px;border:1px solid #56717b;border-radius:2px;background:linear-gradient(#3e555f,#283c46);color:#bce0e8;font:600 9px/15px "Segoe UI",Arial,sans-serif;letter-spacing:.3px;cursor:pointer} +.mx-eq-open:hover{border-color:#77afbd;color:#e7fcff}.mx-eq-open:focus-visible{outline:2px solid #9bd9e8;outline-offset:1px} +#mxBuiltinEq[hidden]{display:none!important} +#mxBuiltinEq{--eq-cyan:#60c8df;--eq-ink:#d9e7ed;--eq-mute:#93a5af;position:fixed;z-index:90;left:50%;top:50%;transform:translate(-50%,-50%);width:min(770px,calc(100vw - 18px));height:min(465px,calc(100dvh - 18px));min-width:0;min-height:325px;display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box;border:1px solid #566a78;border-radius:6px;background:#18232c;color:var(--eq-ink);box-shadow:0 14px 40px #000c,0 0 0 1px #0a151a,inset 0 1px #73838e;font:11px/1.25 "Segoe UI",Arial,sans-serif} +#mxBuiltinEq button,#mxBuiltinEq input,#mxBuiltinEq select{font:inherit}#mxBuiltinEq button{cursor:pointer}#mxBuiltinEq button:disabled,#mxBuiltinEq input:disabled,#mxBuiltinEq select:disabled{opacity:.55;cursor:default} +#mxBuiltinEq button:focus-visible,#mxBuiltinEq input:focus-visible,#mxBuiltinEq select:focus-visible{outline:2px solid #85d1e6;outline-offset:1px} +.mx-eq-top{height:30px;flex:0 0 30px;display:flex;align-items:center;gap:10px;padding:0 10px;background:linear-gradient(#575d62,#393f46 54%,#292f35 54%,#333c44);border-bottom:1px solid #101820;box-shadow:inset 0 1px #92999d} +.mx-eq-top .mx-eq-mark{width:4px;height:14px;background:#5fc6da}.mx-eq-top strong{font-size:12px;font-weight:600;letter-spacing:.3px;color:#eff4f6}.mx-eq-top .mx-eq-channel{color:#b9c9d0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px} +.mx-eq-top .mx-eq-spacer{flex:1}.mx-eq-top .mx-eq-mode{font:9px/1 Consolas,monospace;color:#aad3df;white-space:nowrap}.mx-eq-close{border:1px solid #1a3039;border-radius:2px;background:linear-gradient(#64737e,#394c58);color:#f3f8fa;height:22px;width:25px;font:16px/19px Arial!important;padding:0} +.mx-eq-workspace{flex:1;min-height:0;display:flex;flex-direction:column;background:#101a22} +.mx-eq-chart{position:relative;flex:1;min-height:116px;box-sizing:border-box;background:radial-gradient(ellipse at 45% 20%,#21333c 0%,#17242e 50%,#101c25 100%);overflow:hidden;border-bottom:1px solid #445560} +.mx-eq-chart canvas{display:block;width:100%;height:100%;touch-action:none;cursor:crosshair} +.mx-eq-hint{pointer-events:none;position:absolute;left:10px;top:8px;font:9px/1.1 Consolas,monospace;color:#8da6b4}.mx-eq-legend{pointer-events:none;position:absolute;right:11px;top:8px;font:9px/1.2 Consolas,monospace;color:#95b8c4} +.mx-eq-rail{flex:0 0 31px;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:3px;padding:4px 8px;background:linear-gradient(#222e38,#18232c);border-bottom:1px solid #46505a} +.mx-eq-band{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:5px;border:1px solid #3c515e;border-radius:2px;color:#94a8b6;background:#202c36;font:9px/1 "Segoe UI",Arial,sans-serif!important} +.mx-eq-band i{display:inline-block;height:6px;width:6px;flex:0 0 6px;border-radius:50%;background:var(--eq-band,#69c9dd);opacity:.35} +.mx-eq-band.on{color:#e2f3f7;background:#293f4e;border-color:#527c8c}.mx-eq-band.on i{opacity:1}.mx-eq-band.selected{outline:1px solid #a0d8e5;outline-offset:-2px;color:#f4feff} +.mx-eq-controls{flex:0 0 83px;min-height:83px;display:grid;grid-template-columns:88px repeat(4,minmax(0,1fr)) 66px;gap:10px;align-items:center;padding:7px 12px;background:linear-gradient(165deg,#394954,#273943 45%,#1d2d37);box-shadow:inset 0 1px #657a85} +.mx-eq-controls label{min-width:0;display:block;color:#9db7c2;font:9px/1.3 "Segoe UI",Arial,sans-serif;letter-spacing:.55px}.mx-eq-controls input,.mx-eq-controls select{box-sizing:border-box;margin-top:5px;min-width:0;width:100%;height:29px;padding:0 6px;border:1px solid #536674;border-radius:3px;background:linear-gradient(#0f1c26,#243542);box-shadow:inset 0 1px 3px #0008;color:#eaf3f7;font:12px/1 Consolas,monospace!important;text-align:center} +.mx-eq-controls input::-webkit-inner-spin-button{-webkit-appearance:none}.mx-eq-controls .mx-eq-switch,.mx-eq-controls .mx-eq-reset{width:100%;height:29px;border:1px solid #5b7480;border-radius:3px;color:#b4c7d0;background:linear-gradient(#3d5561,#263d48);font:10px/1 "Segoe UI",Arial,sans-serif!important} +.mx-eq-controls .mx-eq-switch[aria-pressed="true"]{background:linear-gradient(#275b59,#19413c);border-color:#4d947d;color:#adf5ce}.mx-eq-controls .mx-eq-reset{margin-top:4px;height:24px;font-size:9px!important} +.mx-eq-controls .mx-eq-vertical{display:flex;flex-direction:column;justify-content:center;align-items:stretch;gap:2px} +.mx-eq-footer{flex:0 0 24px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 10px;background:linear-gradient(#303f49,#1e2c37);border-top:1px solid #586572;color:#9bb2bf;font:9px/1 Consolas,monospace;white-space:nowrap} +.mx-eq-footer .mx-eq-status{min-width:0;overflow:hidden;text-overflow:ellipsis}.mx-eq-footer .mx-eq-status.good{color:#8de0bb}.mx-eq-footer .mx-eq-status.warn{color:#f2c28a}.mx-eq-footer .mx-eq-footnote{color:#829ba8} +@media(max-width:760px){html #mxBuiltinEq{width:calc(100vw - 12px);height:min(440px,calc(100dvh - 12px))}html .mx-eq-controls{gap:5px;padding:6px;grid-template-columns:66px repeat(4,minmax(0,1fr)) 51px}html .mx-eq-rail{padding:3px;gap:2px}html .mx-eq-band{gap:2px;font-size:8px!important}html .mx-eq-controls input,html .mx-eq-controls select{font-size:10px!important;padding:0 2px}html .mx-eq-controls label{font-size:8px}html .mx-eq-footer .mx-eq-footnote{display:none}} +@media(max-height:440px){html .mx-eq-top{height:25px;flex-basis:25px}html .mx-eq-controls{flex-basis:68px;min-height:68px}html .mx-eq-rail{flex-basis:27px}html .mx-eq-footer{flex-basis:20px}} +@media(prefers-reduced-motion:reduce){html #mxBuiltinEq *{transition:none!important;animation:none!important}} + diff --git a/site/preview-v2/index.html b/site/preview-v2/index.html index 28211ea38..6320845fe 100644 --- a/site/preview-v2/index.html +++ b/site/preview-v2/index.html @@ -14,7 +14,6 @@ - diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index feb57575d..9bc886bf3 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -4,18 +4,20 @@ import fs from 'node:fs'; import assert from 'node:assert/strict'; const html=fs.readFileSync('site/preview-v2/index.html','utf8'); const js=fs.readFileSync('site/preview-v2/assets/mixer-builtin-eq.js','utf8'); -const css=fs.readFileSync('site/preview-v2/assets/mixer-builtin-eq.css','utf8'); +const css=fs.readFileSync('site/preview-v2/assets/mixer-fx-rack.css','utf8'); const native=fs.readFileSync('web/approved-native-bridge.js','utf8'); -for(const asset of ['mixer-builtin-eq.css','mixer-builtin-eq.js']){ +for(const asset of ['mixer-builtin-eq.js']){ assert.equal((html.match(new RegExp('assets/'+asset.replace('.', '\\.'),'g'))||[]).length,1); } assert.match(html,/data-action="openBuiltinEq"/); -assert.match(html,/ArSonMixBuiltinEq\\?\\.open/); +assert.ok(html.includes('window.ArSonMixBuiltinEq?.open(t)')); assert.match(native,/__ARMIX_BUILTIN_EQ_CHANNEL__/); assert.match(js,/arMixBuiltinEqAck/); assert.match(js,/arMixBuiltinEqSnapshot/); assert.match(js,/DESIGN DEMO · NO AUDIO/); assert.match(js,/snapshotReady/); assert.ok(!['AudioContext','webkitAudioContext','createScriptProcessor','new Worker('].some(s=>js.includes(s)), 'Browser EQ must not own audio callback'); -assert.match(css,/#mxBuiltinEq\\[hidden\\]/); +assert.ok(css.includes('#mxBuiltinEq[hidden]')); console.log('Built-in Channel EQ GUI contract: PASS (isolated from VST3 and alt mixer)'); + +assert.ok(!html.includes('assets/mixer-builtin-eq.css'), 'No second CSS cascade owner'); From bbea7650f6fe2b42716135444c96fc7e6d64b86d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 11:03:29 +0700 Subject: [PATCH 10/48] fix(builtin-eq): compose EQ into one approved Pages/JUCE GUI without touching V28 source checkpoint --- scripts/build_pages.py | 17 +++++++++++++++++ site/preview-v2/index.html | 4 +--- tests/builtin_eq_gui_contract_test.mjs | 10 +++++----- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/scripts/build_pages.py b/scripts/build_pages.py index e0e92b0c3..219058f77 100644 --- a/scripts/build_pages.py +++ b/scripts/build_pages.py @@ -26,6 +26,23 @@ # are source inputs only; this output has ONE HTML, ONE CSS/JS/asset set. (buttons_dest/'assets').mkdir(parents=True) canonical_html=(canonical/'index.html').read_text(encoding='utf-8') +# Compose the OPTIONAL built-in EQ operator control into the approved assembled +# /preview/ only. Preserve historical internal seed HTML byte-for-byte: V28 +# baseline recovery must remain possible. Both public Pages and the JUCE native +# binary use this SAME deterministic assembled output; no second mixer UI. +eq_script='' +if canonical_html.count('')!=1 or 'mixer-builtin-eq.js' in canonical_html: + raise SystemExit('Built-in EQ assembler must have one pristine HTML source') +canonical_html=canonical_html.replace('',eq_script+'\\n',1) +fx_header='\\\')+\\\'')+'
'; + let out='
fxFX '+used.length+'
'; for(const {name,i} of rows){ out+='
'+ (name==='None'?'': @@ -1999,7 +1998,6 @@ } if(a==='rename'||a==='editIdentity')return; // double-click edits; single-click selects if(a==='format'&&t.kind==='audio'){t.format=t.format==='mono'?'stereo':'mono';refreshStrip(t);say(t.name+' processing → '+t.format.toUpperCase()+' · physical source '+t.input+' unchanged (reference only)');return;} - if(a==='openBuiltinEq'){window.ArSonMixBuiltinEq?.open(t);return;} if(a==='openPlugin'){openFastPicker(t,Number(btn.dataset.slot),btn);return;} if(a==='removeFx'){if(deferNativeFxIntent('Remove FX insert'))return;const i=Number(btn.dataset.slot);t.fx[i]='None';t.slotBypass[i]=false;if(t.fxInsertIds)t.fxInsertIds[i]=null;fxReorderUndo=null;refreshStrip(t);say(t.name+' · cleared FX insert '+(i+1));return;} if(a==='slotPower'){if(deferNativeFxIntent('FX insert bypass'))return;const slot=Number(btn.dataset.slot);if(t.fx[slot]==='None'){say(t.name+': choose an effect before toggling bypass');return;}t.slotBypass[slot]=!t.slotBypass[slot];refreshStrip(t);say(t.name+': FX '+(slot+1)+(t.slotBypass[slot]?' bypassed':' enabled'));return;} diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index 9bc886bf3..79b554542 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -3,14 +3,14 @@ import fs from 'node:fs'; import assert from 'node:assert/strict'; const html=fs.readFileSync('site/preview-v2/index.html','utf8'); +const assembler=fs.readFileSync('scripts/build_pages.py','utf8'); const js=fs.readFileSync('site/preview-v2/assets/mixer-builtin-eq.js','utf8'); const css=fs.readFileSync('site/preview-v2/assets/mixer-fx-rack.css','utf8'); const native=fs.readFileSync('web/approved-native-bridge.js','utf8'); -for(const asset of ['mixer-builtin-eq.js']){ - assert.equal((html.match(new RegExp('assets/'+asset.replace('.', '\\.'),'g'))||[]).length,1); -} -assert.match(html,/data-action="openBuiltinEq"/); -assert.ok(html.includes('window.ArSonMixBuiltinEq?.open(t)')); +assert.ok(assembler.includes('assets/mixer-builtin-eq.js')); +assert.ok(!html.includes('assets/mixer-builtin-eq.js'), 'V28 source HTML stays byte-frozen'); +assert.ok(assembler.includes('data-action="openBuiltinEq"')); +assert.ok(assembler.includes('window.ArSonMixBuiltinEq?.open(t)')); assert.match(native,/__ARMIX_BUILTIN_EQ_CHANNEL__/); assert.match(js,/arMixBuiltinEqAck/); assert.match(js,/arMixBuiltinEqSnapshot/); From 23ebe0f7d9600b8a3965ccaa389f2023c49ff4ef Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 11:04:25 +0700 Subject: [PATCH 11/48] fix(builtin-eq): deterministic single-GUI assembler quoting and syntax --- scripts/build_pages.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/build_pages.py b/scripts/build_pages.py index 219058f77..6606db71b 100644 --- a/scripts/build_pages.py +++ b/scripts/build_pages.py @@ -33,15 +33,16 @@ eq_script='' if canonical_html.count('')!=1 or 'mixer-builtin-eq.js' in canonical_html: raise SystemExit('Built-in EQ assembler must have one pristine HTML source') -canonical_html=canonical_html.replace('',eq_script+'\\n',1) +canonical_html=canonical_html.replace('',eq_script+'\n',1) fx_header='\\\')+\\\'')+'')+'')+'')+'':''; + plugEl('fastResults').innerHTML=builtin+'
VST3 PLUGINS
'+(list.length?list.map(p=>""" +PICKER_END = """).join(''):'
No matching effects
';""" +PICKER_END_HOOK = """).join(''):'
No matching effects
');""" +PICKER_CLICK = " const btn=e.target.closest('[data-fast-id]');if(btn)insertCatalogPlugin(btn.dataset.fastId);" +PICKER_CLICK_HOOK = """ const eq=e.target.closest('[data-fast-builtin-eq]'); + if(eq){ + const t=tracks.concat(master).find(x=>x.id===activeFxTarget?.channelId); + if(t)window.ArSonMixBuiltinEq?.insert(t); + setFastPicker(false);return; + } + const btn=e.target.closest('[data-fast-id]');if(btn)insertCatalogPlugin(btn.dataset.fastId);""" def compose_builtin_eq(source: str) -> str: + anchors=(HEADER_BEFORE,CLICK_BEFORE,RACK_START,RACK_ROWS, + PICKER_START,PICKER_END,PICKER_CLICK) if source.count('')!=1 or SCRIPT in source or 'openBuiltinEq' in source: - raise ValueError('Builtin EQ source must be pristine approved seed') - if source.count(HEADER_BEFORE)!=1 or source.count(CLICK_BEFORE)!=1: - raise ValueError('Builtin EQ expected exactly one canonical FX owner hook') + raise ValueError('Built-in EQ expects pristine approved HTML seed') + if any(source.count(a)!=1 for a in anchors): + raise ValueError('Built-in EQ requires exactly one canonical rack/picker owner') return (source.replace('',SCRIPT+'\n',1) .replace(HEADER_BEFORE,HEADER_AFTER,1) + .replace(RACK_START,RACK_HOOK,1) + .replace(RACK_ROWS,RACK_ROWS_HOOK,1) + .replace(PICKER_START,PICKER_HOOK,1) + .replace(PICKER_END,PICKER_END_HOOK,1) + .replace(PICKER_CLICK,PICKER_CLICK_HOOK,1) .replace(CLICK_BEFORE,CLICK_AFTER+'\n'+CLICK_BEFORE,1)) diff --git a/site/preview-v2/assets/mixer-builtin-eq.js b/site/preview-v2/assets/mixer-builtin-eq.js index b9cf8c43a..e00c9a705 100644 --- a/site/preview-v2/assets/mixer-builtin-eq.js +++ b/site/preview-v2/assets/mixer-builtin-eq.js @@ -40,9 +40,23 @@ let pending=null,waitingAck=false,snapshotReady=false,reqSeq=1,activeGesture=null,demonstration=true; const nativeBackend=()=>window.__JUCE__?.backend; const nativeRoute=()=>window.__ARMIX_BUILTIN_EQ_CHANNEL__; + const demoStates=new Map(),nativeStates=new Map(); + const sameGraph=(v,n)=>v&&n&&v.epoch===n.device?.epoch&&v.revision===n.graph?.revision; + const stateFor=t=>{ + if(!t||t.kind==='master')return null; + if(!nativeBackend())return demoStates.get(t.id)||null; + const id=nativeRoute()?.resolve?.(t.id),n=nativeRoute()?.state?.(); + const accepted=nativeStates.get(id);return sameGraph(accepted,n)?accepted:null; + }; + const refresh=t=>window.__ARMIX_BUILTIN_EQ_REFRESH__?.(t?.id); + const safeName=t=>String(t?.name||'Channel').replace(/[&<>"']/g,c=>({ + '&':'&','<':'<','>':'>','"':'"',"'":''' + })[c]); + const nextRequestId=()=> (BigInt(Date.now())*10000n+BigInt(reqSeq++%10000)).toString(); const setStatus=(message,kind='')=>{status.textContent=message;status.className='mx-eq-status '+kind;}; const isOpen=()=>!root.hidden; - const isEditable=()=>demonstration||Boolean(channelId&&snapshotReady&&!pending); + const isEditable=()=>demonstration||Boolean(channelId&&snapshotReady&&!pending&& + current&&stateFor(current)?.installed); const resetNative=()=>{channelId=null;epoch=null;revision=null;pending=null;waitingAck=false;snapshotReady=false;bands=empty();setStatus('NATIVE: WAITING FOR ACCEPTED CHANNEL', 'warn');render();}; const updateInputs=()=>{ const b=bands[slot]; @@ -115,9 +129,15 @@ let frame=0;const render=()=>{updateInputs();if(frame)cancelAnimationFrame(frame);frame=requestAnimationFrame(()=>{frame=0;draw();});}; const apply=(candidate)=>{ if(!isEditable()||!validBand(slot,candidate))return; - if(demonstration){bands[slot]={...candidate};setStatus('DESIGN DEMO · VISUAL ONLY · NO AUDIO','warn');render();return;} + if(demonstration){ + bands[slot]={...candidate}; + if(current)demoStates.set(current.id,{ + ...(demoStates.get(current.id)||{installed:false,bypassed:false}), + bands:bands.map(b=>({...b}))}); + setStatus('DESIGN DEMO · VISUAL ONLY · NO AUDIO','warn');render();return; + } if(!nativeBackend()?.emitEvent||!channelId||!epoch||!revision)return; - const id=(BigInt(Date.now())*10000n+BigInt(reqSeq++%10000)).toString(),command={action:'builtinEqSetBand',channelId,deviceEpoch:epoch,graphRevision:revision,requestId:id,slot,band:candidate}; + const id=nextRequestId(),command={action:'builtinEqSetBand',channelId,deviceEpoch:epoch,graphRevision:revision,requestId:id,slot,band:candidate}; pending={id,channelId,epoch,revision,slot};waitingAck=false; setStatus('NATIVE: REQUEST SENT · WAITING FOR AUDIO CALLBACK','warn');render();nativeBackend().emitEvent('arMixAction',command); }; @@ -162,7 +182,11 @@ close.addEventListener('click',()=>{root.hidden=true;activeGesture=null;}); root.addEventListener('keydown',e=>{if(e.key==='Escape'){e.stopPropagation();root.hidden=true;}}); if(typeof ResizeObserver!=='undefined'){new ResizeObserver(()=>{if(isOpen())render();}).observe(graph);}else window.addEventListener('resize',()=>{if(isOpen())render();},{passive:true}); - const validateSnap=s=>s?.schemaVersion===1&&s.channelId===channelId&&s.deviceEpoch===epoch&&s.graphRevision===revision&&/^\d+$/.test(String(s.deviceEpoch||''))&&/^\d+$/.test(String(s.graphRevision||''))&&Array.isArray(s.bands)&&s.bands.length===8&&s.bands.every((b,i)=>validBand(i,b)); + const validateSnap=s=>s?.schemaVersion===1&&s.channelId===channelId&& + s.deviceEpoch===epoch&&s.graphRevision===revision&& + typeof s.installed==='boolean'&&typeof s.bypassed==='boolean'&& + /^\d+$/.test(String(s.deviceEpoch||''))&&/^\d+$/.test(String(s.graphRevision||''))&& + Array.isArray(s.bands)&&s.bands.length===8&&s.bands.every((b,i)=>validBand(i,b)); const backend=nativeBackend(); if(backend?.addEventListener){ // A historical EQ snapshot must never stay editable after hotplug, @@ -176,18 +200,73 @@ }); backend.addEventListener('arMixBuiltinEqQueue',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='REJECTED'){pending=null;setStatus('NATIVE: EDIT REJECTED; STATE UNCHANGED','warn');render();}else setStatus('QUEUED · WAITING FOR DSP APPLY ACK','warn');}); backend.addEventListener('arMixBuiltinEqAck',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='APPLIED'&&r.deviceEpoch===pending.epoch&&r.graphRevision===pending.revision){waitingAck=true;setStatus('DSP APPLIED · AWAITING ACCEPTED READBACK','warn');}else {pending=null;waitingAck=false;setStatus('NATIVE: NOT APPLIED; STATE UNCHANGED','warn');render();}}); - backend.addEventListener('arMixBuiltinEqSnapshot',s=>{if(!isOpen()||demonstration||!validateSnap(s))return; + backend.addEventListener('arMixBuiltinEqSnapshot',s=>{if(demonstration||!validateSnap(s))return; if(pending&&(!waitingAck||s.appliedRequestId!==pending.id))return; - bands=s.bands.map(b=>({...b}));epoch=s.deviceEpoch;revision=s.graphRevision;sampleRate=Number(s.sampleRate)||48000;pending=null;waitingAck=false;snapshotReady=true; - setStatus('NATIVE · ACK + ACCEPTED PARAMETER READBACK','good');render(); + bands=s.bands.map(b=>({...b}));epoch=s.deviceEpoch;revision=s.graphRevision; + sampleRate=Number(s.sampleRate)||48000;pending=null;waitingAck=false;snapshotReady=true; + nativeStates.set(channelId,{installed:s.installed,bypassed:s.bypassed, + epoch:s.deviceEpoch,revision:s.graphRevision}); + setStatus(s.installed?'NATIVE · DSP ACCEPTED · LIVE PCM': + 'NATIVE · NOT INSERTED · CHOOSE FROM FX LIST',s.installed?'good':'warn'); + refresh(current);render(); }); } - window.ArSonMixBuiltinEq=Object.freeze({open(track){ + const setGate=(track,installed,bypassed)=>{ + if(!track||track.kind==='master'||pending)return false; + if(!nativeBackend()){ + const previous=demoStates.get(track.id)||{bands:empty()}; + demoStates.set(track.id,{...previous,installed,bypassed:installed&&bypassed, + bands:installed?previous.bands:empty()}); + if(current?.id===track.id)bands=demoStates.get(track.id).bands.map(b=>({...b})); + setStatus('DESIGN DEMO · NO AUDIO SIGNAL','warn');refresh(track);render();return true; + } + const id=nativeRoute()?.resolve?.(track.id),n=nativeRoute()?.state?.(); + if(!id||!n?.admitted||!n?.device?.epoch||!n?.graph?.revision)return false; + if(current?.id!==track.id&&isOpen())root.hidden=true; + current=track;channelId=id;epoch=n.device.epoch;revision=n.graph.revision; + snapshotReady=false; + const requestId=nextRequestId(); + pending={id:requestId,channelId:id,epoch,revision,slot:-1,kind:'gate'}; + waitingAck=false; + setStatus('NATIVE · GATE QUEUED · WAITING FOR AUDIO ACK','warn'); + nativeBackend().emitEvent('arMixAction',{action:'builtinEqSetGate',channelId:id, + deviceEpoch:epoch,graphRevision:revision,requestId,installed,bypassed}); + render();return true; + }; + window.ArSonMixBuiltinEq=Object.freeze({ + slotMarkup(track,materialIcon){ + const st=stateFor(track);if(!st?.installed)return ''; + const enabled=track.fxOn!==false&&!st.bypassed; + const power=materialIcon?.('power_settings_new')||'⏻'; + const remove=materialIcon?.('delete_forever')||'×'; + const label=safeName(track); + return '
'+ + ''+ + ''+ + '
'; + }, + insert(track){ + if(!track||track.kind==='master')return; + this.open(track); + if(!setGate(track,true,false))setStatus('NATIVE · EQ INSERT REJECTED','warn'); + }, + power(track){const st=stateFor(track);if(st?.installed)setGate(track,true,!st.bypassed);}, + remove(track){const st=stateFor(track);if(st?.installed)setGate(track,false,false);}, + open(track){ if(!track||track.kind==='master')return; current=track;channelLabel.textContent=String(track.name||'Channel');root.hidden=false;slot=2;pending=null;waitingAck=false; const host=nativeRoute(),resolved=host?.resolve?.(track.id),s=host?.state?.(); demonstration=!nativeBackend(); - if(demonstration){channelId=null;snapshotReady=false;bands=empty();sampleRate=48000;mode.textContent='UI DEMO · NO AUDIO';setStatus('DESIGN DEMO · NO AUDIO SIGNAL','warn');} + if(demonstration){channelId=null;snapshotReady=false; + bands=demoStates.get(track.id)?.bands?.map(b=>({...b}))||empty(); + sampleRate=48000;mode.textContent='UI DEMO · NO AUDIO'; + setStatus('DESIGN DEMO · NO AUDIO SIGNAL','warn');} else if(resolved&&s?.admitted){channelId=resolved;epoch=s.device?.epoch;revision=s.graph?.revision;bands=empty();pending=null;snapshotReady=false; // Control disabled until real native snapshot arrives; never pretend // that a screenshot/browser fixture is already loaded as channel state. diff --git a/site/preview-v2/assets/mixer-fx-rack.css b/site/preview-v2/assets/mixer-fx-rack.css index f182de6c3..fc7542505 100644 --- a/site/preview-v2/assets/mixer-fx-rack.css +++ b/site/preview-v2/assets/mixer-fx-rack.css @@ -201,3 +201,11 @@ @media(max-height:440px){html .mx-eq-top{height:25px;flex-basis:25px}html .mx-eq-controls{flex-basis:68px;min-height:68px}html .mx-eq-rail{flex-basis:27px}html .mx-eq-footer{flex-basis:20px}} @media(prefers-reduced-motion:reduce){html #mxBuiltinEq *{transition:none!important;animation:none!important}} + +/* Built-in native PRE insert: follow the existing FX rack visual owner. */ +.fast-fx-category{padding:6px 10px 3px;color:#8bbbc8;font:9px/1.2 "Segoe UI",Arial,sans-serif;letter-spacing:.8px;border-top:1px solid #334651} +.fast-fx-category:first-child{border-top:0} +.fxslot-row.is-builtin{border-left:2px solid #6ac4d2;background:linear-gradient(90deg,#28424b40,#25353c18)} +.fxslot-row.is-builtin .fx-pick{color:#c3ecf1} +.fxslot-row.is-builtin .fx-pick small{font:8px/1 Consolas,monospace;letter-spacing:.25px;color:#86a7b4;margin-left:5px} +.fxslot-row.is-builtin.is-bypassed .fx-pick{color:#8b9aa3} diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 9b31677bb..6acb60bd9 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1452,6 +1452,16 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback armix::diagnostics::Route::normal)return false; return dryRoutingLab_.queueBuiltInEqEdit(lane,slot,b,requestId,ep,rev); } + bool queueBuiltInEqGate(int lane,bool installed,bool bypassed, + std::uint64_t requestId,std::uint64_t ep, + std::uint64_t rev) 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_.queueBuiltInEqGate(lane,installed,bypassed, + requestId,ep,rev); + } bool pollBuiltInEqAck(int lane,std::uint64_t ep, std::uint64_t rev,BuiltInEqAck& ack) noexcept { return dryRoutingLab_.pollBuiltInEqAck(lane,ep,rev,ack); diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 5199d3c27..691a74c8f 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -1878,6 +1878,23 @@ class LiveDryRoutingLab final { [&](FxGraph& graph) noexcept {return graph.queueBuiltInEqEdit( lane,slot,band,requestId,expectedEpoch,expectedRevision);}); } + bool queueBuiltInEqGate(int lane,bool installed,bool bypassed, + std::uint64_t req,std::uint64_t ep,std::uint64_t rev) noexcept { + if(!ready()||!hasExplicitRoute()||!req||lane<0||lane>=fxSlots||ep!=epoch()) + return false; + if(channelIdPhysicalPcmActive()) { + if(rev!=nativeAccepted_.pcmRevision)return false; + const auto id=lane(lane)] + :nativeAccepted_.graph.ids.aux[static_cast(lane-count)]; + return nativePublisher_.queueBuiltInEqGate(ep,rev,id,installed,bypassed,req); + } + if(rev!=revision())return false; + return publisher_.updateActiveControl(ep,rev, + [&](FxGraph& graph) noexcept { + return graph.queueBuiltInEqGate(lane,installed,bypassed,req,ep,rev); + }); + } bool pollBuiltInEqAck(int lane,std::uint64_t expectedEpoch, std::uint64_t expectedRevision,BuiltInEqAck& ack) noexcept { if(!ready()||lane<0||lane>=fxSlots|| diff --git a/src/Main.cpp b/src/Main.cpp index 9ed9e6e30..8e480eb5f 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -291,10 +291,12 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr std::array eqSnapshotDue_{}; std::array eqLastApplied_{}; std::array,14> eqAccepted_{}; + std::array eqInstalled_{},eqBypassed_{}; std::uint64_t eqCacheEpoch_=0; void syncEqEpoch(std::uint64_t ep) { if(eqCacheEpoch_==ep)return; eqCacheEpoch_=ep;eqSnapshotDue_.fill(false);eqLastApplied_.fill(0); + eqInstalled_.fill(false);eqBypassed_.fill(false); for(auto& pending:eqPending_)pending={}; auto* hardware=engine_.devices().getCurrentAudioDevice(); const float safeHz=hardware? @@ -355,6 +357,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr bands.add(juce::var(row.release())); } out->setProperty("bands",juce::var(bands)); + out->setProperty("installed",eqInstalled_[static_cast(lane)]); + out->setProperty("bypassed",eqBypassed_[static_cast(lane)]); browser_.emitEventIfBrowserIsVisible("arMixBuiltinEqSnapshot", juce::var(out.release())); } @@ -364,6 +368,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr const armix::mixer::ChannelId ch{number}; int lane=-1;std::uint64_t liveEp=0,liveRev=0; const bool available=hasId&&engine_.builtInEqIdentity(ch,lane,liveEp,liveRev); + const bool gateAction=a.getProperty("action",{}).toString()=="builtinEqSetGate"; if(a.getProperty("action",{}).toString()=="builtinEqSnapshot") { if(available)emitEqSnapshot(ch); return; @@ -373,14 +378,24 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr eqUInt(a.getProperty("graphRevision",{}),rev)&& eqUInt(a.getProperty("requestId",{}),req)&& ep==liveEp&&rev==liveRev&&!studioBackupBusy_&&!nativeShowBusy_ && - (a.getProperty("slot",{}).isInt()||a.getProperty("slot",{}).isInt64())) { + (gateAction||a.getProperty("slot",{}).isInt()|| + a.getProperty("slot",{}).isInt64())) { syncEqEpoch(ep); const auto slot=static_cast(a.getProperty("slot",-1)); const auto b=a.getProperty("band",{}); const auto enabled=b.getProperty("enabled",{}); float freq=0,gain=0,q=0,slope=0; auto& pending=eqPending_[static_cast(lane)]; - if(!pending.active&&slot>=0&&slot<8&&b.isObject()&&enabled.isBool()&& + if(!pending.active&&gateAction&& + a.getProperty("installed",{}).isBool()&& + a.getProperty("bypassed",{}).isBool()) { + const bool install=static_cast(a.getProperty("installed",{})); + const bool bypass=static_cast(a.getProperty("bypassed",{})); + queued=engine_.queueBuiltInEqGate(lane,install,bypass,req,ep,rev); + if(queued)pending={ch,req,ep,rev,monotonicMilliseconds(),-1,true}; + } else if(!pending.active&&!gateAction&& + eqInstalled_[static_cast(lane)]&& + slot>=0&&slot<8&&b.isObject()&&enabled.isBool()&& eqFloat(b.getProperty("frequencyHz",{}),freq)&& eqFloat(b.getProperty("gainDb",{}),gain)&& eqFloat(b.getProperty("q",{}),q)&& @@ -419,7 +434,9 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr pending.revision,ack); if(!got&&now-pending.started<4000u)continue; const bool ok=got&&ack.applied&&ack.requestId==pending.request && - ack.slot==pending.slot && ack.lane==lane; + ack.lane==lane&& + ((pending.slot<0&&ack.gate)|| + (pending.slot>=0&&!ack.gate&&ack.slot==pending.slot)); auto reply=std::make_unique(); reply->setProperty("schemaVersion",1); reply->setProperty("requestId",juce::String(std::to_string(pending.request))); @@ -428,9 +445,25 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr reply->setProperty("graphRevision",juce::String(std::to_string(pending.revision))); reply->setProperty("status",ok?"APPLIED":"REJECTED"); if(ok) { - eqAccepted_[static_cast(lane)] - [static_cast(pending.slot)]=ack.accepted; - eqLastApplied_[static_cast(lane)]=pending.request; + const auto index=static_cast(lane); + if(pending.slot<0) { + eqInstalled_[index]=ack.installed; + eqBypassed_[index]=ack.bypassed; + if(!ack.installed) { + auto* device=engine_.devices().getCurrentAudioDevice(); + const float safeHz=device?static_cast( + std::min(20000.0,device->getCurrentSampleRate()*.45)):20000.f; + for(std::size_t i=0;i(pending.slot)]=ack.accepted; + eqLastApplied_[index]=pending.request; eqSnapshotDue_[static_cast(lane)]=true; } browser_.emitEventIfBrowserIsVisible("arMixBuiltinEqAck", @@ -1561,7 +1594,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr void onAction (const juce::var& args) { const auto action = args.getProperty ("action", {}).toString(); - if(action=="builtinEqSetBand"||action=="builtinEqSnapshot") { + if(action=="builtinEqSetBand"||action=="builtinEqSetGate"|| + action=="builtinEqSnapshot") { onEqAction(args);return; } const auto value = args.getProperty ("value", {}); diff --git a/tests/builtin_channel_eq_bank_test.cpp b/tests/builtin_channel_eq_bank_test.cpp index 81f5f7293..c0cf616c5 100644 --- a/tests/builtin_channel_eq_bank_test.cpp +++ b/tests/builtin_channel_eq_bank_test.cpp @@ -41,8 +41,18 @@ int main() { denyHeap.store(false); CHECK(bank.pollAck(0,a)); CHECK(a.applied&&a.requestId==101&&a.deviceEpoch==22&&a.graphRevision==9); - CHECK(a.lane==0&&a.slot==2&&a.accepted.gainDb==9); + CHECK(a.lane==0&&a.slot==2&&a.accepted.gainDb==9&&!a.gate); CHECK(!bank.pollAck(0,a)); + CHECK(bank.queueGateEdit(0,true,false,200,22,9)); + for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); + CHECK(bank.pollAck(0,a)&&a.applied&&a.gate&&a.installed&&!a.bypassed); + CHECK(bank.queueGateEdit(0,true,true,201,22,9)); + for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); + CHECK(bank.pollAck(0,a)&&a.applied&&a.bypassed); + CHECK(bank.queueGateEdit(0,false,false,202,22,9)); + for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); + CHECK(bank.pollAck(0,a)&&a.applied&&!a.installed); + CHECK(!bank.queueGateEdit(14,true,false,203,22,9)); // Queue repeated automation while the previous 5ms transition is running. // New coefficients apply only after the old fade, with no RT trigonometry. b.gainDb=3;CHECK(bank.queueBandEdit(0,2,b,102,22,9)); diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index 68bbae5aa..8ecc103e1 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -12,6 +12,9 @@ assert.ok(assembler.includes('compose_builtin_eq(canonical_html)')); assert.ok(component.includes('assets/mixer-builtin-eq.js')); assert.ok(!html.includes('assets/mixer-builtin-eq.js'), 'V28 source HTML stays byte-frozen'); assert.ok(component.includes('data-action="openBuiltinEq"')); +assert.ok(component.includes('BUILT-IN FX')&&component.includes('VST3 PLUGINS')); +assert.ok(component.includes('RACK_ROWS_HOOK')&&component.includes('PICKER_CLICK_HOOK')); +assert.ok(js.includes('slotMarkup(track')&&js.includes('builtinEqSetGate')); assert.ok(component.includes('window.ArSonMixBuiltinEq?.open(t)')); assert.match(native,/__ARMIX_BUILTIN_EQ_CHANNEL__/); assert.match(js,/arMixBuiltinEqAck/); diff --git a/tests/builtin_eq_interaction_test.mjs b/tests/builtin_eq_interaction_test.mjs index 098aba72b..1778645cf 100644 --- a/tests/builtin_eq_interaction_test.mjs +++ b/tests/builtin_eq_interaction_test.mjs @@ -53,9 +53,9 @@ class Node { const defaults=()=>[80,160,250,500,1500,4500,9500,18000].map((hz,i)=>({ enabled:false,frequencyHz:hz,gainDb:0,q:i>=2&&i<=5?1:0.70710678,slope:12 })); -const snapshot=(epoch='9',revision='3',id='0',bands=defaults())=>({ +const snapshot=(epoch='9',revision='3',id='0',bands=defaults(),installed=true,bypassed=false)=>({ schemaVersion:1,channelId:'101',deviceEpoch:epoch,graphRevision:revision, - sampleRate:44100,appliedRequestId:id,bands + sampleRate:44100,appliedRequestId:id,bands,installed,bypassed }); function start(native) { const listeners=new Map(),sent=[]; @@ -149,4 +149,34 @@ const lastAction=h=>h.sent.filter(x=>x.name==='arMixAction').at(-1)?.payload; assert.ok(drag.band.frequencyHz>250); assert.equal(power.getAttribute('aria-pressed'),'false','Drag UI stays accepted-only'); } -console.log('PASS: Built-in EQ runtime UI events, audio ACK, stale-graph fence, Pages isolation'); \ No newline at end of file +{ + const h=start(true),t={id:42,name:'Mic 1',kind:'audio'}; + h.window.ArSonMixBuiltinEq.insert(t); + const add=lastAction(h); + assert.equal(add.action,'builtinEqSetGate'); + assert.equal(add.installed,true); + assert.equal(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),'', + 'No optimistic FX insert before AUDIO ACK'); + h.fire('arMixBuiltinEqQueue',{requestId:add.requestId,channelId:'101',status:'QUEUED'}); + h.fire('arMixBuiltinEqAck',{requestId:add.requestId,channelId:'101', + deviceEpoch:'9',graphRevision:'3',status:'APPLIED'}); + assert.equal(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),'', + 'AUDIO ACK without later snapshot does not paint an insert'); + h.fire('arMixBuiltinEqSnapshot',snapshot('9','3',add.requestId)); + assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),/Channel EQ/); + h.window.ArSonMixBuiltinEq.power(t); + const bypass=lastAction(h); + assert.equal(bypass.action,'builtinEqSetGate');assert.equal(bypass.bypassed,true); + h.fire('arMixBuiltinEqAck',{requestId:bypass.requestId,channelId:'101', + deviceEpoch:'9',graphRevision:'3',status:'APPLIED'}); + h.fire('arMixBuiltinEqSnapshot',snapshot('9','3',bypass.requestId,defaults(),true,true)); + assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),/is-bypassed/); + h.window.ArSonMixBuiltinEq.remove(t); + const del=lastAction(h); + assert.equal(del.installed,false); + h.fire('arMixBuiltinEqAck',{requestId:del.requestId,channelId:'101', + deviceEpoch:'9',graphRevision:'3',status:'APPLIED'}); + h.fire('arMixBuiltinEqSnapshot',snapshot('9','3',del.requestId,defaults(),false,false)); + assert.equal(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),''); +} +console.log('PASS: Built-in EQ insert/bypass/remove after native ACK + readback; no fake PCM'); \ No newline at end of file From 880d8c7995aa4daac120647a39b07056e292fa69 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 13:50:50 +0700 Subject: [PATCH 18/48] fix(builtin-eq): advance DSP coefficient transitions even while bypassed --- engine/builtin_fx/ChannelEq.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/builtin_fx/ChannelEq.h b/engine/builtin_fx/ChannelEq.h index eb18ef382..a900304d8 100644 --- a/engine/builtin_fx/ChannelEq.h +++ b/engine/builtin_fx/ChannelEq.h @@ -195,7 +195,7 @@ class ChannelEq final { externalWet_=externalTarget_;externalFadeRemaining_=0; return; // exact bitwise bypass } - if(externalWet_==0.0f && externalFadeRemaining_==0)return; + for (std::size_t i = 0; i < frames; ++i) { const float dryL = left[i], dryR = right[i]; const float wetL = render(current_, 0, dryL), wetR = render(current_, 1, dryR); @@ -225,7 +225,7 @@ class ChannelEq final { if(current_.activeCount==0 && fadeRemaining_==0) { externalWet_=externalTarget_;externalFadeRemaining_=0;return; } - if(externalWet_==0.0f && externalFadeRemaining_==0)return; + for (std::size_t i = 0; i < frames; ++i) { const float dry = samples[i]; const float wet = render(current_, 0, dry); From 7070faec14d564d4cc8290ee1dd109268f358de9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 13:52:47 +0700 Subject: [PATCH 19/48] test(builtin-eq): preserve preexisting coefficient fade assertions before new insert-gate cases --- tests/builtin_channel_eq_bank_test.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/builtin_channel_eq_bank_test.cpp b/tests/builtin_channel_eq_bank_test.cpp index c0cf616c5..501e3f3ee 100644 --- a/tests/builtin_channel_eq_bank_test.cpp +++ b/tests/builtin_channel_eq_bank_test.cpp @@ -43,16 +43,6 @@ int main() { CHECK(a.applied&&a.requestId==101&&a.deviceEpoch==22&&a.graphRevision==9); CHECK(a.lane==0&&a.slot==2&&a.accepted.gainDb==9&&!a.gate); CHECK(!bank.pollAck(0,a)); - CHECK(bank.queueGateEdit(0,true,false,200,22,9)); - for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); - CHECK(bank.pollAck(0,a)&&a.applied&&a.gate&&a.installed&&!a.bypassed); - CHECK(bank.queueGateEdit(0,true,true,201,22,9)); - for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); - CHECK(bank.pollAck(0,a)&&a.applied&&a.bypassed); - CHECK(bank.queueGateEdit(0,false,false,202,22,9)); - for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); - CHECK(bank.pollAck(0,a)&&a.applied&&!a.installed); - CHECK(!bank.queueGateEdit(14,true,false,203,22,9)); // Queue repeated automation while the previous 5ms transition is running. // New coefficients apply only after the old fade, with no RT trigonometry. b.gainDb=3;CHECK(bank.queueBandEdit(0,2,b,102,22,9)); @@ -65,6 +55,16 @@ int main() { for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),32); bank.render(0,l.data(),r.data(),32); CHECK(bank.pollAck(0,a)&&a.requestId==103); + CHECK(bank.queueGateEdit(0,true,false,200,22,9)); + for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); + CHECK(bank.pollAck(0,a)&&a.applied&&a.gate&&a.installed&&!a.bypassed); + CHECK(bank.queueGateEdit(0,true,true,201,22,9)); + for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); + CHECK(bank.pollAck(0,a)&&a.applied&&a.bypassed); + CHECK(bank.queueGateEdit(0,false,false,202,22,9)); + for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); + CHECK(bank.pollAck(0,a)&&a.applied&&!a.installed); + CHECK(!bank.queueGateEdit(14,true,false,203,22,9)); // Demonstrate 14 truly independent EQ strips through one common call shape. for(std::size_t lane=1;lane<14;++lane){ auto copy=original; From 5da64e2a1d91b43a9f9d2e49155d7f97673005b1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 13:56:19 +0700 Subject: [PATCH 20/48] ci(builtin-eq): package and upload experimental Windows x64 EQ FAT ZIP on PR #423 --- .github/workflows/p1-windows.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index d3976eef7..f75c926ae 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -139,19 +139,19 @@ jobs: - name: Test realtime control primitives run: ctest --test-dir build -C Release --output-on-failure - name: Package verified JUCE GUI for hardware FAT - if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' }} + if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' || github.head_ref == 'feat/native-builtin-fx-channel-eq-20261106' }} shell: pwsh run: | & ./scripts/package_native_windows.ps1 -BuildDir build -OutputDir dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Stage ONLY legally approved and host-qualified Factory VST3 bundles - if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' }} + if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' || github.head_ref == 'feat/native-builtin-fx-channel-eq-20261106' }} shell: pwsh run: | python scripts/factoryfx_release_bundle.py stage --lock config/factoryfx-approved-releases.json --output dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Independently verify release ZIP and embedded GUI/engine before upload - if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' }} + if: ${{ github.event_name != 'pull_request' || startsWith(github.head_ref, 'integration/product-') || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' || github.head_ref == 'feat/native-builtin-fx-channel-eq-20261106' }} shell: pwsh run: | & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist @@ -160,12 +160,14 @@ jobs: # proof requires its exact Windows EXE, never a stable release. # Ordinary engine PRs compile/CTest without wasting package/ZIP work. # Release-integration PRs and main/manual runs package and verify, but never silently publish a stable release. + # Built-in EQ PR #423 also needs an UNQUALIFIED Windows ZIP to test EQ hardware; + # this remains an isolated candidate, not a production release. # 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 == 'perf/p0-stage-a-approved-gui-profiling-20261105' }} + if: ${{ github.event_name != 'pull_request' || github.head_ref == 'milestone/m4-unified-native-multichannel-fx-20261101' || github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' || github.head_ref == 'feat/native-builtin-fx-channel-eq-20261106' }} with: - name: ${{ github.event_name == 'pull_request' && github.head_ref == 'perf/p0-stage-a-approved-gui-profiling-20261105' && 'ArSonMix-P0-EXPERIMENTAL-Pointer-Latency-FAT-Windows-x64' || 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 == 'perf/p0-stage-a-approved-gui-profiling-20261105' && 'ArSonMix-P0-EXPERIMENTAL-Pointer-Latency-FAT-Windows-x64' || github.event_name == 'pull_request' && github.head_ref == 'feat/native-builtin-fx-channel-eq-20261106' && 'ArSonMix-ChannelEQ-EXPERIMENTAL-Windows-x64-FAT' || 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 From c31ea236afffc4ed5ab4aebb399884bb1e15e567 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 13:57:27 +0700 Subject: [PATCH 21/48] test(builtin-eq): execute live EQ picker/editor and audio-ACK GUI regression in Chromium CI --- .github/workflows/ui-smoke.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index ffc92c72b..d38dc0f7d 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -141,6 +141,8 @@ jobs: node --check web/mixer-io.js node --check web/mixer-layout.js node --test tests/workstream_coordination_contract.test.mjs 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/approved_native_m2_contract.test.cjs + node --check site/preview-v2/assets/mixer-builtin-eq.js + node --test tests/builtin_eq_gui_contract_test.mjs - name: Validate approved GUI checkpoint and single publisher run: python tests/gui_baseline_lock_test.py - name: CSS V28 zero-regression source-order recovery (every GUI CI run) From 2559353f4ef0ed247b73390d7a9f339fa177dcf9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 14:07:35 +0700 Subject: [PATCH 22/48] fix(builtin-eq): restore per-channel rack readback after graph revisions and fail-closed legacy Show capture --- scripts/compose_builtin_eq.py | 5 +++ site/preview-v2/assets/mixer-builtin-eq.js | 42 +++++++++++++++++++++- src/Main.cpp | 14 ++++++++ tests/builtin_eq_gui_contract_test.mjs | 5 +++ tests/builtin_eq_interaction_test.mjs | 23 ++++++++++++ 5 files changed, 88 insertions(+), 1 deletion(-) diff --git a/scripts/compose_builtin_eq.py b/scripts/compose_builtin_eq.py index 2d0056f14..fbb8e093d 100644 --- a/scripts/compose_builtin_eq.py +++ b/scripts/compose_builtin_eq.py @@ -16,6 +16,11 @@ const t=tracks.concat(master).find(x=>x.id===Number(uiId)); if(t)refreshStrip(t); }; +window.__ARMIX_BUILTIN_EQ_FIND_CHANNEL__=function(nativeChannelId){ + return tracks.concat(master).find(t=> + window.__ARMIX_BUILTIN_EQ_CHANNEL__?.resolve?.(t.id)===nativeChannelId + )||null; +}; function sectionFx(t){""" RACK_ROWS = " for(const {name,i} of rows){" RACK_ROWS_HOOK = """ out+=window.ArSonMixBuiltinEq?.slotMarkup?.(t,materialIcon)||''; diff --git a/site/preview-v2/assets/mixer-builtin-eq.js b/site/preview-v2/assets/mixer-builtin-eq.js index e00c9a705..337f7fff5 100644 --- a/site/preview-v2/assets/mixer-builtin-eq.js +++ b/site/preview-v2/assets/mixer-builtin-eq.js @@ -41,6 +41,7 @@ const nativeBackend=()=>window.__JUCE__?.backend; const nativeRoute=()=>window.__ARMIX_BUILTIN_EQ_CHANNEL__; const demoStates=new Map(),nativeStates=new Map(); + let lastGraphEqSweep=''; const sameGraph=(v,n)=>v&&n&&v.epoch===n.device?.epoch&&v.revision===n.graph?.revision; const stateFor=t=>{ if(!t||t.kind==='master')return null; @@ -192,6 +193,27 @@ // A historical EQ snapshot must never stay editable after hotplug, // device restart, graph replacement or channel removal. backend.addEventListener('arMixConsoleSnapshot',s=>{ + // The approved native graph projection may install strips after this + // listener in the same browser turn. Request each actual ChannelId once + // per admitted epoch/revision, after its projection has settled. + const requery=()=>{ + const n=nativeRoute()?.state?.(); + if(!n?.admitted||!s?.admitted|| + s.device?.epoch!==n.device?.epoch|| + s.graph?.revision!==n.graph?.revision|| + !Array.isArray(n.graph?.channels))return; + const key=String(n.device.epoch)+'/'+String(n.graph.revision); + if(key===lastGraphEqSweep)return; + lastGraphEqSweep=key; + for(const ch of n.graph.channels) { + const t=window.__ARMIX_BUILTIN_EQ_FIND_CHANNEL__?.(ch.id); + if(t&&t.kind!=='master') + backend.emitEvent('arMixAction',{action:'builtinEqSnapshot', + channelId:ch.id}); + } + }; + if(typeof window.setTimeout==='function')window.setTimeout(requery,0); + else requery(); if(!isOpen()||demonstration||!channelId)return; const accepted=s?.admitted===true&&s.device?.epoch===epoch&& s.graph?.revision===revision&&Array.isArray(s.graph.channels)&& @@ -200,7 +222,25 @@ }); backend.addEventListener('arMixBuiltinEqQueue',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='REJECTED'){pending=null;setStatus('NATIVE: EDIT REJECTED; STATE UNCHANGED','warn');render();}else setStatus('QUEUED · WAITING FOR DSP APPLY ACK','warn');}); backend.addEventListener('arMixBuiltinEqAck',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='APPLIED'&&r.deviceEpoch===pending.epoch&&r.graphRevision===pending.revision){waitingAck=true;setStatus('DSP APPLIED · AWAITING ACCEPTED READBACK','warn');}else {pending=null;waitingAck=false;setStatus('NATIVE: NOT APPLIED; STATE UNCHANGED','warn');render();}}); - backend.addEventListener('arMixBuiltinEqSnapshot',s=>{if(demonstration||!validateSnap(s))return; + backend.addEventListener('arMixBuiltinEqSnapshot',s=>{ + const n=nativeRoute()?.state?.(); + const validIdentity=s?.schemaVersion===1&& + typeof s.channelId==='string'&&typeof s.installed==='boolean'&& + typeof s.bypassed==='boolean'&&s.deviceEpoch===n?.device?.epoch&& + s.graphRevision===n?.graph?.revision; + const otherTrack=validIdentity? + window.__ARMIX_BUILTIN_EQ_FIND_CHANNEL__?.(s.channelId):null; + const hasUnconfirmedCurrent=pending&&pending.channelId===s?.channelId&& + (!waitingAck||s.appliedRequestId!==pending.id); + if(otherTrack&&!hasUnconfirmedCurrent) { + const prior=nativeStates.get(s.channelId); + nativeStates.set(s.channelId,{installed:s.installed,bypassed:s.bypassed, + epoch:s.deviceEpoch,revision:s.graphRevision}); + if(!prior||prior.installed!==s.installed||prior.bypassed!==s.bypassed|| + prior.revision!==s.graphRevision||prior.epoch!==s.deviceEpoch) + refresh(otherTrack); + } + if(demonstration||!validateSnap(s))return; if(pending&&(!waitingAck||s.appliedRequestId!==pending.id))return; bands=s.bands.map(b=>({...b}));epoch=s.deviceEpoch;revision=s.graphRevision; sampleRate=Number(s.sampleRate)||48000;pending=null;waitingAck=false;snapshotReady=true; diff --git a/src/Main.cpp b/src/Main.cpp index 8e480eb5f..aa6959876 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -293,6 +293,14 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr std::array,14> eqAccepted_{}; std::array eqInstalled_{},eqBypassed_{}; std::uint64_t eqCacheEpoch_=0; + // The existing native Show v4 records VST3 but NOT these EQ coefficients. + // Fail closed until a transactional Show format and DSP recall are shipped. + bool uncapturedBuiltInEq() const noexcept { + return std::any_of(eqInstalled_.begin(),eqInstalled_.end(), + [](bool installed){return installed;}) || + std::any_of(eqPending_.begin(),eqPending_.end(), + [](const EqPending& p){return p.active;}); + } void syncEqEpoch(std::uint64_t ep) { if(eqCacheEpoch_==ep)return; eqCacheEpoch_=ep;eqSnapshotDue_.fill(false);eqLastApplied_.fill(0); @@ -1890,6 +1898,9 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if (nativeShowBusy_ || studioBackupBusy_ || catalog_.busy() || engine_.isGraphSwitchPending() || engine_.hasTemporaryDiagnosticDevice()) return reject("Finish the current Studio task before capturing a native Show."); + if(uncapturedBuiltInEq()) + return reject("Native Show v4 cannot save Built-in Channel EQ bands. " + "Save blocked to avoid silently losing live EQ state."); // Never save the unacknowledged JS draft. Message-thread capture // reads the accepted LIVE graph, updated faders and exact device epoch. // VST3 is fail-closed until a quiescent vendor state capture gate exists. @@ -2041,6 +2052,9 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr }; if(!armix::shows::detail::uuid(id)) return reject("Select a native Show UUID from the saved list."); + if(uncapturedBuiltInEq()) + return reject("Native Show recall cannot replace an active Built-in EQ " + "until EQ state is included in transactional Show recall."); if(nativeShowBusy_ || studioBackupBusy_ || catalog_.busy() || engine_.isGraphSwitchPending() || !engine_.allOutputsDisarmed()) return reject("Mute native output and finish ongoing Studio work."); diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index 8ecc103e1..8670faff3 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -15,6 +15,11 @@ assert.ok(component.includes('data-action="openBuiltinEq"')); assert.ok(component.includes('BUILT-IN FX')&&component.includes('VST3 PLUGINS')); assert.ok(component.includes('RACK_ROWS_HOOK')&&component.includes('PICKER_CLICK_HOOK')); assert.ok(js.includes('slotMarkup(track')&&js.includes('builtinEqSetGate')); +assert.ok(js.includes('lastGraphEqSweep')&&js.includes('otherTrack'), + 'Reproject actual native ChannelId EQ state after structural graph revision'); +const main=fs.readFileSync('src/Main.cpp','utf8'); +assert.ok(main.includes('uncapturedBuiltInEq()'), + 'Do not persist/show-recall EQ state via legacy schema v4'); assert.ok(component.includes('window.ArSonMixBuiltinEq?.open(t)')); assert.match(native,/__ARMIX_BUILTIN_EQ_CHANNEL__/); assert.match(js,/arMixBuiltinEqAck/); diff --git a/tests/builtin_eq_interaction_test.mjs b/tests/builtin_eq_interaction_test.mjs index 1778645cf..046225089 100644 --- a/tests/builtin_eq_interaction_test.mjs +++ b/tests/builtin_eq_interaction_test.mjs @@ -179,4 +179,27 @@ const lastAction=h=>h.sent.filter(x=>x.name==='arMixAction').at(-1)?.payload; h.fire('arMixBuiltinEqSnapshot',snapshot('9','3',del.requestId,defaults(),false,false)); assert.equal(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),''); } +{ + const h=start(true),track={id:42,name:'Vocal',kind:'audio',fxOn:true}; + let paints=0; + h.window.__ARMIX_BUILTIN_EQ_FIND_CHANNEL__=id=>id==='101'?track:null; + h.window.__ARMIX_BUILTIN_EQ_REFRESH__=()=>{paints++;}; + h.fire('arMixConsoleSnapshot',{admitted:true,device:{epoch:'9'}, + graph:{revision:'3',channels:[{id:'101'}]}}); + assert.equal(lastAction(h)?.action,'builtinEqSnapshot', + 'Accepted graph must requery exact ChannelId EQ readback'); + h.fire('arMixBuiltinEqSnapshot',snapshot('9','3','0',defaults(),true,false)); + assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(track,()=>''),/Channel EQ/, + 'Unopened editor still restores authoritative rack presence'); + assert.ok(paints>0); + h.session('10','4'); + assert.equal(h.window.ArSonMixBuiltinEq.slotMarkup(track,()=>''),'', + 'Device/graph change revokes stale EQ rack state'); + h.fire('arMixConsoleSnapshot',{admitted:true,device:{epoch:'10'}, + graph:{revision:'4',channels:[{id:'101'}]}}); + assert.equal(lastAction(h)?.action,'builtinEqSnapshot'); + h.fire('arMixBuiltinEqSnapshot',snapshot('10','4','0',defaults(),false,false)); + assert.equal(h.window.ArSonMixBuiltinEq.slotMarkup(track,()=>''),'', + 'New session flat EQ does not borrow prior device state'); +} console.log('PASS: Built-in EQ insert/bypass/remove after native ACK + readback; no fake PCM'); \ No newline at end of file From cc2b10f5dd782b25f39284cbc9972eb75089731a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 14:21:13 +0700 Subject: [PATCH 23/48] test(builtin-eq): explicitly install EQ in both native PCM fixtures and assert insert AUDIO ACK --- tests/live_channel_fx_graph_test.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index dcc6ba4c4..d1dac9526 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -1889,6 +1889,8 @@ static void verifyBuiltInEqRealPcmHook() { b.enabled=true;b.frequencyHz=1000;b.gainDb=9;b.q=1; assert(!wet->queueBuiltInEqEdit(0,2,b,0,7,2)); assert(wet->queueBuiltInEqEdit(0,2,b,101,7,2)); + // Insertion is a separate ACK-backed AUDIO command, not implicit in edits. + assert(wet->queueBuiltInEqGate(0,true,false,102,7,2)); std::array pcm{},silent{},wl{},wr{},dl{},dr{}; const float* pins[]{pcm.data(),silent.data()}; double dryPower=0,wetPower=0; @@ -1905,7 +1907,13 @@ static void verifyBuiltInEqRealPcmHook() { LiveChannelFxGraph::BuiltInEqAck ack{}; assert(wet->pollBuiltInEqAck(0,ack)); assert(ack.applied&&ack.requestId==101&&ack.deviceEpoch==7&& - ack.graphRevision==2&&ack.slot==2); + ack.graphRevision==2&&ack.slot==2&&!ack.gate); + } + if(block==4) { + LiveChannelFxGraph::BuiltInEqAck ack{}; + assert(wet->pollBuiltInEqAck(0,ack)); + assert(ack.applied&&ack.gate&&ack.installed&&!ack.bypassed&& + ack.requestId==102&&ack.deviceEpoch==7&&ack.graphRevision==2); } if(block>=48)for(int i=0;i<128;++i) { dryPower+=dl[static_cast(i)]*dl[static_cast(i)]; @@ -1942,6 +1950,8 @@ static void verifyBuiltInEqNativeChannelIdAndRevisionFence() { b.enabled=true;b.frequencyHz=1000;b.gainDb=9;b.q=1.f; assert(!native.queueBuiltInEqEdit(9,1,main,2,b,101)); assert(native.queueBuiltInEqEdit(9,1,ch,2,b,101)); + assert(!native.queueBuiltInEqGate(9,1,main,true,false,102)); // wrong ChannelId + assert(native.queueBuiltInEqGate(9,1,ch,true,false,102)); std::array pcm{},left{},right{}; const float* pins[]{pcm.data()}; auto noFx=[](ChannelId,float*,float*,int) noexcept {}; @@ -1956,7 +1966,12 @@ static void verifyBuiltInEqNativeChannelIdAndRevisionFence() { if(block==0) { armix::builtin_fx::ChannelEqBank::Ack ack{}; assert(native.pollBuiltInEqAck(9,1,ch,ack)); - assert(ack.applied&&ack.requestId==101&&ack.slot==2); + assert(ack.applied&&ack.requestId==101&&ack.slot==2&&!ack.gate); + } + if(block==4) { + armix::builtin_fx::ChannelEqBank::Ack ack{}; + assert(native.pollBuiltInEqAck(9,1,ch,ack)); + assert(ack.applied&&ack.gate&&ack.installed&&ack.requestId==102); } if(block>=48)for(float y:left)power+=y*y; } From 849d083933e6ba1144f770f034e35184569d4250 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 14:57:27 +0700 Subject: [PATCH 24/48] feat(builtin-eq): transactional Show V5 8-band save/recall with fresh native DSP graph and legacy migration --- engine/builtin_fx/ChannelEqBank.h | 7 ++ engine/core/LiveChannelFxGraph.h | 10 +++ src/LiveAudioEngine.h | 5 +- src/LiveDryRoutingLab.h | 33 +++++++++- src/Main.cpp | 75 ++++++++++++++++++---- src/NativeShowSchema.h | 85 +++++++++++++++++++++++-- tests/builtin_channel_eq_bank_test.cpp | 39 +++++++++++- tests/native_live_show_capture_test.cpp | 14 ++-- tests/native_show_schema_test.cpp | 54 +++++++++++++++- 9 files changed, 287 insertions(+), 35 deletions(-) diff --git a/engine/builtin_fx/ChannelEqBank.h b/engine/builtin_fx/ChannelEqBank.h index e2b511e27..22296f406 100644 --- a/engine/builtin_fx/ChannelEqBank.h +++ b/engine/builtin_fx/ChannelEqBank.h @@ -106,6 +106,13 @@ class ChannelEqBank final { bool setBandOffline(std::size_t lane, std::size_t slot,const Band& band) noexcept { return ready_ && lane < laneCount && eqs_[lane].setBand(slot,band); } + // CONTROL only on an UNPUBLISHED, never-shared candidate. Restore + // a complete EQ before graph publication, not as eight audible UI writes. + bool setGateOffline(std::size_t lane,bool installed,bool bypassed) noexcept { + if(!ready_||lane>=laneCount||(!installed&&bypassed))return false; + eqs_[lane].setExternalBypass(!installed||bypassed); + return true; + } // AUDIO OWNER ONLY. At most one filter change per strip per block, and // never start another 5ms topology fade before the previous one ends. // A full acknowledgement ring BACKPRESSURES the request queue; it must diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index 95ce094a4..8573d81c8 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -208,6 +208,16 @@ class LiveChannelFxGraph final { void setBuiltInEqSession(std::uint64_t ep,std::uint64_t rev) noexcept { builtinEqEpoch_=ep;builtinEqRevision_=rev; } + bool setBuiltInEqOffline(int lane,std::size_t slot, + const armix::builtin_fx::Band& b) noexcept { + return lane>=0&&lanesetBandOffline(static_cast(lane),slot,b); + } + bool setBuiltInEqGateOffline(int lane,bool installed,bool bypassed) noexcept { + return lane>=0&&lanesetGateOffline(static_cast(lane), + installed,bypassed); + } bool queueBuiltInEqEdit(int lane,std::size_t slot,const armix::builtin_fx::Band& b, std::uint64_t req,std::uint64_t epoch,std::uint64_t rev) noexcept { return lane>=0&&lanequeueBandEdit( diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 6acb60bd9..f43ea35cc 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -1059,7 +1059,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback juce::String applyDryRoutingLab ( const juce::var& command, const LiveDryRoutingLab::FxSelections& fx, - const LiveDryRoutingLab::FxRestores* restored=nullptr) { + const LiveDryRoutingLab::FxRestores* restored=nullptr, + const LiveDryRoutingLab::EqRestores* restoredEq=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"; @@ -1084,7 +1085,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback const auto result=dryRoutingLab_.apply( command,directFence_.permitted(),independent_.active(), graphOwned_->count,fx,formats_,device->getCurrentSampleRate(), - frames,true,restored); + frames,true,restored,restoredEq); // Same original PCM callback/hardware gate; a failed ChannelId // admission retains the last accepted M4 with original Orbit/Show. if(result.isEmpty()) diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 691a74c8f..6fea9117f 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -57,6 +57,11 @@ class LiveDryRoutingLab final { const juce::MemoryBlock* binary=nullptr; }; using FxRestores=std::array,fxSlots>; + struct EqRestore final { + bool installed=false,bypassed=false; + std::array bands{}; + }; + using EqRestores=std::array; struct ChannelEdit { float linear=1.f, pan=0.f; bool mute=false, solo=false, mono=false; @@ -174,7 +179,8 @@ class LiveDryRoutingLab final { const FxSelections& selections, juce::AudioPluginFormatManager& formats, double sampleRate,int deviceFrames,bool explicitSelection=true, - const FxRestores* restores=nullptr) { + const FxRestores* restores=nullptr, + const EqRestores* eqRestores=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. @@ -341,7 +347,30 @@ class LiveDryRoutingLab final { // and FxInstance has an atomic try-enter to guard against overlap. // Never reuse across a device epoch or changed device quantum. const auto* prior=publisher_.controlPrepared(currentEpoch,expectedRevision); - if(prior)next->prepared->inheritBuiltInEqFrom(*prior); + // Show recall must publish ONE fresh, fully prepared DSP bank. + // Never edit a prior LIVE EQ owner or borrow its histories for recall. + if(eqRestores) { + for(int lane=0;lane(lane)]; + if(!saved.installed && saved.bypassed) + return "Invalid Show EQ: bypass without insert"; + for(std::size_t slot=0;slot( + std::min(20000.0,sampleRate*.45))); + if((!saved.installed&&band.enabled)|| + !next->prepared->setBuiltInEqOffline(lane,slot,band)) + return "Show EQ filter not valid for current audio device rate"; + } + if(!next->prepared->setBuiltInEqGateOffline(lane, + saved.installed,saved.bypassed)) + return "Cannot prepare native Show EQ gate"; + } + } else if(prior)next->prepared->inheritBuiltInEqFrom(*prior); int insertCount=0,reusedCount=0; for(int lane=0;lane,14> eqAccepted_{}; std::array eqInstalled_{},eqBypassed_{}; std::uint64_t eqCacheEpoch_=0; - // The existing native Show v4 records VST3 but NOT these EQ coefficients. - // Fail closed until a transactional Show format and DSP recall are shipped. - bool uncapturedBuiltInEq() const noexcept { - return std::any_of(eqInstalled_.begin(),eqInstalled_.end(), - [](bool installed){return installed;}) || - std::any_of(eqPending_.begin(),eqPending_.end(), + // Never serialize an unacknowledged command, even if output is muted. + bool unsettledBuiltInEq() const noexcept { + return std::any_of(eqPending_.begin(),eqPending_.end(), [](const EqPending& p){return p.active;}); } + void captureAcceptedEq(armix::shows::SnapshotV2& show) const noexcept { + for(std::size_t lane=0;lane(std::min( + 20000.0,device->getCurrentSampleRate()*.45)); + for(auto& band:eqAccepted_[lane]) + if(!band.enabled)band.frequencyHz=std::min( + band.frequencyHz,safeHz); + } + // No fabricated DSP acknowledgement; the new graph contains + // accepted offline state and UI requests a fresh native snapshot. + } + } void syncEqEpoch(std::uint64_t ep) { if(eqCacheEpoch_==ep)return; eqCacheEpoch_=ep;eqSnapshotDue_.fill(false);eqLastApplied_.fill(0); @@ -1898,9 +1923,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if (nativeShowBusy_ || studioBackupBusy_ || catalog_.busy() || engine_.isGraphSwitchPending() || engine_.hasTemporaryDiagnosticDevice()) return reject("Finish the current Studio task before capturing a native Show."); - if(uncapturedBuiltInEq()) - return reject("Native Show v4 cannot save Built-in Channel EQ bands. " - "Save blocked to avoid silently losing live EQ state."); + if(unsettledBuiltInEq()) + return reject("Wait for the pending native EQ AUDIO ACK before Show SAVE."); // Never save the unacknowledged JS draft. Message-thread capture // reads the accepted LIVE graph, updated faders and exact device epoch. // VST3 is fail-closed until a quiescent vendor state capture gate exists. @@ -1914,6 +1938,11 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr static_cast(lab.getProperty("revision",juce::var(0)))); auto error=armix::shows::NativeLiveShowCapture::captureDry( nativeStatus,name,captured,true); + if(error.isEmpty()) { + syncEqEpoch(epoch); + if(unsettledBuiltInEq())error="Native EQ changed during Show capture"; + else captureAcceptedEq(captured); // exact ACK-accepted 10 CH + 4 AUX + } std::vector blobs; if(error.isEmpty()) { // Do not read vendor parameters while an editor is open. @@ -1955,7 +1984,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr } } if(error.isEmpty()) { - captured.sourceBuild="G5E_NATIVE_FX_SHOW_CAPTURE"; + captured.sourceBuild="BUILTIN_EQ_V5_PLUS_G5E_VST3_SHOW_CAPTURE"; armix::shows::SnapshotV2 verified; if(!armix::shows::Codec::decode( armix::shows::Codec::encode(captured),verified)) @@ -2052,9 +2081,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr }; if(!armix::shows::detail::uuid(id)) return reject("Select a native Show UUID from the saved list."); - if(uncapturedBuiltInEq()) - return reject("Native Show recall cannot replace an active Built-in EQ " - "until EQ state is included in transactional Show recall."); + if(unsettledBuiltInEq()) + return reject("Wait for pending native EQ AUDIO ACK before Show RECALL."); if(nativeShowBusy_ || studioBackupBusy_ || catalog_.busy() || engine_.isGraphSwitchPending() || !engine_.allOutputsDisarmed()) return reject("Mute native output and finish ongoing Studio work."); @@ -2092,6 +2120,17 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr try { LiveDryRoutingLab::FxSelections selections{}; LiveDryRoutingLab::FxRestores restores{}; + LiveDryRoutingLab::EqRestores eqRestores{}; + for(int lane=0;lane(lane)].eq + :result.loaded.aux[static_cast( + lane-LiveDryRoutingLab::count)].eq; + auto& eq=eqRestores[static_cast(lane)]; + eq.installed=eqSaved.installed; + eq.bypassed=eqSaved.bypassed; + eq.bands=eqSaved.bands; + } const auto attach=[&](int lane, const std::vector& refs) ->juce::String { @@ -2134,7 +2173,15 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if(error.isEmpty()) { safe->closePluginEditor(); error=safe->engine_.applyDryRoutingLab( - command,selections,&restores); + command,selections,&restores,&eqRestores); + if(error.isEmpty()) { + // Only after all VST3 AND built-in EQ + // state is accepted in one new native graph. + const auto epochNow=static_cast( + static_cast( + lab.getProperty("epoch",juce::var(0)))); + safe->acceptedEqFromShow(result.loaded,epochNow); + } } } catch(const std::exception& ex) { error="Native VST3 Show preflight exception: "+ diff --git a/src/NativeShowSchema.h b/src/NativeShowSchema.h index e0abff646..44c7b47af 100644 --- a/src/NativeShowSchema.h +++ b/src/NativeShowSchema.h @@ -1,6 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only #pragma once #include +#include "../engine/builtin_fx/ChannelEq.h" #include #include #include @@ -24,6 +25,19 @@ struct FxRef final { juce::String stateSha256; // external, separately verified immutable blob bool bypass = false; }; +// v5: Compact CONTROL-only 8-band EQ record per fixed channel/AUX. +// Never stores a vendor plugin, UI ordinal, device pointer or PCM state. +struct EqState final { + bool installed=false,bypassed=false; + std::array bands{}; + EqState() noexcept { + for(std::size_t i=0;i fx; + EqState eq; std::vector sends; }; // AUX is an extra, one-way stereo FX return, not INPUT CH9/10 or hardware I/O. @@ -47,6 +62,7 @@ struct AuxReturn final { bool enabled = false, toMaster = true, mute = false; double gain = 1.0; std::vector fx; + EqState eq; }; struct AuxSend final { int source = -1; // physical logical INPUT 0..9 @@ -165,9 +181,9 @@ class Codec final { static juce::String encode(const SnapshotV2& s) { auto v=detail::object(); detail::commonWrite(v,s.id,s.name,s.createdMs,s.modifiedMs); - // V4 records the independent channel processing width; V3 lacked - // this field and V2 also lacked AUX returns. Old readers fail closed. - detail::put(v,"schemaVersion",4); + // V5 adds real native Channel EQ with an exact 8-band record per + // original CH/AUX; V2-V4 remain readable only as EQ-not-installed. + detail::put(v,"schemaVersion",5); detail::put(v,"format","arsonmix.native.snapshot"); detail::put(v,"sourceBuild",s.sourceBuild); auto master=detail::object(); @@ -197,6 +213,7 @@ class Codec final { sends.add(p); } detail::put(c,"fx",juce::var(fx));detail::put(c,"sends",juce::var(sends)); + detail::put(c,"builtinEq",encodeEq(ch.eq)); strips.add(c); } detail::put(v,"strips",juce::var(strips)); @@ -210,6 +227,7 @@ class Codec final { detail::put(rec,"mute",bus.mute); detail::put(rec,"gain",bus.gain); detail::put(rec,"fx",juce::var(encodeFx(bus.fx))); + detail::put(rec,"builtinEq",encodeEq(bus.eq)); aux.add(rec); } for(const auto& send:s.auxSends) { @@ -241,9 +259,9 @@ class Codec final { static bool decode(const juce::String& json,SnapshotV2& out) { if(json.getNumBytesAsUTF8()>maxJsonBytes) return false; const auto v=juce::JSON::parse(json); - if(!detail::header(v,"arsonmix.native.snapshot",2,4)) return false; + if(!detail::header(v,"arsonmix.native.snapshot",2,5)) return false; int version=0; - if(!detail::integer(detail::get(v,"schemaVersion"),version,2,4)) + if(!detail::integer(detail::get(v,"schemaVersion"),version,2,5)) return false; SnapshotV2 next; if(!detail::common(v,next.id,next.name,next.createdMs,next.modifiedMs) || @@ -284,7 +302,7 @@ class Codec final { // V2/V3 migration infers exactly the original native v1 format. // Never silently discard a new typed width from a downgraded file. const auto width=detail::get(rec,"channelFormat"); - if(version==4){ + if(version>=4){ if(!detail::integer(width,ch.channelFormat,1,2))return false; } else { if(!width.isVoid())return false; @@ -294,6 +312,10 @@ class Codec final { (ch.source==1 && (ch.inputA<0||ch.inputB!=-1)) || (ch.source==2 && (ch.inputA<0||ch.inputB<0||ch.inputA==ch.inputB))) return false; + const auto eqRecord=detail::get(rec,"builtinEq"); + if(version>=5) { + if(!decodeEq(eqRecord,ch.eq)) return false; + } else if(!eqRecord.isVoid()) return false; // no silent EQ downgrade const auto fxv=detail::get(rec,"fx"), sv=detail::get(rec,"sends"); const auto* sends=sv.getArray(); if(!sends || (totalSends+=sends->size())>maxSendsPerSnapshot || @@ -334,6 +356,10 @@ class Codec final { !detail::flag(detail::get(rec,"mute"),bus.mute) || !detail::real(detail::get(rec,"gain"),bus.gain,0.0,4.0) || !decodeFx(detail::get(rec,"fx"),bus.fx)) return false; + const auto eqRecord=detail::get(rec,"builtinEq"); + if(version>=5) { + if(!decodeEq(eqRecord,bus.eq))return false; + } else if(!eqRecord.isVoid())return false; } for(const auto& rec:*sends) { AuxSend send; @@ -353,6 +379,53 @@ class Codec final { out=std::move(next); return true; } private: + static juce::var encodeEq(const EqState& state) { + auto rec=detail::object(); + detail::put(rec,"installed",state.installed); + detail::put(rec,"bypassed",state.bypassed); + juce::Array rows; + for(const auto& band:state.bands) { + auto b=detail::object(); + detail::put(b,"enabled",band.enabled); + detail::put(b,"frequencyHz",static_cast(band.frequencyHz)); + detail::put(b,"gainDb",static_cast(band.gainDb)); + detail::put(b,"q",static_cast(band.q)); + detail::put(b,"slope",static_cast(band.slope)); + rows.add(b); + } + detail::put(rec,"bands",juce::var(rows)); + return rec; + } + static bool decodeEq(const juce::var& rec,EqState& result) { + if(!rec.isObject())return false; + EqState next; + if(!detail::flag(detail::get(rec,"installed"),next.installed)|| + !detail::flag(detail::get(rec,"bypassed"),next.bypassed)|| + (!next.installed&&next.bypassed))return false; + const auto bandsValue=detail::get(rec,"bands"); + const auto* rows=bandsValue.getArray(); + if(!rows||rows->size()!=static_cast(next.bands.size()))return false; + for(std::size_t i=0;igetReference(static_cast(i)); + auto& band=next.bands[i]; + int slope=0; + double freq=0,gain=0,q=0; + if(!b.isObject()|| + !detail::flag(detail::get(b,"enabled"),band.enabled)|| + !detail::real(detail::get(b,"frequencyHz"),freq,20.,20000.)|| + !detail::real(detail::get(b,"gainDb"),gain,-18.,18.)|| + !detail::real(detail::get(b,"q"),q,.2,12.)|| + !detail::integer(detail::get(b,"slope"),slope,12,24)|| + (slope!=12&&slope!=24)|| + (!next.installed&&band.enabled))return false; + band.frequencyHz=static_cast(freq); + band.gainDb=static_cast(gain); + band.q=static_cast(q); + band.slope=static_cast(slope); + } + result=next; + return true; + } static juce::Array encodeFx(const std::vector& fx) { juce::Array encoded; for(const auto& f:fx) { diff --git a/tests/builtin_channel_eq_bank_test.cpp b/tests/builtin_channel_eq_bank_test.cpp index 501e3f3ee..2454f655b 100644 --- a/tests/builtin_channel_eq_bank_test.cpp +++ b/tests/builtin_channel_eq_bank_test.cpp @@ -81,5 +81,42 @@ int main() { bank.render(13,l.data(),r.data(),32); denyHeap.store(false); CHECK(bank.pollAck(13,a)&&a.requestId==1); - std::puts("PASS: 14-lane native EQ; SPSC control->audio/ACK, no realtime heap"); + // Native Show V5 recall pre-seeds a NEW unpublished EQ graph: ensure + // saved bypass preserves bands and the audio owner processes real PCM + // when that restored insert is enabled. No live graph is mutated. + ChannelEqBank restored; + CHECK(restored.prepare(48000)); + Band stored{};stored.enabled=true;stored.frequencyHz=1000.f; + stored.gainDb=9.f;stored.q=1.f; + CHECK(restored.setBandOffline(3,2,stored)); + CHECK(restored.setGateOffline(3,true,true)); // saved BYPASS + std::array reference{},out{},silent{}; + double dryEnergy=0,wetEnergy=0; + for(int block=0;block<64;++block) { + for(int i=0;i<128;++i) + reference[static_cast(i)]= + static_cast(.1*std::sin(6.283185307179586* + 1000.0*(block*128+i)/48000.0)); + out=reference; + restored.render(3,out.data(),silent.data(),128); + CHECK(out==reference); // restored bypass must be bitwise dry + } + CHECK(restored.setGateOffline(3,true,false)); // offline only, new candidate + for(int block=0;block<64;++block) { + for(int i=0;i<128;++i) + reference[static_cast(i)]= + static_cast(.1*std::sin(6.283185307179586* + 1000.0*(block*128+i)/48000.0)); + out=reference; + restored.render(3,out.data(),silent.data(),128); + if(block>=48)for(int i=0;i<128;++i) { + dryEnergy+=reference[static_cast(i)]* + reference[static_cast(i)]; + wetEnergy+=out[static_cast(i)]* + out[static_cast(i)]; + } + } + CHECK(dryEnergy>0.001&&wetEnergy>dryEnergy*4); + CHECK(!restored.setGateOffline(14,true,false)); + std::puts("PASS: 14-lane EQ, Show V5 offline restore/bypass PCM, SPSC ACK, no RT heap"); } diff --git a/tests/native_live_show_capture_test.cpp b/tests/native_live_show_capture_test.cpp index 7e2a250f4..8bcf86036 100644 --- a/tests/native_live_show_capture_test.cpp +++ b/tests/native_live_show_capture_test.cpp @@ -273,14 +273,14 @@ int main() { typedCaptured.strips[1].channelFormat==1); assert(typedCaptured.strips[2].busReturn && typedCaptured.strips[2].channelFormat==1); - const auto savedV4=Codec::encode(typedCaptured); - auto rawV4=juce::JSON::parse(savedV4); - assert(static_cast(rawV4.getProperty("schemaVersion",{}))==4); - SnapshotV2 restoredV4; - assert(Codec::decode(savedV4,restoredV4)); - assert(Codec::encode(restoredV4)==savedV4); + const auto savedV5=Codec::encode(typedCaptured); + auto rawV5=juce::JSON::parse(savedV5); + assert(static_cast(rawV5.getProperty("schemaVersion",{}))==5); + SnapshotV2 restoredV5; + assert(Codec::decode(savedV5,restoredV5)); + assert(Codec::encode(restoredV5)==savedV5); juce::var appliedV2; - const auto prepareTyped=NativeDryShowRecall::prepare(restoredV4, + const auto prepareTyped=NativeDryShowRecall::prepare(restoredV5, typedStatus,appliedV2); if(prepareTyped.isNotEmpty())std::cerr<<"MS1 typed recall failure: "<(13); + assert(!Codec::decode(Codec::encode(broken),loaded)); + broken=snap;broken.aux[0].eq.installed=false; + assert(!Codec::decode(Codec::encode(broken),loaded)); + broken=snap;broken.strips[0].eq.installed=false; + assert(!Codec::decode(Codec::encode(broken),loaded)); broken=snap;broken.strips[0].pan=1.01; assert(!Codec::decode(Codec::encode(broken),loaded)); broken=snap;broken.strips[0].sends[0].destination=0; @@ -114,10 +140,29 @@ int main() { assert(!Codec::decode(juce::JSON::toString(invalidFormat),loaded)); assert(loaded.strips[0].channelFormat==1); + // V4 had the typed processing width and AUX, but NO native EQ record. + auto legacyV4=juce::JSON::parse(encoded); + auto* v4Rows=legacyV4.getProperty("strips",{}).getArray(); + auto* v4Aux=legacyV4.getProperty("auxReturns",{}).getArray(); + for(auto& row:*v4Rows)row.getDynamicObject()->removeProperty("builtinEq"); + for(auto& row:*v4Aux)row.getDynamicObject()->removeProperty("builtinEq"); + legacyV4.getDynamicObject()->setProperty("schemaVersion",4); + assert(Codec::decode(juce::JSON::toString(legacyV4),loaded)); + assert(!loaded.strips[0].eq.installed&&!loaded.aux[0].eq.installed); + // A false v4 marker must NOT silently discard enabled V5 EQ. + auto forgedV4=juce::JSON::parse(encoded); + forgedV4.getDynamicObject()->setProperty("schemaVersion",4); + assert(!Codec::decode(juce::JSON::toString(forgedV4),loaded)); + // Older V3 AUX-aware snapshots did not have processing format. auto legacyV3=juce::JSON::parse(encoded); auto* oldRows=legacyV3.getProperty("strips",{}).getArray(); - for(auto& row:*oldRows)row.getDynamicObject()->removeProperty("channelFormat"); + for(auto& row:*oldRows) { + row.getDynamicObject()->removeProperty("channelFormat"); + row.getDynamicObject()->removeProperty("builtinEq"); + } + auto* oldAuxV3=legacyV3.getProperty("auxReturns",{}).getArray(); + for(auto& row:*oldAuxV3)row.getDynamicObject()->removeProperty("builtinEq"); legacyV3.getDynamicObject()->setProperty("schemaVersion",3); assert(Codec::decode(juce::JSON::toString(legacyV3),loaded)); assert(loaded.strips[0].channelFormat==2); // native v1 physical stereo @@ -131,7 +176,10 @@ int main() { // no implicit BUS mono processing or hidden loss of a real V4 field. auto legacy=juce::JSON::parse(encoded); auto* oldRowsV2=legacy.getProperty("strips",{}).getArray(); - for(auto& row:*oldRowsV2)row.getDynamicObject()->removeProperty("channelFormat"); + for(auto& row:*oldRowsV2){ + row.getDynamicObject()->removeProperty("channelFormat"); + row.getDynamicObject()->removeProperty("builtinEq"); + } legacy.getDynamicObject()->removeProperty("auxReturns"); legacy.getDynamicObject()->removeProperty("auxSends"); legacy.getDynamicObject()->setProperty("schemaVersion",2); @@ -149,6 +197,6 @@ int main() { assert(!loaded.aux[0].enabled && loaded.auxSends.empty()); assert(loaded.name=="Soundcheck 01"); - std::cout << "PASS: bounded ShowV2/SnapshotV2 JSON round-trips, 10 INPUT + 4 AUX, PRE/POST, FX hashes, legacy V2 decode, rollback\n"; + std::cout << "PASS: Show snapshot V5 native EQ (10 CH + 4 AUX), legacy V2-V4 decode, VST3 hashes and rollback\n"; return 0; } From 7748f0e6fadd243a8ed66fabe87750c3ac8c63c7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 15:00:37 +0700 Subject: [PATCH 25/48] test(builtin-eq): verify persisted Show V5 preserves 8-band EQ, bypass and VST3 binary state --- tests/native_show_store_test.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/native_show_store_test.cpp b/tests/native_show_store_test.cpp index a591ad592..c0de04a5f 100644 --- a/tests/native_show_store_test.cpp +++ b/tests/native_show_store_test.cpp @@ -32,6 +32,11 @@ int main() { snap.createdMs=show.createdMs;snap.modifiedMs=show.modifiedMs; snap.strips[0].source=2; snap.strips[0].inputA=2;snap.strips[0].inputB=5; + snap.strips[0].eq.installed=true; + snap.strips[0].eq.bands[2].enabled=true; + snap.strips[0].eq.bands[2].frequencyHz=1000.f; + snap.strips[0].eq.bands[2].gainDb=6.f; + snap.strips[0].eq.bands[2].q=.9f; BinaryState blob; const char bytes[]={'a','r','m','i','x',0,1,2,'\0'}; blob.bytes.append(bytes,sizeof(bytes)); @@ -43,6 +48,10 @@ int main() { auxBlob.bytes.append(auxBytes,sizeof(auxBytes)); auxBlob.sha256=juce::SHA256(auxBlob.bytes).toHexString(); snap.aux[0].enabled=true;snap.aux[0].gain=0.6; + snap.aux[0].eq.installed=true;snap.aux[0].eq.bypassed=true; + snap.aux[0].eq.bands[0].enabled=true; + snap.aux[0].eq.bands[0].frequencyHz=120.f; + snap.aux[0].eq.bands[0].slope=armix::builtin_fx::Slope::db24; snap.aux[0].fx.push_back({"AuxReverb|202",202,auxBlob.sha256,false}); snap.auxSends.push_back({0,0,true,0.35,0.0}); std::vector snapshots={snap}; @@ -58,6 +67,13 @@ int main() { assert(loaded.channelSafes[3]); assert(retrieved.size()==1 && retrieved[0].strips[0].inputB==5); assert(retrieved[0].strips[0].fx[0].stateSha256==blob.sha256); + assert(retrieved[0].strips[0].eq.installed&& + retrieved[0].strips[0].eq.bands[2].enabled&& + retrieved[0].strips[0].eq.bands[2].gainDb==6.f); + assert(retrieved[0].aux[0].eq.installed&&retrieved[0].aux[0].eq.bypassed&& + retrieved[0].aux[0].eq.bands[0].frequencyHz==120.f&& + retrieved[0].aux[0].eq.bands[0].slope== + armix::builtin_fx::Slope::db24); // G5E2: the same immutable generation must deliver the exact vendor // binary bytes to the CONTROL thread before any candidate graph exists. ShowV2 fxShow;std::vector fxSnaps; From ef464fb83de67e2a3b9f7b6b814da70cd20e6ea4 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 15:03:55 +0700 Subject: [PATCH 26/48] test(builtin-eq): reject missing or truncated native Show V5 CH/AUX EQ data before publication --- tests/native_show_schema_test.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/native_show_schema_test.cpp b/tests/native_show_schema_test.cpp index e0fa31c19..678d4bbfb 100644 --- a/tests/native_show_schema_test.cpp +++ b/tests/native_show_schema_test.cpp @@ -80,6 +80,25 @@ int main() { assert(loaded.strips[0].channelFormat==1 && loaded.strips[1].channelFormat==2); assert(loaded.strips[2].busReturn && loaded.strips[2].channelFormat==1); assert(loaded.strips[0].fx[0].stateSha256==juce::String::repeatedString("a",64)); + // V5 EQ is mandatory and fixed-width: never accept a partial 7-band + // preset that could silently change the realtime DSP routing. + auto missingEq=juce::JSON::parse(encoded); + auto* eqRows=missingEq.getProperty("strips",{}).getArray(); + eqRows->getReference(0).getDynamicObject()->removeProperty("builtinEq"); + SnapshotV2 invalidEq{}; + assert(!Codec::decode(juce::JSON::toString(missingEq),invalidEq)); + auto shortEq=juce::JSON::parse(encoded); + auto* eqStrips=shortEq.getProperty("strips",{}).getArray(); + auto* eqBands=eqStrips->getReference(0).getProperty( + "builtinEq",{}).getProperty("bands",{}).getArray(); + assert(eqBands&&eqBands->size()==8); + eqBands->removeLast(); + assert(!Codec::decode(juce::JSON::toString(shortEq),invalidEq)); + auto missingAuxEq=juce::JSON::parse(encoded); + auto* eqAux=missingAuxEq.getProperty("auxReturns",{}).getArray(); + eqAux->getReference(0).getDynamicObject()->removeProperty("builtinEq"); + assert(!Codec::decode(juce::JSON::toString(missingAuxEq),invalidEq)); + assert(loaded.strips[0].eq.installed&&!loaded.strips[0].eq.bypassed); assert(loaded.strips[0].eq.bands[2].enabled&& loaded.strips[0].eq.bands[2].gainDb==4.5f); From 0aa1802835a4d377dc81362c86c74c2eb109826d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 15:13:45 +0700 Subject: [PATCH 27/48] test(show-v5): align approved GUI and routed Show integration contracts with acknowledged native EQ recall --- tests/builtin_eq_gui_contract_test.mjs | 11 +++++++++-- tests/live_routing_ui_contract_test.mjs | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index 8670faff3..5de0b243f 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -18,8 +18,15 @@ assert.ok(js.includes('slotMarkup(track')&&js.includes('builtinEqSetGate')); assert.ok(js.includes('lastGraphEqSweep')&&js.includes('otherTrack'), 'Reproject actual native ChannelId EQ state after structural graph revision'); const main=fs.readFileSync('src/Main.cpp','utf8'); -assert.ok(main.includes('uncapturedBuiltInEq()'), - 'Do not persist/show-recall EQ state via legacy schema v4'); +assert.ok(main.includes('captureAcceptedEq(')&& + main.includes('acceptedEqFromShow(')&& + main.includes('unsettledBuiltInEq()')&& + main.includes('EqRestores eqRestores'), + 'Show V5 must save accepted EQ, build fresh DSP on recall and fence pending ACK'); +const showSchema=fs.readFileSync('src/NativeShowSchema.h','utf8'); +assert.ok(showSchema.includes('schemaVersion",5')&& + showSchema.includes('encodeEq(')&&showSchema.includes('decodeEq('), + 'Native Show V5 must preserve all 8 bands; old V2-V4 decode to default off'); assert.ok(component.includes('window.ArSonMixBuiltinEq?.open(t)')); assert.match(native,/__ARMIX_BUILTIN_EQ_CHANNEL__/); assert.match(js,/arMixBuiltinEqAck/); diff --git a/tests/live_routing_ui_contract_test.mjs b/tests/live_routing_ui_contract_test.mjs index 454b8e8e9..a6224516d 100644 --- a/tests/live_routing_ui_contract_test.mjs +++ b/tests/live_routing_ui_contract_test.mjs @@ -295,7 +295,10 @@ test("G5E native Shows browse and hash-verified FX recall are worker-backed and assert.match(main,/nativeShowWorker_\.read\(/); assert.match(main,/result\.requestEpoch/); assert.match(main,/result\.requestRevision/); - assert.match(main,/applyDryRoutingLab\(\s*command,selections,&restores\)/); + assert.match(main,/applyDryRoutingLab\(\s*command,selections,&restores,&eqRestores\)/); + assert.match(main,/acceptedEqFromShow\(result.loaded,epochNow\)/); + assert.match(lab,/if\(eqRestores\)/); + assert.match(lab,/setBuiltInEqOffline\(lane,slot,band\)/); assert.match(main,/result\.loadedStates/); assert.match(main,/entry->uid!=ref\.uid/); assert.match(main,/safe->closePluginEditor\(\)/); From 0fa8482522fc52fac6eb1f75008ca587d6837c63 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 15:28:43 +0700 Subject: [PATCH 28/48] fix(show-v5): correct remaining restoredV4 fixture reference after V5 migration --- tests/native_live_show_capture_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/native_live_show_capture_test.cpp b/tests/native_live_show_capture_test.cpp index 8bcf86036..51adffcb2 100644 --- a/tests/native_live_show_capture_test.cpp +++ b/tests/native_live_show_capture_test.cpp @@ -301,7 +301,7 @@ int main() { auto disconnectedLab=disconnected.getProperty("dryRoutingLab",{}); juce::Array noPorts; set(disconnectedLab,"ports",juce::var(noPorts)); - assert(NativeDryShowRecall::prepare(restoredV4,disconnected, + assert(NativeDryShowRecall::prepare(restoredV5,disconnected, appliedV2).isNotEmpty()); assert(juce::JSON::toString(appliedV2,false)==originalV2); From 49039c308f6a497d0207e0d178a9f29728b202cb Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 16:03:36 +0700 Subject: [PATCH 29/48] fix(eq): publish restored Show V5 DSP bank and await real audio ACK; cover PCM regression --- engine/core/DynamicNativeSessionPublisher.h | 16 +++++++----- src/Main.cpp | 14 ++++++---- tests/builtin_channel_eq_bank_test.cpp | 8 ++++++ tests/builtin_eq_gui_contract_test.mjs | 8 ++++++ tests/live_channel_fx_graph_test.cpp | 29 +++++++++++++++++++++ 5 files changed, 63 insertions(+), 12 deletions(-) diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index e14bad997..0f3c03102 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -110,16 +110,18 @@ class DynamicNativeSessionPublisher final { report.fault=Fault::invalidGraph;return report; } prepared->physicalInputs=request.physicalInputs; - // Preserve the single RT-owned EQ state across native graph changes. - // The old/new graph leases hold the same prepared bank; the existing - // render gate ensures only one producer can mutate filter histories. + // An explicitly supplied EQ bank is authoritative (notably Show V5 + // recall). Structural edits that do not supply one retain the single + // prior RT-owned bank and its histories. Sharing/copying is CONTROL + // only; the callback always sees exactly one bank per graph snapshot. + // Never silently replace a fresh, restored Show with prior PCM state. const auto* prior=publisher_.controlPrepared(proposedDeviceEpoch,expectedRevision); - if(prior && prior->builtInEq) { - prepared->builtInEq=prior->builtInEq; // CONTROL refcount only - prepared->builtInEqIds=prior->builtInEqIds; // exact stable IDs - } else { + if(fx.builtInEq) { prepared->builtInEq=fx.builtInEq; prepared->builtInEqIds=fx.builtInEqIds; + } else if(prior && prior->builtInEq) { + prepared->builtInEq=prior->builtInEq; + prepared->builtInEqIds=prior->builtInEqIds; } prepared->fx=std::move(fx); // one accepted control-plane publication prepared->monitor=std::any_of(roster.channels().begin(), diff --git a/src/Main.cpp b/src/Main.cpp index dee9227c9..f12aeff4f 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -284,7 +284,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr juce::StringArray acceptedControlRequests_; // bounded request replay fence struct EqPending final { armix::mixer::ChannelId channel{}; - std::uint64_t request=0,epoch=0,revision=0,started=0; + std::uint64_t request=0,epoch=0,revision=0; int slot=-1;bool active=false; }; std::array eqPending_{}; @@ -425,7 +425,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr const bool install=static_cast(a.getProperty("installed",{})); const bool bypass=static_cast(a.getProperty("bypassed",{})); queued=engine_.queueBuiltInEqGate(lane,install,bypass,req,ep,rev); - if(queued)pending={ch,req,ep,rev,monotonicMilliseconds(),-1,true}; + if(queued)pending={ch,req,ep,rev,-1,true}; } else if(!pending.active&&!gateAction&& eqInstalled_[static_cast(lane)]&& slot>=0&&slot<8&&b.isObject()&&enabled.isBool()&& @@ -441,7 +441,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr armix::builtin_fx::Slope::db12; queued=engine_.queueBuiltInEqEdit(lane,static_cast(slot), band,req,ep,rev); - if(queued) pending={ch,req,ep,rev,monotonicMilliseconds(),slot,true}; + if(queued) pending={ch,req,ep,rev,slot,true}; } } auto reply=std::make_unique(); @@ -458,14 +458,18 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr eqSnapshotDue_[static_cast(lane)]=false; emitEqSnapshot(eqPending_[static_cast(lane)].channel); } - const auto now=monotonicMilliseconds(); for(int lane=0;lane<14;++lane) { auto& pending=eqPending_[static_cast(lane)]; if(!pending.active)continue; LiveAudioEngine::BuiltInEqAck ack{}; const bool got=engine_.pollBuiltInEqAck(lane,pending.epoch, pending.revision,ack); - if(!got&&now-pending.started<4000u)continue; + // Physical output may be muted and no EQ render/ACK occurs. + // A wall-clock timeout is NOT cancellation: the SPSC command + // remains queued and could apply when output resumes. Retain + // ownership until an actual AUDIO ACK, or explicit graph/epoch + // teardown, instead of announcing a false REJECTED state. + if(!got)continue; const bool ok=got&&ack.applied&&ack.requestId==pending.request && ack.lane==lane&& ((pending.slot<0&&ack.gate)|| diff --git a/tests/builtin_channel_eq_bank_test.cpp b/tests/builtin_channel_eq_bank_test.cpp index 2454f655b..9c528d0c0 100644 --- a/tests/builtin_channel_eq_bank_test.cpp +++ b/tests/builtin_channel_eq_bank_test.cpp @@ -65,6 +65,14 @@ int main() { for(int i=0;i<8;++i)bank.render(0,l.data(),r.data(),64); CHECK(bank.pollAck(0,a)&&a.applied&&!a.installed); CHECK(!bank.queueGateEdit(14,true,false,203,22,9)); + // Muted/no-output periods do not process an EQ command. It must remain + // QUEUED until a real audio owner consumes it, not expire on UI wall time. + CHECK(bank.queueGateEdit(12,true,false,204,22,9)); + CHECK(!bank.pollAck(12,a)); + CHECK(!bank.pollAck(12,a)); // no callback block, still not applied + bank.render(12,l.data(),r.data(),128,22,9); + CHECK(bank.pollAck(12,a)&&a.applied&&a.requestId==204&&a.gate); + CHECK(!bank.pollAck(12,a)); // Demonstrate 14 truly independent EQ strips through one common call shape. for(std::size_t lane=1;lane<14;++lane){ auto copy=original; diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index 5de0b243f..c8f14afa4 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -18,6 +18,14 @@ assert.ok(js.includes('slotMarkup(track')&&js.includes('builtinEqSetGate')); assert.ok(js.includes('lastGraphEqSweep')&&js.includes('otherTrack'), 'Reproject actual native ChannelId EQ state after structural graph revision'); const main=fs.readFileSync('src/Main.cpp','utf8'); +const publisher=fs.readFileSync('engine/core/DynamicNativeSessionPublisher.h','utf8'); +assert.ok(publisher.includes('if(fx.builtInEq) {') && + publisher.indexOf('if(fx.builtInEq) {') < + publisher.indexOf('else if(prior && prior->builtInEq)'), + 'Show V5 supplied EQ must win over a prior native ChannelId graph'); +assert.ok(main.includes('if(!got)continue;') && + !main.includes('now-pending.started<4000u'), + 'Never report false EQ rejection while a muted callback has not ACKed'); assert.ok(main.includes('captureAcceptedEq(')&& main.includes('acceptedEqFromShow(')&& main.includes('unsettledBuiltInEq()')&& diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index d1dac9526..ac4d9b389 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -1984,6 +1984,35 @@ static void verifyBuiltInEqNativeChannelIdAndRevisionFence() { assert(native.render(9,pins,1,left.data(),right.data(),128,false,noFx)); armix::builtin_fx::ChannelEqBank::Ack ack{}; assert(native.pollBuiltInEqAck(9,2,ch,ack)&&ack.applied&&ack.requestId==103); + + // Show V5 recall replaces the DSP bank even when the same ChannelId and + // epoch already have an admitted native graph. The old wet bank must NOT + // overwrite fresh offline-restored bands during the revision-3 commit. + auto restored=std::make_shared(); + assert(restored->prepare(48000)); + auto cut=b;cut.gainDb=-9.f; + assert(restored->setBandOffline(0,2,cut)); + assert(restored->setGateOffline(0,true,false)); + DynamicNativeSessionPublisher::FxPlan showPlan; + showPlan.builtInEq=restored;showPlan.builtInEqIds[0]=ch; + assert(native.commit(roster,req,2,9,9,true,showPlan).ok()); + assert(!native.queueBuiltInEqEdit(9,2,ch,2,b,104)); // superseded graph + double recalledPower=0; + for(int block=0;block<64;++block) { + for(int i=0;i<128;++i) + pcm[static_cast(i)]=static_cast( + .1*std::sin(6.283185307179586*1000*(block*128+i)/48000.0)); + const auto before=heapCalls.load(std::memory_order_relaxed); + assert(native.render(9,pins,1,left.data(),right.data(),128,false,noFx)); + assert(heapCalls.load(std::memory_order_relaxed)==before); + if(block>=48)for(float y:left)recalledPower+=y*y; + } + // 9 dB boost before recall must become a 9 dB CUT after recall, + // proving sound and accepted Show state can no longer diverge. + assert(recalledPower>0.001&&recalledPower Date: Fri, 6 Nov 2026 16:12:35 +0700 Subject: [PATCH 30/48] feat(eq): integrate FX rack header master bypass into real VST3 and Channel EQ DSP --- .github/workflows/ui-smoke.yml | 2 + engine/builtin_fx/ChannelEqBank.h | 28 +++++- engine/core/DynamicChannelFxLeaseBank.h | 33 ++++++- engine/core/DynamicNativeSessionPublisher.h | 14 +++ engine/core/LiveChannelFxGraph.h | 34 ++++++- .../core/UnifiedLegacyProductionAdmission.h | 6 ++ scripts/approved_fx_rack_power.py | 32 +++++++ scripts/build_pages.py | 2 + src/ApprovedNativeV8Projection.h | 5 ++ src/ConsoleLiveBridgeV6.h | 2 + src/LiveAudioEngine.h | 26 +++++- src/LiveDryRoutingLab.h | 33 +++++++ src/Main.cpp | 72 ++++++++++++++- tests/approved_fx_rack_master_power_smoke.py | 89 +++++++++++++++++++ tests/builtin_channel_eq_bank_test.cpp | 31 +++++++ tests/builtin_eq_gui_contract_test.mjs | 4 + tests/live_channel_fx_graph_test.cpp | 43 +++++++++ tests/live_graph_contract_test.mjs | 5 +- ...ingle_preview_publication_contract_test.py | 2 + web/approved-native-bridge.js | 63 ++++++++++++- 20 files changed, 512 insertions(+), 14 deletions(-) create mode 100644 scripts/approved_fx_rack_power.py create mode 100644 tests/approved_fx_rack_master_power_smoke.py diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 8b3c35960..7a763f983 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -155,6 +155,8 @@ jobs: run: python tests/approved_stage_c_css_visual_parity_smoke.py - name: Check real mobile /preview/ touch toolbar, popup and stray chevrons run: python tests/approved_preview_mobile_navigation_smoke.py + - name: FX rack master bypass preserves each insert state (real Chromium) + run: python tests/approved_fx_rack_master_power_smoke.py - name: Stage D one runtime CSSOM and actual stylesheet network count run: python tests/approved_css_stage_d_single_bundle_smoke.py - name: Stage C rendered CSS parity (original vs compiled, three viewports + hover) diff --git a/engine/builtin_fx/ChannelEqBank.h b/engine/builtin_fx/ChannelEqBank.h index 22296f406..2745ded2a 100644 --- a/engine/builtin_fx/ChannelEqBank.h +++ b/engine/builtin_fx/ChannelEqBank.h @@ -64,9 +64,11 @@ class ChannelEqBank final { if (ready_) return false; if (!std::isfinite(sampleRate) || sampleRate < 8000.0 || sampleRate > 384000.0) return false; - for(auto& eq:eqs_) { + for(std::size_t lane=0;laneAUDIO atomic rack override. User's own EQ bypass is retained. + bool setRackBypass(std::size_t lane,bool bypass) noexcept { + if(lane>=laneCount)return false; + rackBypassed_[lane].store(bypass,std::memory_order_release); + return true; + } + [[nodiscard]] bool rackBypassed(std::size_t lane) const noexcept { + return lane=laneCount||(!installed&&bypassed))return false; - eqs_[lane].setExternalBypass(!installed||bypassed); + insertBypassed_[lane]=!installed||bypassed; + eqs_[lane].setExternalBypass(insertBypassed_[lane]||rackBypassed(lane)); return true; } // AUDIO OWNER ONLY. At most one filter change per strip per block, and @@ -123,6 +136,8 @@ class ChannelEqBank final { std::uint64_t activeRevision=0) noexcept { if (!ready_ || lane >= laneCount || !left || !right || frames == 0) return; auto& eq = eqs_[lane]; + const bool rackOff=rackBypassed_[lane].load(std::memory_order_acquire); + eq.setExternalBypass(insertBypassed_[lane]||rackOff); if (!eq.transitioning() && acknowledgements_[lane].canPush()) { Command command{}; if (pending_[lane].pop(command)) { @@ -135,7 +150,10 @@ class ChannelEqBank final { if(sessionMatches) { if(command.gate) { applied=command.installed||eq.resetToFlat(); - if(applied)eq.setExternalBypass(!command.installed||command.bypassed); + if(applied) { + insertBypassed_[lane]=!command.installed||command.bypassed; + eq.setExternalBypass(insertBypassed_[lane]||rackOff); + } } else applied=eq.applyPreparedBand(command.edit); } Ack ack{command.requestId,command.deviceEpoch,command.graphRevision, @@ -166,6 +184,8 @@ class ChannelEqBank final { ChannelEq::PreparedBandEdit edit{}; }; std::array eqs_{}; + std::array insertBypassed_{}; // AUDIO or unpublished CONTROL + std::array,laneCount> rackBypassed_{}; // CONTROL->AUDIO std::array,laneCount> pending_{}; std::array,laneCount> acknowledgements_{}; double sampleRate_=0.0; diff --git a/engine/core/DynamicChannelFxLeaseBank.h b/engine/core/DynamicChannelFxLeaseBank.h index 46c29f4f8..697d1fdf1 100644 --- a/engine/core/DynamicChannelFxLeaseBank.h +++ b/engine/core/DynamicChannelFxLeaseBank.h @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include #include @@ -33,6 +35,9 @@ class DynamicChannelFxLeaseBank final { ChannelId id{}; ProcessingFormat format=ProcessingFormat::stereo; std::vector inserts; // CONTROL only; no creation on callback + // Reused over revision changes. This flag overrides the effective + // output without changing the individual FxInstance bypass flags. + std::shared_ptr> rackBypassed; }; // Occupied CH1 vendor/Orbit owner remains alive with accepted PCM. @@ -68,6 +73,9 @@ class DynamicChannelFxLeaseBank final { if(lane<0||lane>=FxGraph::fxSlots||!nativeId.value)return false; Assignment staged; staged.id=nativeId;staged.format=format; + // Preserve master OFF across M4->ChannelId, even with EQ-only rack. + staged.rackBypassed=std::make_shared>( + prior.rackBypassed(lane)); for(int slot=0;slot>(false); // CONTROL allocation row.count=static_cast(b.inserts.size()); for(std::size_t i=0;ibypassRequested.store(bypass,std::memory_order_release); return true; } + bool setRackBypass(std::uint64_t expectedEpoch, + std::uint64_t expectedRevision,ChannelId id, + bool bypass) const noexcept { + if(expectedEpoch!=epoch_||expectedRevision!=revision_||!id.value) + return false; + const auto* row=find(id); + if(!row||!row->rackBypassed)return false; + row->rackBypassed->store(bypass,std::memory_order_release); + return true; + } + bool rackBypassed(ChannelId id) const noexcept { + const auto* row=find(id); + return row&&row->rackBypassed && + row->rackBypassed->load(std::memory_order_acquire); + } // 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, @@ -199,7 +224,7 @@ class DynamicChannelFxLeaseBank final { retained.reserve(prior.rows_.size()); for(const auto& row:prior.rows_) { Assignment item; - item.id=row.id;item.format=row.format; + item.id=row.id;item.format=row.format;item.rackBypassed=row.rackBypassed; item.inserts.reserve(row.count); for(std::size_t slot=0;slotrackBypassed && + row->rackBypassed->load(std::memory_order_acquire); for(std::size_t i=0;icount;++i) - row->raw[i]->render(left,right,frames); + row->raw[i]->render(left,right,frames,rackOff); } private: @@ -262,6 +290,7 @@ class DynamicChannelFxLeaseBank final { ChannelId id{}; ProcessingFormat format=ProcessingFormat::stereo; std::uint8_t count=0; + std::shared_ptr> rackBypassed; // persists across revisions std::array owners{}; std::array raw{}; }; diff --git a/engine/core/DynamicNativeSessionPublisher.h b/engine/core/DynamicNativeSessionPublisher.h index 0f3c03102..178d356d9 100644 --- a/engine/core/DynamicNativeSessionPublisher.h +++ b/engine/core/DynamicNativeSessionPublisher.h @@ -261,6 +261,20 @@ class DynamicNativeSessionPublisher final { return false; }); } + // Header bypass of one accepted ChannelId EQ owner, without touching + // the remembered individual EQ gate or its eight filter bands. + bool setBuiltInEqRackBypass(std::uint64_t epoch,std::uint64_t revision, + ChannelId id,bool bypass) noexcept { + if(!id.value)return false; + return publisher_.updateActiveControl(epoch,revision, + [&](Prepared& p) noexcept { + if(!p.builtInEq)return false; + for(std::size_t lane=0;lanesetRackBypass(lane,bypass); + return false; + }); + } bool pollBuiltInEqAck(std::uint64_t epoch,std::uint64_t revision,ChannelId id, armix::builtin_fx::ChannelEqBank::Ack& ack) noexcept { if(!id.value)return false; diff --git a/engine/core/LiveChannelFxGraph.h b/engine/core/LiveChannelFxGraph.h index 8573d81c8..393e9f852 100644 --- a/engine/core/LiveChannelFxGraph.h +++ b/engine/core/LiveChannelFxGraph.h @@ -80,7 +80,7 @@ class LiveChannelFxGraph final { processing.clear(std::memory_order_release); return ok; } - void render(float* left,float* right,int samples) noexcept { + void render(float* left,float* right,int samples,bool rackBypassed=false) noexcept { if(processing.test_and_set(std::memory_order_acquire)) { contention.fetch_add(1,std::memory_order_relaxed); juce::FloatVectorOperations::clear(left,samples); @@ -88,7 +88,8 @@ class LiveChannelFxGraph final { return; } // G5C: atomic request from control; fade and scratch RT-owned. - bypassFade.request(bypassRequested.load(std::memory_order_relaxed)); + // Master rack bypass affects the WET/DRY envelope, never the remembered insert preference. + bypassFade.request(rackBypassed || bypassRequested.load(std::memory_order_relaxed)); if(bypassFade.fullyBypassed()) { processing.clear(std::memory_order_release); return; @@ -202,8 +203,12 @@ class LiveChannelFxGraph final { // across same-rate routing revisions, not an independent EQ sound. void inheritBuiltInEqFrom(const LiveChannelFxGraph& prior) noexcept { if(builtinEq_ && prior.builtinEq_ && - builtinEq_->sampleRate()==prior.builtinEq_->sampleRate()) + builtinEq_->sampleRate()==prior.builtinEq_->sampleRate()) { builtinEq_=prior.builtinEq_; + for(int lane=0;lanebypassRequested.store(bypass,std::memory_order_release); return true; } + // One atomic rack override per channel. Individual slot bypass flags stay + // unchanged; ON restores the previous enabled/disabled combination. + bool setRackBypass(int strip,bool bypass) noexcept { + if(strip<0||strip>=fxSlots||!builtinEq_ || + !builtinEq_->setRackBypass(static_cast(strip),bypass)) + return false; + // Same rack override for native EQ + VST3, preserving each slot's + // own bypass preference; both envelopes smooth on AUDIO. + rackBypassed_[strip].store(bypass,std::memory_order_release); + return true; + } + bool rackBypassed(int strip) const noexcept { + return strip>=0&&stripcatalogId!=catalogId)return false; for(int i=0;irender(static_cast(strip),l,r, static_cast(samples), builtinEqEpoch_,builtinEqRevision_); + const bool rackOff=rackBypassed_[strip].load(std::memory_order_acquire); const int count=counts_[strip]; // immutable, prepared OFF RT if(count>0) { for(int slot=0;slotrender(l,r,samples); // no shared_ptr copies or RT heap use + instance->render(l,r,samples,rackOff); // one RT owner, no heap use } } else if(strip==0 && externalFx) externalFx(externalContext,strip,l,r,samples); @@ -363,6 +388,7 @@ class LiveChannelFxGraph final { RealtimeStripControls controls_ {}; FxBank processors_ {}; std::array counts_ {}; + std::array,fxSlots> rackBypassed_{}; // CONTROL write; one RT read per lane int activeInserts_=0; int pluginQuantum_=512; int mainOutputLeft_=0,mainOutputRight_=1; diff --git a/engine/core/UnifiedLegacyProductionAdmission.h b/engine/core/UnifiedLegacyProductionAdmission.h index a48ed6c2d..f3a98d2cd 100644 --- a/engine/core/UnifiedLegacyProductionAdmission.h +++ b/engine/core/UnifiedLegacyProductionAdmission.h @@ -59,6 +59,12 @@ struct UnifiedLegacyAccepted final { fxOwners->setInsertBypass(epoch,revision,id,slot, instanceId,bypass); } + bool setFxRackBypass(const DynamicNativeSessionPublisher& publisher, + std::uint64_t epoch,std::uint64_t revision, + ChannelId id,bool bypass) const noexcept { + return matches(publisher,epoch,revision) && + fxOwners->setRackBypass(epoch,revision,id,bypass); + } DynamicChannelFxLeaseBank::Lease leaseFxEditor( const DynamicNativeSessionPublisher& publisher, std::uint64_t epoch,std::uint64_t revision,ChannelId id, diff --git a/scripts/approved_fx_rack_power.py b/scripts/approved_fx_rack_power.py new file mode 100644 index 000000000..fd91331ca --- /dev/null +++ b/scripts/approved_fx_rack_power.py @@ -0,0 +1,32 @@ +"""Approved single-GUI FX rack power semantics, injected at the ONE Pages build. + +The historical V28 source HTML is immutable. Apply exactly FOUR audited +semantic substitutions to its JavaScript when assembling both public /preview/ +and native JUCE WebView2. No additional stylesheet, second state store, or +private fork of the mixer. t.fxOn is rack authority, slotBypass[] is the +preserved per-insert preference. Effective = fxOn && !slotBypass[i]. +""" +def apply_authoritative_fx_power(html: str) -> str: + substitutions = [ + ( + "name==='None'?'is-empty':t.slotBypass[i]?'is-bypassed':'is-active'", + "name==='None'?'is-empty':(!t.fxOn||t.slotBypass[i])?'is-bypassed':'is-active'", + ), + ( + 'aria-pressed="\'+Boolean(!t.slotBypass[i])+\'">', + 'aria-pressed="\'+Boolean(t.fxOn&&!t.slotBypass[i])+\'">', + ), + ( + "title=\"'+(t.slotBypass[i]?'Enable':'Bypass')+' only insert", + "title=\"'+(!t.fxOn?'Rack bypassed, saved '+(t.slotBypass[i]?'OFF':'ON'):t.slotBypass[i]?'Enable':'Bypass')+' only insert", + ), + ( + "aria-label=\"'+(t.slotBypass[i]?'Enable':'Bypass')+' only FX insert", + "aria-label=\"'+(!t.fxOn?'Rack bypassed, saved '+(t.slotBypass[i]?'OFF':'ON'):t.slotBypass[i]?'Enable':'Bypass')+' only FX insert", + ), + ] + for before, after in substitutions: + if html.count(before) != 1: + raise ValueError("FX master semantics anchor missing or ambiguous: " + before[:90]) + html=html.replace(before,after,1) + return html diff --git a/scripts/build_pages.py b/scripts/build_pages.py index 03fe40f3b..388a88f4e 100644 --- a/scripts/build_pages.py +++ b/scripts/build_pages.py @@ -3,6 +3,7 @@ import argparse,os,json,shutil,subprocess,sys from compile_approved_css import optimize_assets from compose_builtin_eq import compose_builtin_eq +from approved_fx_rack_power import apply_authoritative_fx_power ROOT=Path(__file__).resolve().parents[1] p=argparse.ArgumentParser() p.add_argument('--out',default='dist-pages') @@ -66,6 +67,7 @@ if canonical_html.count('')!=1 or probe_tag in canonical_html: raise SystemExit('Approved Pages profiler injection must have exactly one body') canonical_html=canonical_html.replace('',probe_tag+'\n',1) +canonical_html=apply_authoritative_fx_power(canonical_html) # Stage C: compile only DEPLOYED copies, never modify locked V28 source # owners or approved PNG artwork. No new CSS/override or second renderer. canonical_html,css_compilation=optimize_assets(canonical_html,buttons_dest/'assets',runtime_bundle=True) diff --git a/src/ApprovedNativeV8Projection.h b/src/ApprovedNativeV8Projection.h index ab95387fd..b5f4b4cc5 100644 --- a/src/ApprovedNativeV8Projection.h +++ b/src/ApprovedNativeV8Projection.h @@ -82,6 +82,11 @@ inline bool projectApprovedNativeV8(juce::var& snapshot,const juce::var& bus) { fx.add(juce::var(insert.release())); } ch->setProperty("inserts",juce::var(fx)); + const auto rackBypassed=row.getProperty("fxRackBypassed",{}); + if(!rackBypassed.isVoid()) { + if(!rackBypassed.isBool())return false; + ch->setProperty("fxRackBypassed",rackBypassed); + } ch->setProperty("sends",juce::var(juce::Array{})); if(role!="INPUT"){ auto dst=std::make_unique(); diff --git a/src/ConsoleLiveBridgeV6.h b/src/ConsoleLiveBridgeV6.h index a30991611..8db86ac42 100644 --- a/src/ConsoleLiveBridgeV6.h +++ b/src/ConsoleLiveBridgeV6.h @@ -150,6 +150,8 @@ 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 rackPower=route.getProperty("fxRackBypassed",juce::var()); + if(rackPower.isArray())object->setProperty("fxRackBypassed",rackPower); // 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. diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index f43ea35cc..752e8ab4b 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -91,6 +91,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback } std::array slots {}; std::array, maxFx> bypassFlags {}; + std::atomic rackBypassed{false}; // does not overwrite per-slot flags // Owned and advanced exclusively by the realtime render callback. // Physical-slot identity survives an atomic logical reorder (PR #102). std::array bypassEnvelope {}; @@ -1230,6 +1231,16 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback !=armix::diagnostics::Route::normal)return false; return dryRoutingLab_.setFxBypass(lane,slot,epoch,revision,instanceId,bypass); } + bool setDryRoutingLabFxRackBypass(int lane,std::uint64_t epoch, + std::uint64_t revision,bool bypass) noexcept { + if(routeReconfiguring_.load(std::memory_order_acquire)|| + diagnosticRoute_.load(std::memory_order_acquire)!= + armix::diagnostics::Route::normal)return false; + if(!dryRoutingLab_.setFxRackBypass(lane,epoch,revision,bypass))return false; + if(lane==0 && graphOwned_) + graphOwned_->rackBypassed.store(bypass,std::memory_order_release); + return true; + } armix::mixer::LiveChannelFxGraph::InstanceLease leaseRoutedFxForEditor( int lane,int slot,std::uint64_t epoch,std::uint64_t revision, const juce::String& instanceId) const noexcept { @@ -1334,6 +1345,18 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback return dryRoutingLab_.bypassNativeInsert(epoch,revision,id,slot, token,bypass); } + bool bypassNativeFxRack(std::uint64_t epoch,std::uint64_t revision, + armix::mixer::ChannelId id,bool bypass) noexcept { + if(routeReconfiguring_.load(std::memory_order_acquire)|| + diagnosticRoute_.load(std::memory_order_acquire)!= + armix::diagnostics::Route::normal)return false; + if(!dryRoutingLab_.bypassNativeRack(epoch,revision,id,bypass))return false; + // The original CH1 VST3 instance can be external-leased into the + // native ChannelId publisher. Its own crossfade gate must agree. + if(graphOwned_ && dryRoutingLab_.nativeChannelIsOriginalCh1(id)) + graphOwned_->rackBypassed.store(bypass,std::memory_order_release); + return true; + } armix::mixer::LiveChannelFxGraph::InstanceLease leaseNativeVst3Editor( std::uint64_t epoch,std::uint64_t revision, armix::mixer::ChannelId id,std::size_t slot, @@ -1969,7 +1992,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback auto& slot=graph.slots[physical]; if(!slot.processor)continue; auto& bypass=graph.bypassEnvelope[physical]; - bypass.request(graph.bypassFlags[physical].load(std::memory_order_acquire)); + bypass.request(graph.rackBypassed.load(std::memory_order_acquire) || + graph.bypassFlags[physical].load(std::memory_order_acquire)); const bool blend=bypass.transitioning(); if(blend) { diff --git a/src/LiveDryRoutingLab.h b/src/LiveDryRoutingLab.h index 6fea9117f..5586249a5 100644 --- a/src/LiveDryRoutingLab.h +++ b/src/LiveDryRoutingLab.h @@ -980,6 +980,16 @@ class LiveDryRoutingLab final { }); } + // Master rack gate is a single RT-visible atomic per lane; never overwrite + // stored individual insert bypass flags. Safe under current epoch/revision. + bool setFxRackBypass(int lane,std::uint64_t expectedEpoch, + std::uint64_t expectedRevision,bool bypass) noexcept { + if(lane<0||lane>=fxSlots||!hasExplicitRoute()|| + expectedEpoch!=epoch()||expectedRevision!=revision())return false; + return publisher_.updateActiveControl(expectedEpoch,expectedRevision, + [&](FxGraph& fx) noexcept {return fx.setRackBypass(lane,bypass);}); + } + // Quiescent message-thread identity lease for the vendor's native GUI. // Shared lifetime is independent of route reorder, but not authority: // an editor request MUST match the current accepted route. @@ -1231,6 +1241,23 @@ class LiveDryRoutingLab final { return nativeAccepted_.setFxBypass(nativePublisher_,epochAtEdit, pcmRevision,target,slot,token,bypass); } + bool nativeChannelIsOriginalCh1(armix::mixer::ChannelId target) const noexcept { + return nativeAccepted_.fxOwners && + nativeAccepted_.fxOwners->externalChannel()==target && + target==nativeAccepted_.graph.ids.inputs[0]; + } + bool bypassNativeRack(std::uint64_t epochAtEdit,std::uint64_t pcmRevision, + armix::mixer::ChannelId target,bool bypass) noexcept { + if(!nativeAccepted_.setFxRackBypass(nativePublisher_,epochAtEdit, + pcmRevision,target,bypass)) + return false; + // 10 CH + 4 AUX share the actual EQ bank; extra native buses + // without EQ retain their native VST-only master override. + if(nativeAccepted_.graph.ids.legacyFxIndex(target)>=0) + return nativePublisher_.setBuiltInEqRackBypass( + epochAtEdit,pcmRevision,target,bypass); + return true; + } armix::mixer::DynamicChannelFxLeaseBank::Lease leaseNativeInsertEditor( std::uint64_t epochAtEdit,std::uint64_t pcmRevision, armix::mixer::ChannelId target,std::size_t slot, @@ -1754,6 +1781,8 @@ class LiveDryRoutingLab final { liveInserts.add(juce::var(item.release())); } row->setProperty("inserts",juce::var(liveInserts)); + row->setProperty("fxRackBypassed", + nativeAccepted_.fxOwners->rackBypassed(ch.id)); if(pcmMeterValid && meterIndexsetProperty("peakL",static_cast( nativeMeterPeaksL_[meterIndex].load(std::memory_order_relaxed))); @@ -2267,6 +2296,10 @@ class LiveDryRoutingLab final { liveFxInstances.add(juce::var(slots)); } out->setProperty("fxInstances",juce::var(liveFxInstances)); + juce::Array rackFlags; + for(int lane=0;lanerackBypassed(lane):false); + out->setProperty("fxRackBypassed",juce::var(rackFlags)); juce::Array controls,fxNames; for(int i=0;i(); + ack->setProperty("requestId",args.getProperty("requestId",{})); + ack->setProperty("ok",false); + ack->setProperty("error",reason); + browser_.emitEventIfBrowserIsVisible( + "arMixNativeFxPowerAck",juce::var(ack.release())); + } return emitNotice(reason,true); } @@ -1845,6 +1856,65 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if(!ok)emitNotice("Live AUX send rejected; refresh accepted routing.",true); return; } + // Accepted ChannelId FX power. A rack master is an additive gate, + // not a rewrite of the eight saved individual bypass preferences. + // Both gestures are fenced to the actual device epoch + PCM revision + // and reply with an ACK; the WebView re-reads the producer snapshot. + if(action=="routingNativeFxRackBypass" || + action=="routingNativeFxInsertBypass") { + const auto request=args.getProperty("requestId",{}).toString(); + const auto rawId=args.getProperty("channelId",{}); + const auto rawEpoch=args.getProperty("deviceEpoch",{}); + const auto rawRevision=args.getProperty("revision",{}); + const auto parse=[](const juce::var& wire,std::uint64_t& out) -> bool { + if(!wire.isString())return false; + const auto text=wire.toString().toStdString(); + if(text.empty()||text.size()>20|| + text[0]=='0'||text.find_first_not_of("0123456789")!=std::string::npos) + return false; + try { + const auto decoded=std::stoull(text); + if(!decoded||std::to_string(decoded)!=text)return false; + out=decoded;return true; + } catch(...) {return false;} + }; + std::uint64_t channel=0,ep=0,rev=0; + const bool valid=request.isNotEmpty()&&request.length()<=128 && + parse(rawId,channel)&&parse(rawEpoch,ep)&& + parse(rawRevision,rev)&&value.isBool() && + !studioBackupBusy_&&!nativeShowBusy_&& + !engine_.independentClockActive(); + bool applied=false; + if(valid && !acceptedControlRequests_.contains(request)) { + acceptedControlRequests_.add(request); + if(acceptedControlRequests_.size()>512) + acceptedControlRequests_.remove(0); + const armix::mixer::ChannelId id{channel}; + if(action=="routingNativeFxRackBypass") + applied=engine_.bypassNativeFxRack(ep,rev,id,static_cast(value)); + else { + const auto token=args.getProperty("insertId",{}).toString(); + applied=slot>=0&&slot(slot),token,static_cast(value)); + } + } + auto ack=std::make_unique(); + ack->setProperty("requestId",request); + ack->setProperty("ok",applied); + ack->setProperty("channelId",rawId); + ack->setProperty("bypassed",value); + ack->setProperty("error",applied?juce::String(): + "Native FX power rejected: stale device/revision, Show busy or instance mismatch"); + if(browser_.loaded)browser_.emitEventIfBrowserIsVisible( + "arMixNativeFxPowerAck",juce::var(ack.release())); + if(applied)diagnostics_.record("NATIVE_FX_POWER", + rawId.toString()+(action=="routingNativeFxRackBypass"?" rack":" insert")+ + (static_cast(value)?" BYPASS":" ENABLE")); + 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") { diff --git a/tests/approved_fx_rack_master_power_smoke.py b/tests/approved_fx_rack_master_power_smoke.py new file mode 100644 index 000000000..25eb5dd9e --- /dev/null +++ b/tests/approved_fx_rack_master_power_smoke.py @@ -0,0 +1,89 @@ +"""P0 FX rack: header bypass overrides effective power, never saved slots. + +Chromium exercises ONE actual built /preview/ GUI (also used by native JUCE). +Public Pages only demonstrates the control state; real DSP is checked in +native engine contracts/Windows CTest and physical hardware FAT separately. +""" +from pathlib import Path +from playwright.sync_api import sync_playwright + +PAGE=Path(__file__).resolve().parents[1]/"dist-pages/preview/index.html" + + +def snapshot(page, channel=1): + root=page.locator(f'#tracks .strip[data-id="{channel}"] .fx-section') + return root.evaluate("""el=>({ + rack:el.dataset.fxChainEnabled, + header:el.querySelector('[data-action="fxOn"]').getAttribute('aria-pressed'), + slots:[...el.querySelectorAll('.fxslot-row:not(.is-empty)')].map(row=>({ + id:row.dataset.insertId, + individual:row.dataset.fxSlotEnabled, + effective:row.dataset.fxEffective, + power:row.querySelector('[data-action="slotPower"]') + ?.getAttribute('aria-pressed'), + bypassed:row.classList.contains('is-bypassed') + })) + })""") + + +def main(): + assert PAGE.is_file(), "build official /preview/ first" + with sync_playwright() as pw: + browser=pw.chromium.launch(headless=True) + try: + for width,height in [(390,844),(1366,768),(1680,900)]: + page=browser.new_page(viewport={"width":width,"height":height}) + errors=[] + page.on("pageerror",lambda e:errors.append(str(e))) + page.goto(PAGE.as_uri()) + page.locator("#tracks .strip[data-id='1']").wait_for() + root=page.locator('#tracks .strip[data-id="1"]') + initial=snapshot(page) + assert len(initial["slots"])==1 and initial["slots"][0]["power"]=="true",initial + # Load the second effect using the actual UI picker. + root.locator('.fx-pick.empty').click() + page.locator('#fastResults [data-fast-id]').first.click() + both=snapshot(page) + assert len(both["slots"])==2 and all( + x["power"]=="true" for x in both["slots"]),both + # Individual OFF is a stored preference, never overwritten. + root.locator('[data-action="slotPower"][data-slot="0"]').click() + individual=snapshot(page) + assert individual["slots"][0]["individual"]=="false",individual + assert individual["slots"][1]["individual"]=="true",individual + # On phones the official console banks one channel at a + # time; inspect CH2 via its real bank selector, not a hidden DOM. + if width < 500: + page.locator("#bankSelect").select_option("1") + other=snapshot(page,2) + if width < 500: + page.locator("#bankSelect").select_option("0") + root.locator('[data-action="fxOn"]').click() + off=snapshot(page) + assert off["header"]==off["rack"]=="false",off + assert all(row["power"]=="false" and + row["effective"]=="false" and row["bypassed"] + for row in off["slots"]),off + assert [r["individual"] for r in off["slots"]]==["false","true"],off + assert [r["id"] for r in off["slots"]]==[r["id"] for r in individual["slots"]],off + if width < 500: + page.locator("#bankSelect").select_option("1") + assert snapshot(page,2)==other,"Rack power leaked into other channel" + if width < 500: + page.locator("#bankSelect").select_option("0") + root.locator('[data-action="fxOn"]').click() + restored=snapshot(page) + assert restored["header"]==restored["rack"]=="true",restored + assert [r["power"] for r in restored["slots"]]==["false","true"],restored + assert [r["effective"] for r in restored["slots"]]==["false","true"],restored + assert [r["individual"] for r in restored["slots"]]==["false","true"],restored + assert [r["id"] for r in restored["slots"]]==[r["id"] for r in individual["slots"]],restored + assert not errors,errors + print("PASS FX rack master power + saved individual state",width,height) + page.close() + finally: + browser.close() + + +if __name__=="__main__": + main() diff --git a/tests/builtin_channel_eq_bank_test.cpp b/tests/builtin_channel_eq_bank_test.cpp index 9c528d0c0..0d00bd83e 100644 --- a/tests/builtin_channel_eq_bank_test.cpp +++ b/tests/builtin_channel_eq_bank_test.cpp @@ -126,5 +126,36 @@ int main() { } CHECK(dryEnergy>0.001&&wetEnergy>dryEnergy*4); CHECK(!restored.setGateOffline(14,true,false)); + // Rack OFF: exact dry PCM once the 5ms fade completes, while the EQ's + // own ON preference and eight bands remain unchanged. + CHECK(restored.setRackBypass(3,true)); + for(int block=0;block<10;++block){ + for(int i=0;i<128;++i) + reference[static_cast(i)]= + static_cast(.1*std::sin(6.283185307179586* + 1000.0*(block*128+i)/48000.0)); + out=reference; + restored.render(3,out.data(),silent.data(),128); + if(block>=6)CHECK(out==reference); + } + CHECK(restored.rackBypassed(3)); + CHECK(restored.setRackBypass(3,false)); + double resumedEnergy=0,dryResumed=0; + for(int block=0;block<64;++block){ + for(int i=0;i<128;++i) + reference[static_cast(i)]= + static_cast(.1*std::sin(6.283185307179586* + 1000.0*(block*128+i)/48000.0)); + out=reference; + restored.render(3,out.data(),silent.data(),128); + if(block>=48)for(int i=0;i<128;++i){ + resumedEnergy+=out[static_cast(i)]* + out[static_cast(i)]; + dryResumed+=reference[static_cast(i)]* + reference[static_cast(i)]; + } + } + CHECK(resumedEnergy>dryResumed*4); + CHECK(!restored.rackBypassed(3)&&!restored.setRackBypass(14,true)); std::puts("PASS: 14-lane EQ, Show V5 offline restore/bypass PCM, SPSC ACK, no RT heap"); } diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index c8f14afa4..88ac4ac28 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -43,6 +43,10 @@ assert.match(js,/DESIGN DEMO · NO AUDIO/); assert.match(js,/snapshotReady/); assert.ok(!['AudioContext','webkitAudioContext','createScriptProcessor','new Worker('].some(s=>js.includes(s)), 'Browser EQ must not own audio callback'); assert.ok(css.includes('#mxBuiltinEq[hidden]')); +const eqBank=fs.readFileSync('engine/builtin_fx/ChannelEqBank.h','utf8'); +assert.ok(eqBank.includes('rackBypassed_[lane].load')&& + eqBank.includes('insertBypassed_[lane]||rackOff'), + 'FX header OFF must override native EQ PCM without losing insert preference'); console.log('Built-in Channel EQ GUI contract: PASS (isolated from VST3 and alt mixer)'); assert.ok(!html.includes('assets/mixer-builtin-eq.css'), 'No second CSS cascade owner'); diff --git a/tests/live_channel_fx_graph_test.cpp b/tests/live_channel_fx_graph_test.cpp index ac4d9b389..3aef071fd 100644 --- a/tests/live_channel_fx_graph_test.cpp +++ b/tests/live_channel_fx_graph_test.cpp @@ -178,7 +178,18 @@ static void verifyUniversalChannelIdFxLeaseAndLivePcm() { auto second=newFx(1.25f,"ch11-second-vst3"); assert(Bank::appendOwned(epoch,3,bank,ch11,ProcessingFormat::mono, second,expanded)==Bank::Fault::none); + // Rack OFF applies to the new plugin too; old per-plugin OFF remains + // untouched and native append carries the same authoritative override. + assert(bank.setRackBypass(epoch,2,ch11,true)); + assert(bank.rackBypassed(ch11)); assert(expanded.insertCount(ch11)==2); + // expanded was already created before the OFF gesture. Its revision + // holds the same shared rack gate, so it observes the control live. + assert(expanded.rackBypassed(ch11)); + assert(!expanded.setRackBypass(epoch,2,ch11,false)); // stale version + assert(expanded.setRackBypass(epoch,3,ch11,false)); + assert(!bank.rackBypassed(ch11)); + assert(!expanded.rackBypassed(ch11)); assert(expanded.insertCount(ch1)==bank.insertCount(ch1)); assert((*expanded.ownerForControl(ch11,0))->instanceId== (*bank.ownerForControl(ch11,0))->instanceId); @@ -2013,6 +2024,11 @@ static void verifyBuiltInEqNativeChannelIdAndRevisionFence() { assert(native.queueBuiltInEqGate(9,3,ch,true,true,105)); assert(native.render(9,pins,1,left.data(),right.data(),128,false,noFx)); assert(native.pollBuiltInEqAck(9,3,ch,ack)&&ack.applied&&ack.requestId==105); + assert(native.setBuiltInEqRackBypass(9,3,ch,true)); + assert(restored->rackBypassed(0)); + assert(!native.setBuiltInEqRackBypass(9,2,ch,false)); // stale revision + assert(native.setBuiltInEqRackBypass(9,3,ch,false)); + assert(!restored->rackBypassed(0)); } int main(int argc,char** argv) { @@ -2387,6 +2403,33 @@ int main(int argc,char** argv) { assert(heapCalls.load(std::memory_order_relaxed)==beforeNextProcess); assert(left[0]>.3f); } + // FX RACK POWER: one atomic master overrides effective processing, + // without destroying the ON/OFF preferences of individual inserts. + { + auto graph=makeGraph(2.f,3.f); + const auto token=graph->insertInstanceId(0); + assert(!graph->rackBypassed(0)); + assert(graph->setInsertBypass(0,0,token,true)); // individual OFF + assert(graph->insertBypassed(0,0)); + assert(graph->setRackBypass(0,true)); // master OFF + assert(graph->rackBypassed(0)&&graph->insertBypassed(0,0)); + assert(graph->setRackBypass(0,false)); // master ON + assert(!graph->rackBypassed(0)); + assert(graph->insertBypassed(0,0)); // stays OFF + assert(graph->setInsertBypass(0,0,token,false)); + assert(graph->setRackBypass(0,true)); + assert(graph->setRackBypass(0,false)); + assert(!graph->insertBypassed(0,0)); // returns to ON + assert(!graph->setRackBypass(-1,true)); + assert(!graph->setRackBypass(LiveChannelFxGraph::fxSlots,true)); + auto moved=makeGraph(1.f,1.f,false); + assert(graph->setRackBypass(0,true)); + assert(moved->reuse(0,*graph,"vst3-ch1-id")); + assert(moved->rackBypassed(0)); // graph retirement retains gate + assert(moved->insertBypassed(0,0)==graph->insertBypassed(0,0)); + assert(moved->setRackBypass(0,false)); + assert(!moved->insertBypassed(0,0)); // saved ON restored + } // 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. diff --git a/tests/live_graph_contract_test.mjs b/tests/live_graph_contract_test.mjs index 6edcd12f1..b33a201fd 100644 --- a/tests/live_graph_contract_test.mjs +++ b/tests/live_graph_contract_test.mjs @@ -62,7 +62,10 @@ test('bypass is sample-smoothed by one original CH1 DSP owner for M4 and 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,/bypass\.request\(graph\.rackBypassed\.load/); + assert.match(originalDSP,/graph\.bypassFlags\[physical\]\.load/); + assert.match(originalDSP,/\|\|/, "rack override must OR with individual insert bypass"); + assert.match(originalDSP,/slot\.processor->processBlock\(buffer,midi\)/); assert.match(originalDSP,/bypass\.transitioning\(\)/); assert.match(originalDSP,/graph\.dryScratch\.getWritePointer\(0\)/); diff --git a/tests/single_preview_publication_contract_test.py b/tests/single_preview_publication_contract_test.py index f9025876d..8630926fb 100644 --- a/tests/single_preview_publication_contract_test.py +++ b/tests/single_preview_publication_contract_test.py @@ -4,6 +4,7 @@ sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'scripts')) from compile_approved_css import LINK, optimize_css, compile_runtime_bundle, link_runtime_bundle, RUNTIME_CSS from compose_builtin_eq import compose_builtin_eq, SCRIPT, CLICK_AFTER +from approved_fx_rack_power import apply_authoritative_fx_power ROOT=Path(__file__).resolve().parents[1] DST=Path(sys.argv[1]).resolve() if len(sys.argv)>1 else ROOT/'dist-pages' gui=DST/'preview' @@ -41,6 +42,7 @@ def require(ok,why): require((gui/'assets/gui-perf-probe.js').read_bytes()== (ROOT/'site/preview-v2/assets/gui-perf-probe.js').read_bytes(), 'opt-in performance probe was not copied byte-for-byte') +expected=apply_authoritative_fx_power(expected) # Stage C: the source HTML remains byte-exact, but the 18 deployed CSS files # contain only proven cascade winners. Verify every *generated* byte and query # hash; never approve an extra stylesheet, different owner or PNG mutation. diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js index b726e480f..a47081009 100644 --- a/web/approved-native-bridge.js +++ b/web/approved-native-bridge.js @@ -20,6 +20,7 @@ // B-stage: attached-node-only meter caches; a structural render invalidates // them atomically. Never retain detached WebView2 strips or stale channel IDs. const meterElements = new Map(); + let nativeFxPowerSerial=0, pendingNativeFxPower=null; let controller = null; const status = message => { lastNativeError = message; @@ -82,6 +83,8 @@ t.mute=ch.controls.mute; t.solo=ch.controls.solo; t.selected=previous.get(t.id)?.selected || false; + if(typeof ch.fxRackBypassed==="boolean") + t.fxOn=!ch.fxRackBypassed; // ONLY actual native rack readback if (Array.isArray(ch.inserts)) { t.fx=Array.from({length:8},(_,i)=>ch.inserts[i]?.name||"None"); t.slotBypass=Array.from({length:8},(_,i)=>Boolean(ch.inserts[i]?.bypassed)); @@ -304,7 +307,7 @@ // Control readback may change at the SAME structural graph revision. // Compare the actual accepted controls/edges, never skip native fader updates. const signature=next.identity+"|"+JSON.stringify(next.graph.channels.map(ch=>[ - ch.id,ch.controls,ch.inserts,ch.primaryOutId]))+"|"+JSON.stringify(next.graph.edges); + ch.id,ch.controls,ch.inserts,ch.fxRackBypassed,ch.primaryOutId]))+"|"+JSON.stringify(next.graph.edges); if (signature===lastPaintedSignature) { // Telemetry often advances without a structural graph revision. paintNativeMeters(next); @@ -317,6 +320,16 @@ } flags.productionCallbackLive=next.productLive;flags.acceptedGraphConnected=true; lastPaintedSignature=signature;stopDemo();paintNativeMeters(next); + if(pendingNativeFxPower?.acked) { + const pending=pendingNativeFxPower; + const nativeCh=next.graph.channels.find(ch=>ch.id===pending.channelId); + const actual=pending.kind==="rack"?nativeCh?.fxRackBypassed: + nativeCh?.inserts?.find(i=>i.id===pending.insertId)?.bypassed; + if(actual===pending.bypassed) { + pendingNativeFxPower=null; + status("NATIVE FX "+pending.kind+" power verified from actual PCM readback"); + } + } status((next.productLive?"NATIVE PRODUCT LIVE":"NATIVE PCM GRAPH ACCEPTED · FAT PENDING")+ " · device "+next.device.epoch+ " · graph "+next.graph.revision+" · roster "+next.graph.rosterRevision); @@ -349,6 +362,17 @@ finally{profiler.sample("nativeSnapshotJsMs",performance.now()-started);} }); backend.addEventListener("arMixConsoleAck", ack=>controller.onAck(ack)); + backend.addEventListener("arMixNativeFxPowerAck", ack=>{ + if(!pendingNativeFxPower||ack?.requestId!==pendingNativeFxPower.requestId)return; + if(ack.ok!==true){ + pendingNativeFxPower=null; + status("NATIVE FX REJECTED: "+(ack?.error||"stale engine authority")); + controller.subscribe(); // restore authoritative state + return; + } + pendingNativeFxPower.acked=true; + controller.subscribe(); // ACK is not state; await independent PCM readback + }); backend.addEventListener("arMixSourceSwitchAck", ack=>{ if(!pendingSourceId||ack?.requestId!==pendingSourceId)return; pendingSourceId=0; @@ -420,6 +444,43 @@ const key=action==="mute"?"SET_MUTE":"SET_SOLO"; intent(key,t,{value:!t[action],enabled:!t[action]});return true; } + if(action==="fxOn" || action==="slotPower") { + const current=controller?.state()?.current; + const id=nativeIdFor(t); + const ch=current?.graph?.channels?.find(x=>x.id===id); + if(!current?.admitted||!id||!ch||pendingNativeFxPower){ + status("NATIVE FX: wait for accepted graph/readback or pending ACK"); + return true; + } + const rack=action==="fxOn"; + const slot=Number(btn?.dataset?.slot); + const insert=!rack&&Number.isInteger(slot)&&slot>=0&&slot<8? + ch.inserts?.[slot]:null; + if((rack&&typeof ch.fxRackBypassed!=="boolean")|| + (!rack&&(!insert||typeof insert.bypassed!=="boolean"|| + typeof insert.id!=="string"||!insert.id))){ + status("NATIVE FX: rack/insert is not admitted on this ChannelId"); + return true; + } + const requestId="fx-"+(++nativeFxPowerSerial)+"-"+Date.now().toString(36); + const bypassed=rack?!ch.fxRackBypassed:!insert.bypassed; + pendingNativeFxPower={requestId,channelId:id,kind:rack?"rack":"insert", + insertId:insert?.id,bypassed,acked:false}; + backend.emitEvent("arMixAction",{ + action:rack?"routingNativeFxRackBypass":"routingNativeFxInsertBypass", + requestId,channelId:id,deviceEpoch:current.device.epoch, + revision:current.graph.revision,value:bypassed, + ...(rack?{}:{slot,insertId:insert.id}) + }); + status("NATIVE FX "+(rack?"RACK":"INSERT")+" pending ACK + PCM readback"); + window.setTimeout(()=>{ + if(pendingNativeFxPower?.requestId===requestId){ + pendingNativeFxPower=null;controller?.subscribe(); + status("NATIVE FX ACK/readback timeout; control unchanged until producer confirms"); + } + },8000); + return true; + } status("NATIVE: "+action+" is not an accepted ChannelId operation");return true; }, consumeWire(ops) { From 20d6db257a06bd690c13256e1288ef62309e6093 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 16:15:54 +0700 Subject: [PATCH 31/48] ci(eq): accept owner-authorized immutable-SHA ChatGPT UI and FAT qualification dispatch --- .github/workflows/p1-windows.yml | 15 +++++++++++---- .github/workflows/ui-smoke.yml | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index e8f4be3b5..0ce438f6c 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -87,6 +87,11 @@ on: type: boolean required: false default: false + expected_sha: + description: "Immutable source SHA for ChatGPT milestone" + type: string + required: false + default: "" concurrency: # Never cancel a deliberately requested, exact-SHA FAT build. For normal @@ -106,6 +111,8 @@ jobs: timeout-minutes: 8 steps: - uses: actions/checkout@v4 + with: + ref: ${{ inputs.expected_sha != '' && inputs.expected_sha || github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} - uses: actions/setup-python@v5 with: python-version: "3.12" @@ -114,7 +121,7 @@ jobs: node scripts/check_console_puzzle.mjs node --check web/approved-native-bridge.js node --check web/approved-native-contract.js - node --test tests/workstream_coordination_contract.test.mjs tests/ci_workflow_efficiency_test.mjs tests/approved_native_m2_contract.test.cjs tests/native_artifact_packaging_contract_test.mjs tests/live_graph_contract_test.mjs + node --test tests/workstream_coordination_contract.test.mjs tests/ci_workflow_efficiency_test.mjs tests/chat_ci_dispatch_contract.test.mjs tests/approved_native_m2_contract.test.cjs tests/native_artifact_packaging_contract_test.mjs tests/live_graph_contract_test.mjs python -m unittest discover -s tests -p approved_native_gui_bundle_test.py -v python -m unittest discover -s scripts/tests -p test_factoryfx_release_bundle.py -v windows-build: @@ -122,18 +129,18 @@ jobs: needs: quick # Draft commits never reserve expensive Windows runners. Non-draft PR # synchronizations re-test latest HEAD. Main push and manual always run. - if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} + if: ${{ github.event_name != 'pull_request' }} runs-on: windows-2022 timeout-minutes: 50 steps: - uses: actions/checkout@v4 with: # Package the actual PR branch commit, NOT the synthetic PR merge. - ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + ref: ${{ inputs.expected_sha != '' && inputs.expected_sha || github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} - name: Verify exact source SHA before native CTest / optional FAT ZIP shell: pwsh env: - EXPECTED_SOURCE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + EXPECTED_SOURCE_SHA: ${{ inputs.expected_sha != '' && inputs.expected_sha || github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} run: | $actual = (& git rev-parse HEAD).Trim() if ($LASTEXITCODE -ne 0 -or $actual -ne $env:EXPECTED_SOURCE_SHA) { diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index 7a763f983..b653a2a8b 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -46,6 +46,12 @@ on: # Manually run full Chromium (including immutable historical tests) on a # specific development branch whenever a milestone needs visual qualification. workflow_dispatch: + inputs: + expected_sha: + description: "Immutable source SHA for ChatGPT Chromium milestone" + type: string + required: false + default: "" # New PR commits supersede old UI checks. The production Pages dispatcher # only reacts to a completed successful main push, never cancelled checks. @@ -66,6 +72,8 @@ jobs: timeout-minutes: 8 steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.expected_sha != '' && inputs.expected_sha || github.sha }} - uses: actions/setup-python@v5 with: python-version: "3.12" @@ -86,7 +94,7 @@ jobs: node tests/wire_main_native_handoff_contract.test.cjs - name: Verify single published /preview/ source offline run: | - python scripts/build_pages.py --out dist-pages --sha "${{ github.sha }}" --branch main + python scripts/build_pages.py --out dist-pages --sha "${{ github.event_name == 'workflow_dispatch' && inputs.expected_sha != '' && inputs.expected_sha || github.sha }}" --branch main python tests/single_preview_publication_contract_test.py dist-pages - name: Block incomplete product release only when preparing product review if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft && startsWith(github.head_ref, 'integration/product-') }} @@ -102,6 +110,8 @@ jobs: timeout-minutes: 20 steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.expected_sha != '' && inputs.expected_sha || github.sha }} - uses: actions/setup-python@v5 with: python-version: "3.12" @@ -134,7 +144,7 @@ jobs: run: python tests/css_v28_restore.py - name: Verify ONLY approved public GUI /preview/ with PNG hardware keys run: | - python scripts/build_pages.py --out dist-pages --sha "${{ github.sha }}" --branch main + python scripts/build_pages.py --out dist-pages --sha "${{ github.event_name == 'workflow_dispatch' && inputs.expected_sha != '' && inputs.expected_sha || github.sha }}" --branch main python tests/single_preview_publication_contract_test.py dist-pages - name: Validate smart audio architecture handoff contract run: node --test tests/smart_audio_ard_contract_test.mjs From 3a4923a54b63493038278aabddd7fa05b8e049f7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 16:19:54 +0700 Subject: [PATCH 32/48] fix(ci): retain reviewed-PR Windows guard while supporting exact-SHA FAT dispatch --- .github/workflows/p1-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 0ce438f6c..4b60d6190 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -129,7 +129,7 @@ jobs: needs: quick # Draft commits never reserve expensive Windows runners. Non-draft PR # synchronizations re-test latest HEAD. Main push and manual always run. - if: ${{ github.event_name != 'pull_request' }} + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} runs-on: windows-2022 timeout-minutes: 50 steps: From 515d5190d17339ffcd435a497a7ecef19e560a3d Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 16:25:00 +0700 Subject: [PATCH 33/48] test(gui): validate V6 interactions on the single approved /preview/ output --- tests/pages_contextual_buttons_smoke.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/pages_contextual_buttons_smoke.py b/tests/pages_contextual_buttons_smoke.py index 6f93f27c8..f8f366799 100644 --- a/tests/pages_contextual_buttons_smoke.py +++ b/tests/pages_contextual_buttons_smoke.py @@ -96,7 +96,7 @@ def check_page(browser,path,label): assert page.locator('#tracks .strip[data-id="1"] .wire-node-out').count()==1 assert page.locator('#tracks .strip[data-id="1"] .wire-node-in').count()==1 assert not errors,(label,'page errors',errors) - if label=='png': + if label=='public': page.screenshot(path='pages-v6-contextual-buttons-1440.png') page.close() @@ -113,24 +113,24 @@ def main(): subprocess.run([sys.executable,str(ROOT/'scripts/build_pages.py'), '--out',str(dist),'--sha','v6-ci','--branch','main'], cwd=ROOT,check=True,capture_output=True,text=True) - for target in ('preview','preview-v2','preview-buttons'): - assets=dist/target/'assets' - assert (assets/OWNER).read_bytes()==(ROOT/'site/preview-v2/assets'/OWNER).read_bytes(),target - assert (assets/SCRIPT).read_bytes()==(ROOT/'site/preview-v2/assets'/SCRIPT).read_bytes(),target + # The one canonical Pages/JUCE output is /preview/. Historical + # source seeds are fixtures, NOT additional public HTML routes. + assets=dist/'preview/assets' + assert (assets/OWNER).read_bytes()==(ROOT/'site/preview-v2/assets'/OWNER).read_bytes() + assert (assets/SCRIPT).read_bytes()==(ROOT/'site/preview-v2/assets'/SCRIPT).read_bytes() png_src=ROOT/'site/preview-buttons/assets' - png_pub=dist/'preview-buttons/assets' + png_pub=assets for file in ('mixer-control-keys.css','mixer-control-keys.js','mute-solo-pfl-56x37.png'): assert (png_pub/file).read_bytes()==(png_src/file).read_bytes(),file with sync_playwright() as p: browser=p.chromium.launch(headless=True) for file,label in ( (CANON,'canonical'), - (dist/'preview/mixer.html','public'), - (dist/'preview-buttons/index.html','png') + (dist/'preview/index.html','public') ): check_page(browser,file,label) browser.close() - print('PASS V6 OTHER buttons: 3 routes, PNG protected, action release, native latches,') + print('PASS V6 OTHER buttons: approved /preview/ and source fixture, PNG protected,') print('micro geometry, fixed MAIN size, no pointer-focus or layout scroll') From 8bb868e08bc64298073c8fec8e7a4203e2854620 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 16:26:07 +0700 Subject: [PATCH 34/48] fix(eq): settle pending audio edits safely when graph/epoch identity is retired --- src/Main.cpp | 23 +++++++++++++++-------- tests/builtin_eq_gui_contract_test.mjs | 5 +++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/Main.cpp b/src/Main.cpp index 422777594..6943bb57e 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -461,15 +461,22 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr for(int lane=0;lane<14;++lane) { auto& pending=eqPending_[static_cast(lane)]; if(!pending.active)continue; + // A graph rebuild or device reconnect invalidates the old EQ + // authority. Such a command cannot be ACKed by the new graph: + // the bank rejects its old revision at the next callback. Do + // not let it indefinitely block Show SAVE/RECALL. + int currentLane=-1; + std::uint64_t currentEpoch=0,currentRevision=0; + const bool sameSession=engine_.builtInEqIdentity( + pending.channel,currentLane,currentEpoch,currentRevision) && + currentLane==lane && currentEpoch==pending.epoch && + currentRevision==pending.revision; LiveAudioEngine::BuiltInEqAck ack{}; - const bool got=engine_.pollBuiltInEqAck(lane,pending.epoch, - pending.revision,ack); - // Physical output may be muted and no EQ render/ACK occurs. - // A wall-clock timeout is NOT cancellation: the SPSC command - // remains queued and could apply when output resumes. Retain - // ownership until an actual AUDIO ACK, or explicit graph/epoch - // teardown, instead of announcing a false REJECTED state. - if(!got)continue; + const bool got=sameSession && + engine_.pollBuiltInEqAck(lane,pending.epoch,pending.revision,ack); + // No audio callback while muted is NOT a rejected command. + // Only real AUDIO ACK or invalidated graph authority settles it. + if(sameSession&&!got)continue; const bool ok=got&&ack.applied&&ack.requestId==pending.request && ack.lane==lane&& ((pending.slot<0&&ack.gate)|| diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index 88ac4ac28..82fc5e1d6 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -23,9 +23,10 @@ assert.ok(publisher.includes('if(fx.builtInEq) {') && publisher.indexOf('if(fx.builtInEq) {') < publisher.indexOf('else if(prior && prior->builtInEq)'), 'Show V5 supplied EQ must win over a prior native ChannelId graph'); -assert.ok(main.includes('if(!got)continue;') && +assert.ok(main.includes('if(sameSession&&!got)continue;') && + main.includes('currentRevision==pending.revision') && !main.includes('now-pending.started<4000u'), - 'Never report false EQ rejection while a muted callback has not ACKed'); + 'Never report a false timeout; invalidate outstanding EQ only on structural session loss'); assert.ok(main.includes('captureAcceptedEq(')&& main.includes('acceptedEqFromShow(')&& main.includes('unsettledBuiltInEq()')&& From 9450a55508de1d98f4c1af37d5858d283d17e77c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 16:32:05 +0700 Subject: [PATCH 35/48] test(gui): verify locked WIRE/PNG CSS in approved Stage D single runtime bundle --- tests/pages_wire_incoming_v43_smoke.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/pages_wire_incoming_v43_smoke.py b/tests/pages_wire_incoming_v43_smoke.py index 8c6b3f33f..05ad30d34 100644 --- a/tests/pages_wire_incoming_v43_smoke.py +++ b/tests/pages_wire_incoming_v43_smoke.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """V43: generated public /preview/ parity, persistent incoming cables, and physical socket impact.""" from pathlib import Path -import math,re,subprocess,sys,tempfile +import json,math,re,subprocess,sys,tempfile from playwright.sync_api import sync_playwright ROOT=Path(__file__).resolve().parents[1] @@ -55,9 +55,21 @@ def main(): cwd=ROOT,capture_output=True,text=True) public=dst/"preview/index.html" shared=dst/"preview/assets/mixer-wire-dots.css" - assert "mixer-control-keys.css?rev=" in public.read_text("utf-8"),"Published /preview/ lost approved PNG hardware keys" + # Stage D deliberately replaces 18 CSS links with one content-addressed + # runtime stylesheet. Verify that the two locked physical component owners + # remain present and byte-exact, rather than requiring obsolete link URLs. + manifest=json.loads((dst/"preview/build.json").read_text("utf-8")) + assert re.fullmatch(r"[0-9a-f]{16}", + manifest["button_css_js_revisions"]["mixer-control-keys.css"]) + keys=dst/"preview/assets/mixer-control-keys.css" + assert keys.read_bytes()==(ROOT/"site/preview-buttons/assets/mixer-control-keys.css").read_bytes() assert shared.read_bytes()==WIRE_CSS.read_bytes(),"Approved /preview/ did not publish the effective WIRE CSS" - assert 'assets/mixer-wire-dots.css?v=v59-selected-wire-quiet' in public.read_text("utf-8") + published=public.read_text("utf-8") + runtime=dst/"preview/assets/arsonmix-approved-runtime.css" + assert 'href="assets/arsonmix-approved-runtime.css?sha=' in published + bundled=runtime.read_text("utf-8") + assert "BEGIN approved owner mixer-control-keys.css" in bundled + assert "BEGIN approved owner mixer-wire-dots.css" in bundled with sync_playwright() as pw: browser=pw.chromium.launch(headless=True) for width in (1366,1680): From cdcae77519d9724096dd630affc818050b249a19 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 16:39:11 +0700 Subject: [PATCH 36/48] test(gui): qualify V10 historical restore against maintained Stage D single-preview CSS publication --- tests/pages_css_architecture_v10_smoke.py | 24 ++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/pages_css_architecture_v10_smoke.py b/tests/pages_css_architecture_v10_smoke.py index 3061b55c2..454736bbd 100644 --- a/tests/pages_css_architecture_v10_smoke.py +++ b/tests/pages_css_architecture_v10_smoke.py @@ -57,11 +57,15 @@ def source_gate(): (HTML.parent / "assets" / n).read_text(encoding="utf-8")) if n else body for n, version, tag, body in css_order ) - assert len(all_css) == EXPECTED_CSS_LENGTH, "CSS ownership source bytes missing" - assert fingerprint(all_css) == EXPECTED_FNV, "CSS cascade/content drift" + # Historical V16-V19 reconstructors above already validate their + # immutable source ledgers byte-for-byte. The *other* CSS owners are the + # continuously maintained canonical files: summing their modern bytes and + # comparing with the pre-V20 global fingerprint rejects valid later CSS + # work rather than detecting a regression. + assert len(all_css)>sum(map(len,styles))>80000, "Missing owned CSS" assert sum(map(len, styles)) == EXPECTED_INLINE_LENGTH - assert all_css.count("!important") == 981 assert sum(body.count("!important") for body in styles) == 763 + assert all(n in names for n in expected) original = (HTML.parent / "assets" / OWNERS[0]).read_text(encoding="utf-8") grid = (HTML.parent / "assets" / OWNERS[1]).read_text(encoding="utf-8") artwork = (HTML.parent / "assets" / OWNERS[2]).read_text(encoding="utf-8") @@ -73,10 +77,16 @@ def source_gate(): assert "wireWsCanJoin" in live assert "assets/mixer-wire-dots.css?v=v47-css-v16" in html assert "assets/inter-embedded.css" in html - for p in (ROOT / "scripts/build_pages.py", ROOT / ".github/workflows/pages-publish.yml"): - source = p.read_text(encoding="utf-8") - for name in (*OWNERS, "mixer-wire-dots.css"): - assert name in source, (p.name, name, "missing Pages parity manifest") + # Stage D intentionally uses an enumerated 18-owner compiler and ONE + # compiled CSS link. The Pages job delegates its proof to that compiler + # and the independent single-preview contract; neither duplicates all + # historical CSS filenames inside workflow YAML. + assembler=(ROOT/"scripts/build_pages.py").read_text(encoding="utf-8") + deploy=(ROOT/".github/workflows/pages-publish.yml").read_text(encoding="utf-8") + assert "canonical_html=compose_builtin_eq(canonical_html)" in assembler + assert "runtime_bundle=True" in assembler + assert "python scripts/build_pages.py --out dist-pages" in deploy + assert "python tests/single_preview_publication_contract_test.py dist-pages" in deploy async def visual(page, width, height): errors = [] From d52460d21586813f7f8328292385381d6d72d399 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 16:42:47 +0700 Subject: [PATCH 37/48] ci(gui): gate pinned V10-V28 migration history separately from current Chromium product smoke --- .github/workflows/ui-smoke.yml | 63 ++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index b653a2a8b..b2bc157be 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -52,6 +52,11 @@ on: type: string required: false default: "" + historical_full: + description: "Explicitly rerun pinned V10-V28 CSS migration/historical parity" + type: boolean + required: false + default: false # New PR commits supersede old UI checks. The production Pages dispatcher # only reacts to a completed successful main push, never cancelled checks. @@ -211,7 +216,7 @@ jobs: # pretending the intentional V50 layout/stylesheet changes are V22. # Restore PR files before ALL current GUI/function/geometry smoke tests. - name: Mount pinned V24 historical CSS fixture (reversible, no CI rebaseline) - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} shell: bash run: | set -euo pipefail @@ -224,58 +229,58 @@ jobs: git show "$baseline:$path" > "$path" done - name: Verify V8 FX rack and Plugin Manager CSS ownership - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_ownership_v8_smoke.py - name: Verify V9 PAN/fader/meter CSS ownership and geometry - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_ownership_v9_smoke.py - name: Verify V10 cascade ownership and rendered console geometry - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v10_smoke.py - name: Validate V11 section ownership, cascade and computed visual styles - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v11_smoke.py - name: Verify V12 removed shadow declarations and old/new visual + control parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v12_smoke.py - name: Verify V13 owned CSS conflicts and physical control visual parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v13_smoke.py - name: Verify V14 canonical 45 material tokens and V13 browser parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v14_smoke.py - name: Verify V15 clean cross-owner CSS and actual interactive visual parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v15_smoke.py - name: Verify V16 WIRE single CSS owner, 241-rule exact source and visual parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v16_smoke.py - name: Verify V17 Plugin Manager and Fast FX Picker single CSS owner - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v17_smoke.py - name: Verify V18 physical Chrome ownership and four cascade conflict removals - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v18_smoke.py - name: Verify V19 shared operator key ownership and six shadowed declarations - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v19_smoke.py - name: Verify V20 elimination of 53 shadowed declarations and Chromium state parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v20_smoke.py - name: Verify V21 physical console chassis geometry owner and visual parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v21_smoke.py - name: Verify V22 legacy key material migration and M3 visual parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v22_smoke.py - name: Verify V23 exact cascade deletions and browser parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v23_smoke.py - name: Verify V24 Fader/Meter/FX cascade pruning and browser parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v24_smoke.py - name: Restore and verify exact V50 PR assets before current UI smoke - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} shell: bash run: | set -euo pipefail @@ -288,7 +293,7 @@ jobs: # The V25 historical test is an immutable exact-byte migration gate. # Do not rebaseline it after deliberate V26 dead-rule removals. - name: Mount pinned V25 original CSS before historical V25 migration test - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} shell: bash run: | set -euo pipefail @@ -301,10 +306,10 @@ jobs: git show "$baseline:$path" > "$path" done - name: Verify V25 exact V51 physical-key owner migration and zero visual regression - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v25_smoke.py - name: Restore and verify current V26 source before latest GUI tests - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} shell: bash run: | set -euo pipefail @@ -316,7 +321,7 @@ jobs: git diff --exit-code -- site/preview-v2/index.html site/preview-v2/assets/mixer-control-keys.css site/preview-v2/assets/mixer-chrome-material.css site/preview-v2/assets/mixer-plugin-browser.css site/preview-v2/assets/mixer-pan-controls.css site/preview-v2/assets/mixer-fader-assembly.css site/preview-v2/assets/mixer-meter-display.css site/preview-v2/assets/mixer-utility-controls.css # Byte-exact V26 historical CSS check is pinned, not rebaselined. - name: Mount V26 approved source before historical regression - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} shell: bash run: | set -euo pipefail @@ -329,10 +334,10 @@ jobs: git show "$baseline:$path" > "$path" done - name: Verify V26 retired socket dead rules and exact V25 visual/control parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v26_smoke.py - name: Restore P0 current WIRE source after historical V26 regression - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} shell: bash run: | set -euo pipefail @@ -345,7 +350,7 @@ jobs: # V27 is a byte-exact historical CSS migration proof; it must run # against its original qualified GUI, never rebaseline a newer FX/rail. - name: Mount pinned V27 GUI and CSS owners for immutable parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} shell: bash run: | set -euo pipefail @@ -358,10 +363,10 @@ jobs: git show "$baseline:$path" > "$path" done - name: Verify V27 scoped material and 37 owned loser declarations with Chromium parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/pages_css_architecture_v27_smoke.py - name: Restore and verify exact V53 current sources after historical V27 - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} shell: bash run: | set -euo pipefail @@ -372,7 +377,7 @@ jobs: done git diff --exit-code -- site/preview-v2/index.html site/preview-v2/assets/mixer-chrome-material.css site/preview-v2/assets/mixer-plugin-browser.css site/preview-v2/assets/mixer-pan-controls.css site/preview-v2/assets/mixer-fader-assembly.css site/preview-v2/assets/mixer-meter-display.css site/preview-v2/assets/mixer-utility-controls.css - name: Verify V28 exact approved /preview/ source and interactive browser parity - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'css/v28-') || startsWith(github.head_ref, 'integration/product-'))) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.historical_full == true) || (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'css/v28-') || startsWith(github.head_ref, 'integration/product-'))) }} run: python tests/pages_css_architecture_v28_smoke.py - name: Verify embedded Inter font and contextual V7 micro-controls if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} From 58b9e5ded4ab45ab9b810ee9265bf07d41b99341 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 17:44:12 +0700 Subject: [PATCH 38/48] test(gui): validate approved PNG/WIRE assets through single Stage D runtime CSS --- ...s_png_buttons_wire_reconciliation_smoke.py | 52 +++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/tests/pages_png_buttons_wire_reconciliation_smoke.py b/tests/pages_png_buttons_wire_reconciliation_smoke.py index 036003f62..e0c449abf 100644 --- a/tests/pages_png_buttons_wire_reconciliation_smoke.py +++ b/tests/pages_png_buttons_wire_reconciliation_smoke.py @@ -37,27 +37,49 @@ def verify_bundle(dist): assert "url=../preview/" in (dist/"preview-buttons/index.html").read_text(encoding="utf-8") assert 'http-equiv="refresh"' in (dist/"preview/mixer.html").read_text(encoding="utf-8") - # Strip only the two deliberate fingerprinted CSS/JS URLs. Everything - # else, including the V46+ WIRE model and channel events, must be 1:1. - stripped=html + # The current approved assembler adds native EQ/Fx controls and Stage D + # combines 18 source-owned CSS stylesheets into one content-addressed + # runtime stylesheet. A removed per-owner CSS URL is intentional, NOT a + # missing hardware key. Verify source bytes, digest, and the exact owner + # inside the runtime CSS rather than restoring obsolete HTML parity. + revisions=meta["button_css_js_revisions"] for name in SPECIAL: - path="assets/"+name - original_url=re.search(re.escape(path)+r'(?:\?[^"\s>]+)?',original) - current_url=re.search(re.escape(path)+r'\?rev=([0-9a-f]{16})',stripped) - assert original_url and current_url,(name,"missing cache-safe URL") expected=hashlib.sha256((OWNER/name).read_bytes()).hexdigest()[:16] - assert current_url.group(1)==expected,(name,"wrong asset revision") - stripped=stripped[:current_url.start()]+original_url.group(0)+stripped[current_url.end():] + assert revisions.get(name)==expected,(name,"wrong button asset digest") assert (generated/"assets"/name).read_bytes()==(OWNER/name).read_bytes(),name - assert stripped==original,"User-approved button variant modified the real WIRE mixer" + assert f'assets/{SPECIAL[1]}?rev={revisions[SPECIAL[1]]}' in html, ( + "approved PNG control JS not versioned") + runtime="arsonmix-approved-runtime.css" + cssmeta=meta["css_compilation"] + csssha=cssmeta["runtimeBundleCssSHA256"] + assert re.fullmatch(r"[0-9a-f]{16}",csssha) + assert html.count(f'assets/{runtime}?sha={csssha}')==1, ( + "single compiled CSS owner not loaded exactly once") + compiled=(generated/"assets"/runtime).read_bytes() + assert hashlib.sha256(compiled).hexdigest()[:16]==csssha, ( + "compiled CSS runtime digest drift") + assert b"BEGIN approved owner mixer-control-keys.css" in compiled + assert b"BEGIN approved owner mixer-wire-dots.css" in compiled + assert cssmeta["runtimeStylesheetCount"]==1 + assert cssmeta["removedStylesheetRequests"]==17 - # Removing old snapshots makes every extra asset a current-source - # dependency, never a cloned V45 file frozen across future WIRE updates. + # Never publish a cloned mixer or extra asset. Only the generated runtime + # CSS is added; CSS source owners remain available for provenance. Stage C + # legitimately compiles ordinary CSS declarations, so demand byte parity + # of non-CSS assets and separately verify the two locked CSS owners. canonical={f.name for f in (REFERENCE/"assets").iterdir() if f.is_file()} published={f.name for f in (generated/"assets").iterdir() if f.is_file()} - assert published==canonical|{SPRITE},("asset set drift",published^canonical) + assert published==canonical|{SPRITE,runtime},("asset set drift",published^canonical) for name in canonical-set(SPECIAL): - assert (generated/"assets"/name).read_bytes()==(REFERENCE/"assets"/name).read_bytes(),name + if not name.endswith(".css"): + assert (generated/"assets"/name).read_bytes()==(REFERENCE/"assets"/name).read_bytes(),name + assert (generated/"assets/mixer-wire-dots.css").read_bytes()==( + REFERENCE/"assets/mixer-wire-dots.css").read_bytes() + assert (generated/"assets/mixer-control-keys.css").read_bytes()==( + OWNER/"mixer-control-keys.css").read_bytes() + # The independent single-preview publication contract checks the entire + # generated DOM and all 18 compiled CSS owners byte-for-byte. This test + # additionally exercises real browser control, geometry and WIRE state. png=(generated/"assets"/SPRITE).read_bytes() assert png==(ROOT/"site/preview-v34/assets"/SPRITE).read_bytes() @@ -150,7 +172,7 @@ def main(): cwd=ROOT,check=True,capture_output=True,text=True) verify_bundle(dist) verify_browser(dist) - print("PASS: approved PNG buttons track latest canonical WIRE, asset byte parity, 3 viewports, ON/OFF stable") + print("PASS: one Stage D runtime CSS, locked PNG/WIRE assets, 3 Chromium viewports, ON/OFF stable") if __name__=="__main__": main() From 3ef0a96d3d41e0e08aa16c8bf4397ab3f6604dcc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 17:45:57 +0700 Subject: [PATCH 39/48] test(gui): qualify contextual, fader and dBFS controls on one compiled /preview/ surface --- tests/pages_contextual_contrast_smoke.py | 8 ++-- .../pages_m1_meter_gain_calibration_smoke.py | 38 +++++++++++++------ tests/pages_micro_fader_visual_v18_smoke.py | 9 +++-- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/tests/pages_contextual_contrast_smoke.py b/tests/pages_contextual_contrast_smoke.py index d1bc627a1..bcf16681f 100644 --- a/tests/pages_contextual_contrast_smoke.py +++ b/tests/pages_contextual_contrast_smoke.py @@ -98,7 +98,7 @@ def verify(page,label,path): assert contrast("#f5f8ff","#405b7f")>=5.5 # The bank-changing arrow has already been exercised; CH 01 need not # remain rendered after moving to the next bank. - if label=="approved-png": + if label=="public": page.locator(".command-bar").screenshot(path="pages-v6-arrow-contrast-1680.png") def main(): @@ -115,15 +115,15 @@ def main(): check=True,cwd=ROOT,stdout=subprocess.PIPE,stderr=subprocess.PIPE) with sync_playwright() as p: browser=p.chromium.launch(headless=True) + # One actual public mixer; historical preview URLs redirect only. for path,label in ((PAGE,"canonical"), - (dst/"preview/mixer.html","published-mixer"), - (dst/"preview-buttons/index.html","approved-png")): + (dst/"preview/index.html","public")): page=browser.new_page(viewport={"width":1680,"height":900}) verify(page,label,path) page.close() browser.close() print("PASS arrow OFF/ON icon contrast, unchanged geometry, Route to Bus dark microcopy,") - print("WIRE linked/legacy semantic contrast, and PNG reference route 3/3") + print("WIRE linked/legacy semantic contrast, source and one public PNG route") if __name__=="__main__": diff --git a/tests/pages_m1_meter_gain_calibration_smoke.py b/tests/pages_m1_meter_gain_calibration_smoke.py index a34c63b23..560caec49 100644 --- a/tests/pages_m1_meter_gain_calibration_smoke.py +++ b/tests/pages_m1_meter_gain_calibration_smoke.py @@ -4,6 +4,8 @@ Use the real generated public /preview/ and canonical sources, never a mock. Check unit math, computed geometry, visual label rhythm, and click-to-preview. """ +import hashlib +import json import math import subprocess import sys @@ -199,25 +201,37 @@ def main(): subprocess.run([sys.executable,str(ROOT/"scripts/build_pages.py"), "--out",str(dist),"--sha","m1-calibrated","--branch","m1"], cwd=ROOT,check=True,capture_output=True,text=True) - published=dist/"preview/mixer.html" - assert published.read_bytes()==CANON.read_bytes(),"Published mixer source drift" - expected_ruler_keys={ - "mixer-fader-assembly.css":"css-owner-v27-fader-rollback-pre-v52-tail", - "mixer-meter-display.css":"css-owner-v27-meter-pruned", - } - for name,key in expected_ruler_keys.items(): - assert f"assets/{name}?v={key}" in published.read_text("utf-8"),( - "stale ruler cache URL",name,key) + published=dist/"preview/index.html" + # Stage D has one runtime CSSOM. The canonical source remains + # byte-immutable but the product intentionally composes PNG controls, + # built-in Channel EQ and other approved native UI additions. Verify + # every fader/meter source owner is carried by the content-addressed + # runtime instead of demanding obsolete individual link URLs. + meta=json.loads((dist/"preview/build.json").read_text("utf-8")) + cssmeta=meta["css_compilation"] + runtime=(dist/"preview/assets/arsonmix-approved-runtime.css").read_bytes() + digest=hashlib.sha256(runtime).hexdigest()[:16] + assert cssmeta["runtimeBundleCssSHA256"]==digest + assert cssmeta["runtimeStylesheetCount"]==1 + assert published.read_text("utf-8").count( + "assets/arsonmix-approved-runtime.css?sha="+digest)==1 for name in ("mixer-fader-assembly.css","mixer-meter-display.css"): - assert (dist/"preview/assets"/name).read_bytes()==(ASSETS/name).read_bytes(),name + assert ("BEGIN approved owner "+name).encode() in runtime,name + data=(dist/"preview/assets"/name).read_bytes() + assert cssmeta["shaByCssOwner"][name]==hashlib.sha256(data).hexdigest()[:16],name + assert (dist/"preview/assets/mixer-control-keys.css").read_bytes()==( + ROOT/"site/preview-buttons/assets/mixer-control-keys.css").read_bytes() + assert (dist/"preview/assets/mixer-wire-dots.css").read_bytes()==( + ASSETS/"mixer-wire-dots.css").read_bytes() with sync_playwright() as pw: browser=pw.chromium.launch(headless=True) for html,label,width,height in ( (CANON,"canonical",1366,768), (CANON,"canonical",1680,900), (CANON,"canonical",1920,1080), + (published,"pages",1366,768), (published,"pages",1680,900), - (dist/"preview-buttons/index.html","png",1366,768)): + (published,"pages",1920,1080)): page=browser.new_page(viewport={"width":width,"height":height}) errors=[] page.on("pageerror",lambda exc:errors.append(str(exc))) @@ -233,7 +247,7 @@ def main(): page.close() browser.close() print("PASS M1: dBFS meter and gain rulers calibrated to physical travel; " - "preview demo displays real dBFS percentages, 3 densities × 3 sizes × 3 Pages routes") + "preview demo displays real dBFS percentages, 3 densities × 3 sizes × 1 public route") if __name__=="__main__": main() diff --git a/tests/pages_micro_fader_visual_v18_smoke.py b/tests/pages_micro_fader_visual_v18_smoke.py index cb7446100..08038e96f 100644 --- a/tests/pages_micro_fader_visual_v18_smoke.py +++ b/tests/pages_micro_fader_visual_v18_smoke.py @@ -88,7 +88,7 @@ def check(page,path,label): label,density,"printed scale numbers collide",tick) assert tick["value"]=="0",(label,density,"fader numeric value changed",tick) assert abs(tick["panHeight"]-40)<.6,(label,density,"PAN input hitbox moved",tick["panHeight"]) - if density=="comfort" and label=="png": + if density=="comfort" and label=="public": page.locator(channel+" .fader-section").screenshot(path="pages-v18-fader-scale-1680.png") page.locator(channel+" .fx-section").screenshot(path="pages-v18-fx-micro-1680.png") assert not errors,(label,errors) @@ -110,14 +110,15 @@ def main(): cwd=ROOT,check=True,capture_output=True,text=True) with sync_playwright() as playwright: browser=playwright.chromium.launch(headless=True) + # The approved PNG surface is /preview/index.html. The two + # legacy paths are redirects, not independent mixer renderers. for path,label in ((SOURCE,"canonical"), - (dist/"preview/mixer.html","public"), - (dist/"preview-buttons/index.html","png")): + (dist/"preview/index.html","public")): page=browser.new_page(viewport={"width":1680,"height":900},device_scale_factor=1) check(page,path,label) browser.close() print("PASS V18: Material delete+phase, 17px square buttons, calibrated rulers,") - print("no label overlaps across densities, PNG preserved, 3 real preview routes") + print("no label overlaps across densities, approved PNG in one public preview") if __name__=="__main__": main() From 75ea76ade98946cf879f75cb2317625b5da6dbe3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 17:52:54 +0700 Subject: [PATCH 40/48] test(gui): retain full visual acceptance on assembled preview and restore historical V10 proof; opt-in Firefox perf --- .github/workflows/ui-smoke.yml | 13 +++++++--- tests/pages_css_architecture_v10_smoke.py | 24 ++++++------------ tests/preview_v2_v7_visual_smoke.py | 30 +++++++++++++++++------ 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index b2bc157be..ed1224b11 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -57,6 +57,11 @@ on: type: boolean required: false default: false + firefox_perf: + description: "Optional Firefox compositor/performance cross-browser qualification" + type: boolean + required: false + default: false # New PR commits supersede old UI checks. The production Pages dispatcher # only reacts to a completed successful main push, never cancelled checks. @@ -432,13 +437,13 @@ jobs: - name: Verify MIX and FX RACK Auto Orbit workflow if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/native_orbit_ui_smoke.py - # Firefox perf is deliberate: main release verification or manual opt-in. - # Do not download/run a second browser for every iterative GUI PR. + # Firefox is an explicit cross-browser/performance opt-in. Ordinary + # exact-SHA Chromium milestones stay Chromium-only and runner-efficient. - name: Install Firefox for compositor functional regression - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.firefox_perf == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python -m playwright install firefox - name: Run Firefox opt-in performance diagnostics smoke - if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} + if: ${{ (github.event_name == 'workflow_dispatch' && inputs.firefox_perf == true) || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'integration/product-')) }} run: python tests/ui_firefox_perf_smoke.py - name: Attach current WIRE / FX / meter / fader screenshots (small, PR-friendly) if: always() diff --git a/tests/pages_css_architecture_v10_smoke.py b/tests/pages_css_architecture_v10_smoke.py index 454736bbd..3061b55c2 100644 --- a/tests/pages_css_architecture_v10_smoke.py +++ b/tests/pages_css_architecture_v10_smoke.py @@ -57,15 +57,11 @@ def source_gate(): (HTML.parent / "assets" / n).read_text(encoding="utf-8")) if n else body for n, version, tag, body in css_order ) - # Historical V16-V19 reconstructors above already validate their - # immutable source ledgers byte-for-byte. The *other* CSS owners are the - # continuously maintained canonical files: summing their modern bytes and - # comparing with the pre-V20 global fingerprint rejects valid later CSS - # work rather than detecting a regression. - assert len(all_css)>sum(map(len,styles))>80000, "Missing owned CSS" + assert len(all_css) == EXPECTED_CSS_LENGTH, "CSS ownership source bytes missing" + assert fingerprint(all_css) == EXPECTED_FNV, "CSS cascade/content drift" assert sum(map(len, styles)) == EXPECTED_INLINE_LENGTH + assert all_css.count("!important") == 981 assert sum(body.count("!important") for body in styles) == 763 - assert all(n in names for n in expected) original = (HTML.parent / "assets" / OWNERS[0]).read_text(encoding="utf-8") grid = (HTML.parent / "assets" / OWNERS[1]).read_text(encoding="utf-8") artwork = (HTML.parent / "assets" / OWNERS[2]).read_text(encoding="utf-8") @@ -77,16 +73,10 @@ def source_gate(): assert "wireWsCanJoin" in live assert "assets/mixer-wire-dots.css?v=v47-css-v16" in html assert "assets/inter-embedded.css" in html - # Stage D intentionally uses an enumerated 18-owner compiler and ONE - # compiled CSS link. The Pages job delegates its proof to that compiler - # and the independent single-preview contract; neither duplicates all - # historical CSS filenames inside workflow YAML. - assembler=(ROOT/"scripts/build_pages.py").read_text(encoding="utf-8") - deploy=(ROOT/".github/workflows/pages-publish.yml").read_text(encoding="utf-8") - assert "canonical_html=compose_builtin_eq(canonical_html)" in assembler - assert "runtime_bundle=True" in assembler - assert "python scripts/build_pages.py --out dist-pages" in deploy - assert "python tests/single_preview_publication_contract_test.py dist-pages" in deploy + for p in (ROOT / "scripts/build_pages.py", ROOT / ".github/workflows/pages-publish.yml"): + source = p.read_text(encoding="utf-8") + for name in (*OWNERS, "mixer-wire-dots.css"): + assert name in source, (p.name, name, "missing Pages parity manifest") async def visual(page, width, height): errors = [] diff --git a/tests/preview_v2_v7_visual_smoke.py b/tests/preview_v2_v7_visual_smoke.py index 09f095a73..ec5ed850f 100644 --- a/tests/preview_v2_v7_visual_smoke.py +++ b/tests/preview_v2_v7_visual_smoke.py @@ -7,7 +7,7 @@ """ from __future__ import annotations from pathlib import Path -import subprocess, sys, re +import hashlib, json, subprocess, sys, re from playwright.sync_api import sync_playwright ROOT = Path(__file__).resolve().parents[1] @@ -298,13 +298,29 @@ def main(): assert PAGE.exists() and PUBLIC.exists(), (PAGE, PUBLIC) assembled=PUBLIC.read_text(encoding="utf-8") raw=PAGE.read_text(encoding="utf-8") + meta=json.loads((PUBLIC.parent/"build.json").read_text(encoding="utf-8")) + assert meta["kind"]=="APPROVED_SINGLE_GUI" + assert meta["wire_source_sha256"]==hashlib.sha256(raw.encode()).hexdigest() + # The approved assembler composes Channel EQ, a guarded rack header, + # an opt-in profiler and exactly ONE Stage D runtime CSS; this is no + # longer byte-identical to the raw internal historical source page. + cssmeta=meta["css_compilation"] + runtime=(PUBLIC.parent/"assets/arsonmix-approved-runtime.css").read_bytes() + digest=hashlib.sha256(runtime).hexdigest()[:16] + assert cssmeta["runtimeBundleCssSHA256"]==digest + assert cssmeta["runtimeStylesheetCount"]==1 + assert assembled.count("assets/arsonmix-approved-runtime.css?sha="+digest)==1 + assert "assets/mixer-wire-dots.css" in runtime.decode("utf-8") for asset in ("mixer-control-keys.css","mixer-control-keys.js"): - token="assets/"+asset - source_link=re.search(re.escape(token)+r'(?:\?[^"\s>]+)?',raw) - assert source_link,(asset,"source link missing") - assembled=re.sub(re.escape(token)+r'\?rev=[0-9a-f]{16}', - lambda _: source_link.group(0),assembled) - assert assembled==raw, "Public /preview/ must preserve every GUI interaction and differ only in approved PNG key URLs" + expected=hashlib.sha256( + (ROOT/"site/preview-buttons/assets"/asset).read_bytes()).hexdigest()[:16] + assert meta["button_css_js_revisions"][asset]==expected,asset + assert (PUBLIC.parent/"assets"/asset).read_bytes()==( + ROOT/"site/preview-buttons/assets"/asset).read_bytes(),asset + assert "arsonmix-approved-runtime.css" in assembled + # Independent single_preview_publication_contract_test.py already + # proves the entire assembled HTML, 18 compiled CSS owners and PNG + # bytes. This test retains real visual/workflow browser acceptance. assert 'http-equiv="refresh"' in (PUBLIC.parent/"mixer.html").read_text(encoding="utf-8") count = 0 with sync_playwright() as playwright: From 62d77ba59a681298d052965408e970969794c65e Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 17:54:09 +0700 Subject: [PATCH 41/48] test(gui): verify Stage D WIRE owner marker rather than nonexistent file URL --- tests/preview_v2_v7_visual_smoke.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/preview_v2_v7_visual_smoke.py b/tests/preview_v2_v7_visual_smoke.py index ec5ed850f..47c33ebfb 100644 --- a/tests/preview_v2_v7_visual_smoke.py +++ b/tests/preview_v2_v7_visual_smoke.py @@ -310,7 +310,7 @@ def main(): assert cssmeta["runtimeBundleCssSHA256"]==digest assert cssmeta["runtimeStylesheetCount"]==1 assert assembled.count("assets/arsonmix-approved-runtime.css?sha="+digest)==1 - assert "assets/mixer-wire-dots.css" in runtime.decode("utf-8") + assert b"BEGIN approved owner mixer-wire-dots.css" in runtime for asset in ("mixer-control-keys.css","mixer-control-keys.js"): expected=hashlib.sha256( (ROOT/"site/preview-buttons/assets"/asset).read_bytes()).hexdigest()[:16] From a6d225ac97575afa7265950a9729ffd2a19454f7 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 18:05:09 +0700 Subject: [PATCH 42/48] test(wire): share current single-preview CSS provenance across V43-V46 real-browser physics --- tests/pages_wire_incoming_v43_smoke.py | 31 ++++++++++++++++++++- tests/pages_wire_v44_finish_smoke.py | 7 ++--- tests/pages_wire_v45_socket_layout_smoke.py | 7 ++--- tests/pages_wire_v46_precision_smoke.py | 11 ++++---- 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/tests/pages_wire_incoming_v43_smoke.py b/tests/pages_wire_incoming_v43_smoke.py index 05ad30d34..b5aa95574 100644 --- a/tests/pages_wire_incoming_v43_smoke.py +++ b/tests/pages_wire_incoming_v43_smoke.py @@ -1,13 +1,42 @@ #!/usr/bin/env python3 """V43: generated public /preview/ parity, persistent incoming cables, and physical socket impact.""" from pathlib import Path -import json,math,re,subprocess,sys,tempfile +import hashlib,json,math,re,subprocess,sys,tempfile from playwright.sync_api import sync_playwright ROOT=Path(__file__).resolve().parents[1] CANONICAL=ROOT/"site/preview-v2/index.html" WIRE_CSS=ROOT/"site/preview-v2/assets/mixer-wire-dots.css" + +def verify_approved_wire_bundle(dist, *, extra_owners=()): + """Prove one public /preview/ with the approved WIRE owners. + + The assembler legitimately adds EQ, PNG keys, rack controls, a profiler, + and one Stage D runtime CSS. Internal historical HTML is not public HTML. + The separate single-preview contract checks complete source-derived bytes. + """ + public=dist/"preview/index.html" + html=public.read_text("utf-8") + meta=json.loads((dist/"preview/build.json").read_text("utf-8")) + assert meta["kind"]=="APPROVED_SINGLE_GUI" and meta["live_audio"] is False + assert meta["wire_source_sha256"]==hashlib.sha256( + (ROOT/"site/preview-v2/index.html").read_bytes()).hexdigest() + assert "0 and r["height"]>0,r diff --git a/tests/pages_wire_v44_finish_smoke.py b/tests/pages_wire_v44_finish_smoke.py index b06887855..d6314faa6 100644 --- a/tests/pages_wire_v44_finish_smoke.py +++ b/tests/pages_wire_v44_finish_smoke.py @@ -3,7 +3,7 @@ from pathlib import Path import subprocess,sys,tempfile from playwright.sync_api import sync_playwright -from pages_wire_incoming_v43_smoke import center, impact_peak +from pages_wire_incoming_v43_smoke import center, impact_peak, verify_approved_wire_bundle ROOT=Path(__file__).resolve().parents[1] SRC=ROOT/"site/preview-v2/index.html" @@ -20,10 +20,7 @@ def main(): subprocess.run([sys.executable,str(ROOT/"scripts/build_pages.py"), "--out",str(dst),"--sha","v44-ui-smoke","--branch","gui-v44"], cwd=ROOT,capture_output=True,text=True,check=True) - public=dst/"preview/mixer.html" - assert public.read_bytes()==SRC.read_bytes(),"published /preview/ differs from canonical GUI" - assert (dst/"preview/assets/mixer-wire-dots.css").read_bytes()==CSS.read_bytes(),"published WIRE style missing" - assert 'assets/mixer-wire-dots.css?v=v59-selected-wire-quiet' in public.read_text("utf-8") + public=verify_approved_wire_bundle(dst) with sync_playwright() as pw: browser=pw.chromium.launch(headless=True) for width in (1366,1680): diff --git a/tests/pages_wire_v45_socket_layout_smoke.py b/tests/pages_wire_v45_socket_layout_smoke.py index 9c5f2773c..9ad666e11 100644 --- a/tests/pages_wire_v45_socket_layout_smoke.py +++ b/tests/pages_wire_v45_socket_layout_smoke.py @@ -6,7 +6,7 @@ from pathlib import Path import subprocess,sys,tempfile from playwright.sync_api import sync_playwright -from pages_wire_incoming_v43_smoke import center +from pages_wire_incoming_v43_smoke import center, verify_approved_wire_bundle ROOT=Path(__file__).resolve().parents[1] HTML=ROOT/"site/preview-v2/index.html" @@ -61,10 +61,7 @@ def main(): subprocess.run([sys.executable,str(ROOT/"scripts/build_pages.py"), "--out",str(dist),"--sha","v45-browser","--branch","v45"], cwd=ROOT,capture_output=True,text=True,check=True) - public=dist/"preview/mixer.html" - assert public.read_bytes()==HTML.read_bytes(),"Pages did not publish canonical V45 console" - assert (dist/"preview/assets/mixer-wire-dots.css").read_bytes()==STYLE.read_bytes(),"Pages lost WIRE CSS" - assert "assets/mixer-wire-dots.css?v=v59-selected-wire-quiet" in public.read_text("utf-8") + public=verify_approved_wire_bundle(dist) with sync_playwright() as pw: browser=pw.chromium.launch(headless=True) for width in (1366,1680,1920): diff --git a/tests/pages_wire_v46_precision_smoke.py b/tests/pages_wire_v46_precision_smoke.py index 95a8f1e0d..3415e80b1 100644 --- a/tests/pages_wire_v46_precision_smoke.py +++ b/tests/pages_wire_v46_precision_smoke.py @@ -10,6 +10,7 @@ from pathlib import Path from playwright.sync_api import sync_playwright +from pages_wire_incoming_v43_smoke import verify_approved_wire_bundle ROOT=Path(__file__).resolve().parents[1] HTML=ROOT/"site/preview-v2/index.html" @@ -49,12 +50,10 @@ def main(): subprocess.run([sys.executable,str(ROOT/"scripts/build_pages.py"), "--out",str(dist),"--sha","v46-dot-anchors","--branch","v46"], cwd=ROOT,capture_output=True,text=True,check=True) - public=dist/"preview/mixer.html" - assert public.read_bytes()==HTML.read_bytes(),"published /preview/ HTML is stale" - assert (dist/"preview/assets/mixer-wire-dots.css").read_bytes()==CSS.read_bytes(),"public WIRE CSS differs" - assert "assets/mixer-wire-dots.css?v=v59-selected-wire-quiet" in public.read_text("utf-8") - assert (dist/"preview/assets/mixer-wire-out-align-v48.css").read_bytes()==(ROOT/"site/preview-v2/assets/mixer-wire-out-align-v48.css").read_bytes(), "V48 alignment stylesheet missing from /preview/" - assert "assets/mixer-wire-out-align-v48.css?v=out-center-v48" in public.read_text("utf-8") + # Stage C can prune redundant alignment declarations. Verify the compiled + # alignment owner and runtime digest, then exercise actual dot geometry. + public=verify_approved_wire_bundle( + dist,extra_owners=("mixer-wire-out-align-v48.css",)) with sync_playwright() as pw: browser=pw.chromium.launch(headless=True) From b3c78e04c0e6601a9950d124f36098b6350b2f7f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 19:27:33 +0700 Subject: [PATCH 43/48] Restore DAW UX: Parametric EQ picker inserts rack; click opens movable editor and add browser regression --- .github/workflows/ui-smoke.yml | 2 + scripts/compose_builtin_eq.py | 38 +++++++---- site/preview-v2/assets/mixer-builtin-eq.js | 61 ++++++++++++----- site/preview-v2/assets/mixer-fx-rack.css | 7 +- tests/approved_builtin_peq_picker_smoke.py | 78 ++++++++++++++++++++++ tests/builtin_eq_interaction_test.mjs | 18 ++++- 6 files changed, 168 insertions(+), 36 deletions(-) create mode 100644 tests/approved_builtin_peq_picker_smoke.py diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index a64e1151d..a6b7c6b92 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -183,6 +183,8 @@ jobs: run: python tests/approved_preview_mobile_navigation_smoke.py - name: FX rack master bypass preserves each insert state (real Chromium) run: python tests/approved_fx_rack_master_power_smoke.py + - name: Parametric EQ picker to rack and draggable editor (real Chromium) + run: python tests/approved_builtin_peq_picker_smoke.py - name: Stage D one runtime CSSOM and actual stylesheet network count run: python tests/approved_css_stage_d_single_bundle_smoke.py - name: Stage C rendered CSS parity (original vs compiled, three viewports + hover) diff --git a/scripts/compose_builtin_eq.py b/scripts/compose_builtin_eq.py index fbb8e093d..ecad683d1 100644 --- a/scripts/compose_builtin_eq.py +++ b/scripts/compose_builtin_eq.py @@ -4,9 +4,6 @@ This P0 adapter composes the fixed PRE-VST3 native EQ into the existing rack. """ SCRIPT = '' -HEADER_BEFORE = '')+'':''; +PICKER_HELPER_START = 'function renderFastPicker(){' +PICKER_HELPER = """function insertChosenBuiltinEq(){ + const track=tracks.concat(master).find(x=>x.id===activeFxTarget?.channelId); + if(!track||track.kind==='master'||!window.ArSonMixBuiltinEq?.insert(track)){ + say('Parametric EQ insert rejected · no accepted channel or already installed'); + return false; + } + setFastPicker(false); + say(track.name+' · Parametric EQ requested for FX Rack · click rack row to edit'); + return true; +} +function renderFastPicker(){""" +RACK_COUNT = "FX '+used.length+'" +RACK_COUNT_HOOK = "FX '+(used.length+(window.ArSonMixBuiltinEq?.installed?.(t)?1:0))+'" +PICKER_HOOK = """ const builtin=(!q||['parametric eq','peq','channel eq','built-in fx'].some(name=>name.includes(q)))? + '
BUILT-IN FX
':''; plugEl('fastResults').innerHTML=builtin+'
VST3 PLUGINS
'+(list.length?list.map(p=>""" PICKER_END = """).join(''):'
No matching effects
';""" PICKER_END_HOOK = """).join(''):'
No matching effects
');""" PICKER_CLICK = " const btn=e.target.closest('[data-fast-id]');if(btn)insertCatalogPlugin(btn.dataset.fastId);" PICKER_CLICK_HOOK = """ const eq=e.target.closest('[data-fast-builtin-eq]'); - if(eq){ - const t=tracks.concat(master).find(x=>x.id===activeFxTarget?.channelId); - if(t)window.ArSonMixBuiltinEq?.insert(t); - setFastPicker(false);return; - } + if(eq){insertChosenBuiltinEq();return;} const btn=e.target.closest('[data-fast-id]');if(btn)insertCatalogPlugin(btn.dataset.fastId);""" +PICKER_ENTER = "if(b){e.preventDefault();insertCatalogPlugin(b.dataset.fastId);}" +PICKER_ENTER_HOOK = "if(b){e.preventDefault();if(b.hasAttribute('data-fast-builtin-eq'))insertChosenBuiltinEq();else insertCatalogPlugin(b.dataset.fastId);}" def compose_builtin_eq(source: str) -> str: - anchors=(HEADER_BEFORE,CLICK_BEFORE,RACK_START,RACK_ROWS, - PICKER_START,PICKER_END,PICKER_CLICK) + anchors=(CLICK_BEFORE,RACK_START,RACK_ROWS,RACK_COUNT,PICKER_HELPER_START, + PICKER_START,PICKER_END,PICKER_CLICK,PICKER_ENTER) if source.count('')!=1 or SCRIPT in source or 'openBuiltinEq' in source: raise ValueError('Built-in EQ expects pristine approved HTML seed') if any(source.count(a)!=1 for a in anchors): raise ValueError('Built-in EQ requires exactly one canonical rack/picker owner') return (source.replace('',SCRIPT+'\n',1) - .replace(HEADER_BEFORE,HEADER_AFTER,1) .replace(RACK_START,RACK_HOOK,1) .replace(RACK_ROWS,RACK_ROWS_HOOK,1) + .replace(RACK_COUNT,RACK_COUNT_HOOK,1) + .replace(PICKER_HELPER_START,PICKER_HELPER,1) .replace(PICKER_START,PICKER_HOOK,1) .replace(PICKER_END,PICKER_END_HOOK,1) .replace(PICKER_CLICK,PICKER_CLICK_HOOK,1) + .replace(PICKER_ENTER,PICKER_ENTER_HOOK,1) .replace(CLICK_BEFORE,CLICK_AFTER+'\n'+CLICK_BEFORE,1)) diff --git a/site/preview-v2/assets/mixer-builtin-eq.js b/site/preview-v2/assets/mixer-builtin-eq.js index 337f7fff5..c0c153f34 100644 --- a/site/preview-v2/assets/mixer-builtin-eq.js +++ b/site/preview-v2/assets/mixer-builtin-eq.js @@ -1,4 +1,4 @@ -/* ArSonMix Built-in Channel EQ: small operator overlay in the ONLY /preview/. +/* ArSonMix Built-in Parametric EQ: small operator overlay in the ONLY /preview/. * Browser renders RESPONSE FROM ACCEPTED PARAMETERS, never audio/FFT/WebAudio. * Static Pages is explicitly a visual DESIGN DEMO. Native uses ACK + LATER * authoritative snapshot; browser drafts never enter the mixer graph. */ @@ -18,8 +18,8 @@ const isCut=i=>i===0||i===7; const gainEnabled=i=>i!==0&&i!==7; const mk=(tag,cl,text)=>{const el=document.createElement(tag);if(cl)el.className=cl;if(text!==undefined)el.textContent=text;return el;}; - const root=mk('section');root.id='mxBuiltinEq';root.hidden=true;root.setAttribute('role','dialog');root.setAttribute('aria-modal','false');root.setAttribute('aria-label','Built-in channel equalizer'); - const head=mk('header','mx-eq-top'),mark=mk('i','mx-eq-mark'),brand=mk('strong','', 'ArSonMix · Channel EQ'); + const root=mk('section');root.id='mxBuiltinEq';root.hidden=true;root.setAttribute('role','dialog');root.setAttribute('aria-modal','false');root.setAttribute('aria-label','Built-in parametric equalizer'); + const head=mk('header','mx-eq-top'),mark=mk('i','mx-eq-mark'),brand=mk('strong','', 'ArSonMix · Parametric EQ'); const channelLabel=mk('span','mx-eq-channel'),spacer=mk('span','mx-eq-spacer'),mode=mk('span','mx-eq-mode'); const close=mk('button','mx-eq-close','×');close.type='button';close.title='Close channel EQ';head.append(mark,brand,channelLabel,spacer,mode,close); const workspace=mk('div','mx-eq-workspace'); @@ -35,6 +35,27 @@ workspace.append(graph,rail,controls,footer);root.append(head,workspace); const attach=()=>{if(!root.isConnected)document.body.append(root);}; if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',attach,{once:true});else attach(); + // Real modeless title-bar dragging, isolated from frequency-node gestures. + let windowGesture=null; + const stopDrag=e=>{ + if(!windowGesture||windowGesture.id!==e.pointerId)return; + windowGesture=null;head.releasePointerCapture?.(e.pointerId); + }; + head.addEventListener('pointerdown',e=>{ + if(e.button!==0||e.target.closest?.('button'))return; + const r=root.getBoundingClientRect(); + windowGesture={id:e.pointerId,offsetX:e.clientX-r.left,offsetY:e.clientY-r.top}; + head.setPointerCapture?.(e.pointerId);e.preventDefault(); + }); + head.addEventListener('pointermove',e=>{ + if(!windowGesture||e.pointerId!==windowGesture.id)return; + const r=root.getBoundingClientRect(); + root.style.left=clamp(e.clientX-windowGesture.offsetX,0,Math.max(0,(window.innerWidth||1024)-r.width))+'px'; + root.style.top=clamp(e.clientY-windowGesture.offsetY,0,Math.max(0,(window.innerHeight||768)-r.height))+'px'; + root.style.transform='none';e.preventDefault(); + }); + head.addEventListener('pointerup',stopDrag); + head.addEventListener('pointercancel',stopDrag); const ctx=canvas.getContext('2d',{alpha:false}); let current=null,channelId=null,epoch=null,revision=null,bands=empty(),slot=2,sampleRate=48000; let pending=null,waitingAck=false,snapshotReady=false,reqSeq=1,activeGesture=null,demonstration=true; @@ -50,6 +71,7 @@ const accepted=nativeStates.get(id);return sameGraph(accepted,n)?accepted:null; }; const refresh=t=>window.__ARMIX_BUILTIN_EQ_REFRESH__?.(t?.id); + const notify=message=>window.__ARMIX_BUILTIN_EQ_NOTIFY__?.(message); const safeName=t=>String(t?.name||'Channel').replace(/[&<>"']/g,c=>({ '&':'&','<':'<','>':'>','"':'"',"'":''' })[c]); @@ -220,8 +242,8 @@ s.graph.channels.some(ch=>ch.id===channelId); if(!accepted){mode.textContent='NATIVE · ROUTE CHANGED';resetNative();} }); - backend.addEventListener('arMixBuiltinEqQueue',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='REJECTED'){pending=null;setStatus('NATIVE: EDIT REJECTED; STATE UNCHANGED','warn');render();}else setStatus('QUEUED · WAITING FOR DSP APPLY ACK','warn');}); - backend.addEventListener('arMixBuiltinEqAck',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='APPLIED'&&r.deviceEpoch===pending.epoch&&r.graphRevision===pending.revision){waitingAck=true;setStatus('DSP APPLIED · AWAITING ACCEPTED READBACK','warn');}else {pending=null;waitingAck=false;setStatus('NATIVE: NOT APPLIED; STATE UNCHANGED','warn');render();}}); + backend.addEventListener('arMixBuiltinEqQueue',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='REJECTED'){const t=current;pending=null;setStatus('NATIVE: EQ REJECTED; STATE UNCHANGED','warn');notify('Parametric EQ insert/edit rejected by native engine');refresh(t);render();}else setStatus('QUEUED · WAITING FOR DSP APPLY ACK','warn');}); + backend.addEventListener('arMixBuiltinEqAck',r=>{if(!pending||r?.requestId!==pending.id||r.channelId!==channelId)return;if(r.status==='APPLIED'&&r.deviceEpoch===pending.epoch&&r.graphRevision===pending.revision){waitingAck=true;setStatus('DSP APPLIED · AWAITING ACCEPTED READBACK','warn');}else {const t=current;pending=null;waitingAck=false;setStatus('NATIVE: NOT APPLIED; STATE UNCHANGED','warn');notify('Parametric EQ change not applied');refresh(t);render();}}); backend.addEventListener('arMixBuiltinEqSnapshot',s=>{ const n=nativeRoute()?.state?.(); const validIdentity=s?.schemaVersion===1&& @@ -266,35 +288,42 @@ current=track;channelId=id;epoch=n.device.epoch;revision=n.graph.revision; snapshotReady=false; const requestId=nextRequestId(); - pending={id:requestId,channelId:id,epoch,revision,slot:-1,kind:'gate'}; + pending={id:requestId,channelId:id,epoch,revision,slot:-1,kind:'gate',trackId:track.id,installRequested:installed}; waitingAck=false; setStatus('NATIVE · GATE QUEUED · WAITING FOR AUDIO ACK','warn'); nativeBackend().emitEvent('arMixAction',{action:'builtinEqSetGate',channelId:id, deviceEpoch:epoch,graphRevision:revision,requestId,installed,bypassed}); - render();return true; + refresh(track);render();return true; }; window.ArSonMixBuiltinEq=Object.freeze({ + installed(track){return Boolean(stateFor(track)?.installed||(pending?.kind==='gate'&&pending.installRequested&&pending.trackId===track?.id));}, slotMarkup(track,materialIcon){ - const st=stateFor(track);if(!st?.installed)return ''; + const st=stateFor(track); + const installing=!st?.installed&&pending?.kind==='gate'&&pending.installRequested&&pending.trackId===track?.id; + if(!st?.installed&&!installing)return ''; + if(installing)return '
Parametric EQ · APPLYING…
'; const enabled=track.fxOn!==false&&!st.bypassed; const power=materialIcon?.('power_settings_new')||'⏻'; const remove=materialIcon?.('delete_forever')||'×'; const label=safeName(track); return '
'+ + '" title="Native Parametric EQ · PRE VST3">'+ ''+ - ''+ + ''+ '
'; + 'title="Remove built-in EQ" aria-label="Remove Parametric EQ">'+remove+'
'; }, insert(track){ - if(!track||track.kind==='master')return; - this.open(track); - if(!setGate(track,true,false))setStatus('NATIVE · EQ INSERT REJECTED','warn'); + if(!track||track.kind==='master'||this.installed(track))return false; + // Selecting in the picker ONLY inserts. Clicking the accepted rack row + // is the sole editor-opening action (DAW-style modeless FX workflow). + const accepted=setGate(track,true,false); + if(!accepted)notify('Parametric EQ insert rejected · channel unchanged'); + return accepted; }, power(track){const st=stateFor(track);if(st?.installed)setGate(track,true,!st.bypassed);}, remove(track){const st=stateFor(track);if(st?.installed)setGate(track,false,false);}, diff --git a/site/preview-v2/assets/mixer-fx-rack.css b/site/preview-v2/assets/mixer-fx-rack.css index fc7542505..c2cb4cd5f 100644 --- a/site/preview-v2/assets/mixer-fx-rack.css +++ b/site/preview-v2/assets/mixer-fx-rack.css @@ -173,13 +173,11 @@ /* ArSonMix: one optional BUILT-IN CHANNEL EQ overlay, never a second mixer. * Material palette is scoped and derived from the approved /preview/ hardware * chassis and FX glass. All sizes are compact, no blur/spectrum GPU loop. */ -.mx-eq-open{height:17px;min-width:30px;padding:0 5px;border:1px solid #56717b;border-radius:2px;background:linear-gradient(#3e555f,#283c46);color:#bce0e8;font:600 9px/15px "Segoe UI",Arial,sans-serif;letter-spacing:.3px;cursor:pointer} -.mx-eq-open:hover{border-color:#77afbd;color:#e7fcff}.mx-eq-open:focus-visible{outline:2px solid #9bd9e8;outline-offset:1px} #mxBuiltinEq[hidden]{display:none!important} -#mxBuiltinEq{--eq-cyan:#60c8df;--eq-ink:#d9e7ed;--eq-mute:#93a5af;position:fixed;z-index:90;left:50%;top:50%;transform:translate(-50%,-50%);width:min(770px,calc(100vw - 18px));height:min(465px,calc(100dvh - 18px));min-width:0;min-height:325px;display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box;border:1px solid #566a78;border-radius:6px;background:#18232c;color:var(--eq-ink);box-shadow:0 14px 40px #000c,0 0 0 1px #0a151a,inset 0 1px #73838e;font:11px/1.25 "Segoe UI",Arial,sans-serif} +#mxBuiltinEq{--eq-cyan:#60c8df;--eq-ink:#d9e7ed;--eq-mute:#93a5af;position:fixed;z-index:120;left:50%;top:50%;transform:translate(-50%,-50%);width:min(770px,calc(100vw - 18px));height:min(465px,calc(100dvh - 18px));min-width:0;min-height:325px;display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box;border:1px solid #566a78;border-radius:6px;background:#18232c;color:var(--eq-ink);box-shadow:0 14px 40px #000c,0 0 0 1px #0a151a,inset 0 1px #73838e;font:11px/1.25 "Segoe UI",Arial,sans-serif} #mxBuiltinEq button,#mxBuiltinEq input,#mxBuiltinEq select{font:inherit}#mxBuiltinEq button{cursor:pointer}#mxBuiltinEq button:disabled,#mxBuiltinEq input:disabled,#mxBuiltinEq select:disabled{opacity:.55;cursor:default} #mxBuiltinEq button:focus-visible,#mxBuiltinEq input:focus-visible,#mxBuiltinEq select:focus-visible{outline:2px solid #85d1e6;outline-offset:1px} -.mx-eq-top{height:30px;flex:0 0 30px;display:flex;align-items:center;gap:10px;padding:0 10px;background:linear-gradient(#575d62,#393f46 54%,#292f35 54%,#333c44);border-bottom:1px solid #101820;box-shadow:inset 0 1px #92999d} +.mx-eq-top{cursor:move;touch-action:none;user-select:none;height:30px;flex:0 0 30px;display:flex;align-items:center;gap:10px;padding:0 10px;background:linear-gradient(#575d62,#393f46 54%,#292f35 54%,#333c44);border-bottom:1px solid #101820;box-shadow:inset 0 1px #92999d} .mx-eq-top .mx-eq-mark{width:4px;height:14px;background:#5fc6da}.mx-eq-top strong{font-size:12px;font-weight:600;letter-spacing:.3px;color:#eff4f6}.mx-eq-top .mx-eq-channel{color:#b9c9d0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px} .mx-eq-top .mx-eq-spacer{flex:1}.mx-eq-top .mx-eq-mode{font:9px/1 Consolas,monospace;color:#aad3df;white-space:nowrap}.mx-eq-close{border:1px solid #1a3039;border-radius:2px;background:linear-gradient(#64737e,#394c58);color:#f3f8fa;height:22px;width:25px;font:16px/19px Arial!important;padding:0} .mx-eq-workspace{flex:1;min-height:0;display:flex;flex-direction:column;background:#101a22} @@ -209,3 +207,4 @@ .fxslot-row.is-builtin .fx-pick{color:#c3ecf1} .fxslot-row.is-builtin .fx-pick small{font:8px/1 Consolas,monospace;letter-spacing:.25px;color:#86a7b4;margin-left:5px} .fxslot-row.is-builtin.is-bypassed .fx-pick{color:#8b9aa3} +.fxslot-row.is-builtin.is-pending .fx-pick{color:#b7a67f;cursor:progress;font-size:10px} diff --git a/tests/approved_builtin_peq_picker_smoke.py b/tests/approved_builtin_peq_picker_smoke.py new file mode 100644 index 000000000..6ee15f4ae --- /dev/null +++ b/tests/approved_builtin_peq_picker_smoke.py @@ -0,0 +1,78 @@ +"""Real pointer/keyboard contract for single approved /preview/ FX picker and Parametric EQ. +Browser-only visual demo is not audible PCM or hardware FAT. +""" +from pathlib import Path +from playwright.sync_api import sync_playwright + +PAGE=Path(__file__).resolve().parents[1]/"dist-pages/preview/index.html" + +def main(): + assert PAGE.is_file(), "Build approved /preview/ first" + with sync_playwright() as pw: + browser=pw.chromium.launch(headless=True) + try: + for width,height in [(390,844),(1366,768),(1680,900)]: + page=browser.new_page(viewport={"width":width,"height":height}) + errors=[] + page.on("pageerror", lambda e: errors.append(str(e))) + page.goto(PAGE.as_uri()) + strip=page.locator('#tracks .strip[data-id="1"]') + strip.wait_for() + assert page.locator('#mxBuiltinEq').is_hidden() + strip.locator('.fx-pick.empty').click() + picker=page.locator('#fastPicker') + assert picker.is_visible() + choice=page.locator('#fastResults [data-fast-builtin-eq]') + assert choice.count()==1 and "Parametric EQ" in choice.inner_text() + choice.click() + assert picker.is_hidden() + editor=page.locator('#mxBuiltinEq') + assert editor.is_hidden(), "Selecting a plugin cannot auto-open the editor" + row=strip.locator('.fxslot-row.is-builtin') + assert row.count()==1 and "Parametric EQ" in row.inner_text() + assert row.get_attribute('data-fx-effective')=="true" + assert "FX 2" in strip.locator('.fx-section .hint').inner_text() + row.locator('[data-action="openBuiltinEq"]').click() + assert editor.is_visible() + assert editor.locator('.mx-eq-mode').inner_text()=="UI DEMO · NO AUDIO" + title=editor.locator('.mx-eq-top') + rect=editor.bounding_box() + bar=title.bounding_box() + assert rect and bar + x=bar["x"]+min(110,bar["width"]/3) + y=bar["y"]+bar["height"]/2 + page.mouse.move(x,y) + page.mouse.down() + page.mouse.move(x+37,y+23,steps=5) + page.mouse.up() + moved=editor.bounding_box() + assert moved and moved["x"]>=rect["x"]+23 and moved["y"]>=rect["y"]+13,(rect,moved) + band=editor.locator('.mx-eq-band[data-slot="3"]') + band.click() + assert "selected" in band.get_attribute("class") + editor.locator('.mx-eq-switch').click() + assert editor.locator('.mx-eq-switch').get_attribute('aria-pressed')=="true" + freq=editor.get_by_label('FREQUENCY · Hz') + freq.fill("735") + freq.press("Tab") + assert freq.input_value()=="735" + gain=editor.get_by_label('GAIN · dB') + gain.fill("4.0") + gain.press("Tab") + assert gain.input_value()=="4.0" + editor.locator('.mx-eq-close').click() + assert editor.is_hidden() + row.locator('[data-action="openBuiltinEq"]').click() + assert editor.is_visible() + assert editor.get_by_label('FREQUENCY · Hz').input_value()=="735" + editor.locator('.mx-eq-close').click() + row.locator('[data-action="builtinEqRemove"]').click() + assert strip.locator('.fxslot-row.is-builtin').count()==0 + assert not errors, errors + print("PASS Parametric EQ pick/insert/open/drag/edit/reopen/remove",width,height) + page.close() + finally: + browser.close() + +if __name__=="__main__": + main() diff --git a/tests/builtin_eq_interaction_test.mjs b/tests/builtin_eq_interaction_test.mjs index 046225089..eb05e2b40 100644 --- a/tests/builtin_eq_interaction_test.mjs +++ b/tests/builtin_eq_interaction_test.mjs @@ -96,6 +96,13 @@ const lastAction=h=>h.sent.filter(x=>x.name==='arMixAction').at(-1)?.payload; const h=start(false); h.window.ArSonMixBuiltinEq.open({id:42,name:'Vocal',kind:'audio'}); h.find('.mx-eq-switch').fire('click'); + const title=h.find('.mx-eq-top'); + title.fire('pointerdown',{pointerId:11,clientX:250,clientY:160}); + title.fire('pointermove',{pointerId:11,clientX:290,clientY:195}); + title.fire('pointerup',{pointerId:11}); + assert.equal(h.dialog.style.transform,'none'); + assert.equal(h.dialog.style.left,'40px'); + assert.equal(h.dialog.style.top,'35px'); assert.equal(h.sent.length,0,'Static Pages EQ must never issue a PCM command'); assert.match(h.find('.mx-eq-status').textContent,/NO AUDIO/); } @@ -151,7 +158,10 @@ const lastAction=h=>h.sent.filter(x=>x.name==='arMixAction').at(-1)?.payload; } { const h=start(true),t={id:42,name:'Mic 1',kind:'audio'}; - h.window.ArSonMixBuiltinEq.insert(t); + const installed=h.window.ArSonMixBuiltinEq.insert(t); + assert.equal(installed,true); + assert.equal(h.dialog.hidden,true,'Picker insert does not open a blocking editor'); + assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),/APPLYING/); const add=lastAction(h); assert.equal(add.action,'builtinEqSetGate'); assert.equal(add.installed,true); @@ -163,7 +173,9 @@ const lastAction=h=>h.sent.filter(x=>x.name==='arMixAction').at(-1)?.payload; assert.equal(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),'', 'AUDIO ACK without later snapshot does not paint an insert'); h.fire('arMixBuiltinEqSnapshot',snapshot('9','3',add.requestId)); - assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),/Channel EQ/); + assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),/Parametric EQ/); + h.window.ArSonMixBuiltinEq.open(t); + assert.equal(h.dialog.hidden,false,'Clicking accepted rack row opens editor'); h.window.ArSonMixBuiltinEq.power(t); const bypass=lastAction(h); assert.equal(bypass.action,'builtinEqSetGate');assert.equal(bypass.bypassed,true); @@ -189,7 +201,7 @@ const lastAction=h=>h.sent.filter(x=>x.name==='arMixAction').at(-1)?.payload; assert.equal(lastAction(h)?.action,'builtinEqSnapshot', 'Accepted graph must requery exact ChannelId EQ readback'); h.fire('arMixBuiltinEqSnapshot',snapshot('9','3','0',defaults(),true,false)); - assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(track,()=>''),/Channel EQ/, + assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(track,()=>''),/Parametric EQ/, 'Unopened editor still restores authoritative rack presence'); assert.ok(paints>0); h.session('10','4'); From 841ff28290c09cc30efd9e7446fda0253a670739 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 19:29:02 +0700 Subject: [PATCH 44/48] Update built-in EQ contract to enforce rack-only editor launch and keyboard picker --- tests/builtin_eq_gui_contract_test.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/builtin_eq_gui_contract_test.mjs b/tests/builtin_eq_gui_contract_test.mjs index 82fc5e1d6..bcad698fe 100644 --- a/tests/builtin_eq_gui_contract_test.mjs +++ b/tests/builtin_eq_gui_contract_test.mjs @@ -11,7 +11,10 @@ const native=fs.readFileSync('web/approved-native-bridge.js','utf8'); assert.ok(assembler.includes('compose_builtin_eq(canonical_html)')); assert.ok(component.includes('assets/mixer-builtin-eq.js')); assert.ok(!html.includes('assets/mixer-builtin-eq.js'), 'V28 source HTML stays byte-frozen'); -assert.ok(component.includes('data-action="openBuiltinEq"')); +assert.ok(js.includes('data-action="openBuiltinEq"'), 'Only the rack insert opens editor'); +assert.ok(!component.includes('mx-eq-open'), 'No redundant header EQ popup launcher'); +assert.ok(component.includes('insertChosenBuiltinEq') && + component.includes('PICKER_ENTER_HOOK'), 'Picker click and Enter use same insert workflow'); assert.ok(component.includes('BUILT-IN FX')&&component.includes('VST3 PLUGINS')); assert.ok(component.includes('RACK_ROWS_HOOK')&&component.includes('PICKER_CLICK_HOOK')); assert.ok(js.includes('slotMarkup(track')&&js.includes('builtinEqSetGate')); @@ -48,7 +51,7 @@ const eqBank=fs.readFileSync('engine/builtin_fx/ChannelEqBank.h','utf8'); assert.ok(eqBank.includes('rackBypassed_[lane].load')&& eqBank.includes('insertBypassed_[lane]||rackOff'), 'FX header OFF must override native EQ PCM without losing insert preference'); -console.log('Built-in Channel EQ GUI contract: PASS (isolated from VST3 and alt mixer)'); +console.log('Built-in Parametric EQ DAW GUI contract: PASS (isolated from VST3 and alt mixer)'); assert.ok(!html.includes('assets/mixer-builtin-eq.css'), 'No second CSS cascade owner'); From beee281b96c301a7ac9abe1dcfb4cf1c7b8c0069 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 19:30:52 +0700 Subject: [PATCH 45/48] Assert native EQ provisional status until readback and clamp-aware mobile editor drag --- tests/approved_builtin_peq_picker_smoke.py | 2 +- tests/builtin_eq_interaction_test.mjs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/approved_builtin_peq_picker_smoke.py b/tests/approved_builtin_peq_picker_smoke.py index 6ee15f4ae..4cacdfa31 100644 --- a/tests/approved_builtin_peq_picker_smoke.py +++ b/tests/approved_builtin_peq_picker_smoke.py @@ -46,7 +46,7 @@ def main(): page.mouse.move(x+37,y+23,steps=5) page.mouse.up() moved=editor.bounding_box() - assert moved and moved["x"]>=rect["x"]+23 and moved["y"]>=rect["y"]+13,(rect,moved) + assert moved and moved["x"]>=rect["x"]+(3 if width < 760 else 23) and moved["y"]>=rect["y"]+13,(rect,moved) band=editor.locator('.mx-eq-band[data-slot="3"]') band.click() assert "selected" in band.get_attribute("class") diff --git a/tests/builtin_eq_interaction_test.mjs b/tests/builtin_eq_interaction_test.mjs index eb05e2b40..8d5db559f 100644 --- a/tests/builtin_eq_interaction_test.mjs +++ b/tests/builtin_eq_interaction_test.mjs @@ -165,13 +165,13 @@ const lastAction=h=>h.sent.filter(x=>x.name==='arMixAction').at(-1)?.payload; const add=lastAction(h); assert.equal(add.action,'builtinEqSetGate'); assert.equal(add.installed,true); - assert.equal(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),'', - 'No optimistic FX insert before AUDIO ACK'); + assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),/data-builtin-eq="pending"/, + 'Provisional label only, never claim accepted native FX before AUDIO ACK'); h.fire('arMixBuiltinEqQueue',{requestId:add.requestId,channelId:'101',status:'QUEUED'}); h.fire('arMixBuiltinEqAck',{requestId:add.requestId,channelId:'101', deviceEpoch:'9',graphRevision:'3',status:'APPLIED'}); - assert.equal(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),'', - 'AUDIO ACK without later snapshot does not paint an insert'); + assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),/data-builtin-eq="pending"/, + 'AUDIO ACK alone must retain provisional row until producer snapshot'); h.fire('arMixBuiltinEqSnapshot',snapshot('9','3',add.requestId)); assert.match(h.window.ArSonMixBuiltinEq.slotMarkup(t,()=>''),/Parametric EQ/); h.window.ArSonMixBuiltinEq.open(t); From 3de55de105f3782fe4a1f18b8c8312a757db6fa2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 19:32:50 +0700 Subject: [PATCH 46/48] Fix headless native Parametric EQ insertion: preserve accepted ACK/readback before editor opens --- site/preview-v2/assets/mixer-builtin-eq.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/preview-v2/assets/mixer-builtin-eq.js b/site/preview-v2/assets/mixer-builtin-eq.js index c0c153f34..245d6927b 100644 --- a/site/preview-v2/assets/mixer-builtin-eq.js +++ b/site/preview-v2/assets/mixer-builtin-eq.js @@ -58,7 +58,8 @@ head.addEventListener('pointercancel',stopDrag); const ctx=canvas.getContext('2d',{alpha:false}); let current=null,channelId=null,epoch=null,revision=null,bands=empty(),slot=2,sampleRate=48000; - let pending=null,waitingAck=false,snapshotReady=false,reqSeq=1,activeGesture=null,demonstration=true; + let pending=null,waitingAck=false,snapshotReady=false,reqSeq=1,activeGesture=null, + demonstration=!Boolean(window.__JUCE__?.backend); // native readback works even before editor opened const nativeBackend=()=>window.__JUCE__?.backend; const nativeRoute=()=>window.__ARMIX_BUILTIN_EQ_CHANNEL__; const demoStates=new Map(),nativeStates=new Map(); @@ -282,6 +283,7 @@ if(current?.id===track.id)bands=demoStates.get(track.id).bands.map(b=>({...b})); setStatus('DESIGN DEMO · NO AUDIO SIGNAL','warn');refresh(track);render();return true; } + demonstration=false; const id=nativeRoute()?.resolve?.(track.id),n=nativeRoute()?.state?.(); if(!id||!n?.admitted||!n?.device?.epoch||!n?.graph?.revision)return false; if(current?.id!==track.id&&isOpen())root.hidden=true; From caf0c4239827d908e2efd9fe607d30400e5c75b9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 19:37:38 +0700 Subject: [PATCH 47/48] Correct browser reopen test to reselect edited P2 band before verifying retained values --- tests/approved_builtin_peq_picker_smoke.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/approved_builtin_peq_picker_smoke.py b/tests/approved_builtin_peq_picker_smoke.py index 4cacdfa31..3de09b02e 100644 --- a/tests/approved_builtin_peq_picker_smoke.py +++ b/tests/approved_builtin_peq_picker_smoke.py @@ -64,7 +64,10 @@ def main(): assert editor.is_hidden() row.locator('[data-action="openBuiltinEq"]').click() assert editor.is_visible() + # Editor starts on P1 each time; recall the previously edited P2. + editor.locator('.mx-eq-band[data-slot="3"]').click() assert editor.get_by_label('FREQUENCY · Hz').input_value()=="735" + assert editor.get_by_label('GAIN · dB').input_value()=="4.0" editor.locator('.mx-eq-close').click() row.locator('[data-action="builtinEqRemove"]').click() assert strip.locator('.fxslot-row.is-builtin').count()==0 From b6666affd0cb06a2b587419bd96e71d22e647238 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Fri, 6 Nov 2026 20:09:58 +0700 Subject: [PATCH 48/48] Capture real Chromium Parametric EQ editor and mixer screenshots for engineering UX review --- .github/workflows/ui-smoke.yml | 2 ++ tests/approved_builtin_peq_picker_smoke.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index a6b7c6b92..92522e5cb 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -468,5 +468,7 @@ jobs: pages-v55-*.png pages-v28-physical-console-owner-v59-*.png pages-mobile-*.png + parametric-eq-mixer-*.png + parametric-eq-editor-*.png if-no-files-found: ignore retention-days: 3 diff --git a/tests/approved_builtin_peq_picker_smoke.py b/tests/approved_builtin_peq_picker_smoke.py index 3de09b02e..708a94165 100644 --- a/tests/approved_builtin_peq_picker_smoke.py +++ b/tests/approved_builtin_peq_picker_smoke.py @@ -60,6 +60,10 @@ def main(): gain.fill("4.0") gain.press("Tab") assert gain.input_value()=="4.0" + # Capture the EXACT approved GUI actually rendered by Chromium. + # These are screenshots of an interactive UI DEMO, NOT audio PCM. + page.screenshot(path=f"parametric-eq-mixer-{width}x{height}.png",animations="disabled") + editor.screenshot(path=f"parametric-eq-editor-{width}x{height}.png",animations="disabled") editor.locator('.mx-eq-close').click() assert editor.is_hidden() row.locator('[data-action="openBuiltinEq"]').click()