diff --git a/.github/workflows/guitar-fx-assets.yml b/.github/workflows/guitar-fx-assets.yml
new file mode 100644
index 000000000..802a638b8
--- /dev/null
+++ b/.github/workflows/guitar-fx-assets.yml
@@ -0,0 +1,47 @@
+name: Guitar FX assets — fast, path-scoped
+# No Chromium, MSVC, audio device, installer, npm packages or external downloads.
+# Only this feature's own asset and UX-study paths trigger the contract.
+on:
+ pull_request:
+ paths:
+ - 'design-references/guitar-fx/**'
+ - 'docs/guitar-fx/**'
+ - 'scripts/build_guitar_fx_assets.mjs'
+ - 'engine/builtin_fx/guitar/**'
+ - 'tests/guitar_fx_program_model_test.cpp'
+ - 'tests/guitar_fx_core_pcm_test.cpp'
+ - 'tests/guitar_fx_assets_contract.test.mjs'
+ - '.github/workflows/guitar-fx-assets.yml'
+ push:
+ branches: [main]
+ paths:
+ - 'design-references/guitar-fx/**'
+ - 'docs/guitar-fx/**'
+ - 'scripts/build_guitar_fx_assets.mjs'
+ - 'engine/builtin_fx/guitar/**'
+ - 'tests/guitar_fx_program_model_test.cpp'
+ - 'tests/guitar_fx_core_pcm_test.cpp'
+ - 'tests/guitar_fx_assets_contract.test.mjs'
+ - '.github/workflows/guitar-fx-assets.yml'
+permissions:
+ contents: read
+concurrency:
+ group: guitar-fx-assets-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+jobs:
+ original-hardware-assets:
+ name: Validate reproducible PNGs and truthful editor study
+ runs-on: ubuntu-latest
+ timeout-minutes: 3
+ steps:
+ - uses: actions/checkout@v4
+ - name: Verify original PNG structure, bounds and deterministic output
+ run: node --test tests/guitar_fx_assets_contract.test.mjs
+ - name: Verify bounded C++ program model without JUCE or Windows
+ run: |
+ c++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic tests/guitar_fx_program_model_test.cpp -o /tmp/guitar-fx-program-model-test
+ /tmp/guitar-fx-program-model-test
+ - name: Verify wet PCM, 2x antialias and fixed 48-sample PDC without JUCE
+ run: |
+ c++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic tests/guitar_fx_core_pcm_test.cpp -o /tmp/guitar-fx-core-pcm-test
+ /tmp/guitar-fx-core-pcm-test
diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml
index fe05f6e43..37f343179 100644
--- a/.github/workflows/p1-windows.yml
+++ b/.github/workflows/p1-windows.yml
@@ -2,7 +2,7 @@ name: Windows Native VST3 Host
# Dispatcher uses the reviewed main workflow and checks out the exact PR SHA.
# The run name is a verifiable deduplication identity (not github.head_sha,
# which would refer to main for workflow_dispatch on main).
-run-name: "ArSonMix ${{ github.event_name == 'workflow_dispatch' && inputs.package_fat && 'FAT' || github.event_name == 'workflow_dispatch' && 'NATIVE' || 'AUTO' }} PR${{ inputs.request_pr_number || '0' }} ${{ inputs.expected_sha || github.sha }}"
+run-name: "ArSonMix ${{ github.event_name == 'workflow_dispatch' && inputs.package_fat && 'FAT' || github.event_name == 'workflow_dispatch' && inputs.field_preview && 'FIELD' || github.event_name == 'workflow_dispatch' && 'NATIVE' || 'AUTO' }} PR${{ inputs.request_pr_number || '0' }} ${{ inputs.expected_sha || github.sha }}"
on:
# Single canonical Windows release producer: main changes to shipped runtime,
# native C++ or distribution scripts. Historical feature branch pushes are PRs.
@@ -99,6 +99,11 @@ on:
type: boolean
required: false
default: false
+ field_preview:
+ description: "Build the portable app for real Windows testing without the full CTest or installer suite"
+ type: boolean
+ required: false
+ default: false
focused_harmony_fat:
description: "Focused Windows FAT for the built-in vocal harmony plugin: full app, plugin DSP, mixer PCM and ASIO checks"
type: boolean
@@ -120,7 +125,7 @@ concurrency:
# the same PR share one slot and supersede each other; different PRs never
# cancel one another. The owner dispatcher separately cancels an obsolete
# native compile when a FAT request arrives for that same verified PR.
- group: windows-vst3-${{ github.event_name == 'workflow_dispatch' && inputs.package_fat && github.run_id || github.event_name == 'workflow_dispatch' && inputs.request_pr_number != '' && format('pr-{0}', inputs.request_pr_number) || github.event.pull_request.number || github.ref }}
+ group: windows-vst3-${{ github.event_name == 'workflow_dispatch' && inputs.package_fat && github.run_id || github.event_name == 'workflow_dispatch' && inputs.request_pr_number != '' && format('{0}-pr-{1}', inputs.field_preview && 'field' || 'native', inputs.request_pr_number) || github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name != 'workflow_dispatch' || !inputs.package_fat }}
permissions:
@@ -247,6 +252,7 @@ jobs:
# Owner-dispatched FAT on an isolated Harmony-only PR can skip
# compiling unrelated CTest executables, never the actual JUCE GUI.
# Main/release builds and every generic native milestone remain full.
+ FIELD_PREVIEW: ${{ github.event_name == 'workflow_dispatch' && inputs.field_preview && !inputs.package_fat }}
FOCUSED_HARMONY_FAT: ${{ github.event_name == 'workflow_dispatch' && inputs.package_fat == true && inputs.focused_harmony_fat == true }}
steps:
- uses: actions/checkout@v4
@@ -329,7 +335,7 @@ jobs:
run: >
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
-DJUCE_ROOT="${{ github.workspace }}/third_party/JUCE"
- -DBUILD_TESTING=ON
+ -DBUILD_TESTING=${{ env.FIELD_PREVIEW == 'true' && 'OFF' || 'ON' }}
-DJUCE_WEBVIEW2_PACKAGE_LOCATION="${{ github.workspace }}/.deps"
- name: Verify exact ONE approved /preview/ GUI CMake bundle
run: node scripts/check_approved_native_gui_release.mjs --source-only --bundle build/approved_gui
@@ -407,7 +413,7 @@ jobs:
Write-Host "HARMONY_FAT_NATIVE_TARGETS=$($targets.Count) SOURCE_SHA=$sourceSha"
- name: Build executable and native RT tests
- if: ${{ env.FOCUSED_HARMONY_FAT != 'true' }}
+ if: ${{ env.FOCUSED_HARMONY_FAT != 'true' && env.FIELD_PREVIEW != 'true' }}
# Full build remains mandatory for main, release and native/full requests.
run: cmake --build build --config Release --parallel 2
- name: Run focused vocal harmony DSP, mixer PCM and ASIO checks
@@ -444,27 +450,53 @@ jobs:
Write-Host "FOCUSED_HARMONY_FAT_CTEST_COUNT=$($requiredTests.Count) FULL_SUITE_NOT_CLAIMED"
& ctest --test-dir build -C Release --output-on-failure -R $pattern
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ - name: Build portable Windows field preview
+ if: ${{ env.FIELD_PREVIEW == 'true' }}
+ run: cmake --build build --config Release --parallel 2 --target ARMixConsole
- name: Test realtime control primitives
- if: ${{ env.FOCUSED_HARMONY_FAT != 'true' }}
+ if: ${{ env.FOCUSED_HARMONY_FAT != 'true' && env.FIELD_PREVIEW != 'true' }}
run: ctest --test-dir build -C Release --output-on-failure
- name: Package verified JUCE GUI for hardware FAT
- if: ${{ github.event_name == 'workflow_dispatch' && inputs.package_fat == true }}
+ if: ${{ env.FIELD_PREVIEW == 'true' || (github.event_name == 'workflow_dispatch' && inputs.package_fat == true) }}
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 == 'workflow_dispatch' && inputs.package_fat == true }}
+ if: ${{ env.FIELD_PREVIEW == 'true' || (github.event_name == 'workflow_dispatch' && inputs.package_fat == true) }}
shell: pwsh
run: |
python scripts/factoryfx_release_bundle.py stage --lock config/factoryfx-approved-releases.json --output dist --best-effort
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ - name: Mark unqualified field preview BEFORE independent distribution verification
+ if: ${{ env.FIELD_PREVIEW == 'true' }}
+ shell: pwsh
+ run: |
+ # Tag the final allowlisted package rather than modifying files
+ # AFTER verification. Users receive exactly the bytes we validate.
+ $path = 'dist/BUILD_PROVENANCE.json'
+ $provenance = Get-Content -LiteralPath $path -Raw -Encoding UTF8 | ConvertFrom-Json
+ if ($provenance.sourceCommit -ne '${{ inputs.expected_sha }}') {
+ throw 'FIELD_PREVIEW_SOURCE_SHA_MISMATCH'
+ }
+ $provenance.fatStatus = 'FIELD_PREVIEW_FULL_CTEST_NOT_RUN'
+ $provenance | ConvertTo-Json -Depth 20 |
+ Set-Content -LiteralPath $path -Encoding utf8
- name: Independently verify release ZIP and embedded GUI/engine before upload
- if: ${{ github.event_name == 'workflow_dispatch' && inputs.package_fat == true }}
+ if: ${{ env.FIELD_PREVIEW == 'true' || (github.event_name == 'workflow_dispatch' && inputs.package_fat == true) }}
shell: pwsh
run: |
& ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ - name: Upload portable Windows field preview
+ if: ${{ env.FIELD_PREVIEW == 'true' }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: ArSonMix-Windows-Field-Preview-${{ inputs.expected_sha }}
+ path: dist/
+ if-no-files-found: error
+ retention-days: 14
+ compression-level: 0
- name: Install Inno Setup 6 compiler if missing
if: ${{ github.event_name == 'workflow_dispatch' && inputs.package_fat == true }}
shell: pwsh
diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml
index 4d0eb70ae..7962776fd 100644
--- a/.github/workflows/ui-smoke.yml
+++ b/.github/workflows/ui-smoke.yml
@@ -195,7 +195,7 @@ jobs:
needs: quick
# Both 8D-SonKu and SOF native-owner PRs share ONE actual Chromium runner.
# Preserve fast-only checks for unrelated GUI and engine branches.
- if: ${{ (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'feat/8d-sonku-') || startsWith(github.head_ref, 'test/sof-native-') || startsWith(github.head_ref, 'integration/sof-sonku-main-') || startsWith(github.head_ref, 'fix/native-wire-inspector-') || startsWith(github.head_ref, 'integration/sonku-m4-wire-'))) || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/feat/8d-sonku-') && inputs.expected_sha != '') }}
+ if: ${{ (github.event_name == 'pull_request' && (startsWith(github.head_ref, 'feat/8d-sonku-') || startsWith(github.head_ref, 'test/sof-native-') || startsWith(github.head_ref, 'integration/sof-sonku-main-') || startsWith(github.head_ref, 'fix/native-wire-inspector-') || startsWith(github.head_ref, 'integration/sonku-m4-wire-') || startsWith(github.head_ref, 'integration/sonku-m4-guitar-'))) || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/feat/8d-sonku-') && inputs.expected_sha != '') }}
runs-on: ubuntu-latest
timeout-minutes: 12
steps:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e7d2b95dd..496d9f763 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,8 +77,14 @@ message(STATUS "${ARMIX_GUI_BUNDLE_LOG}")
file(GLOB_RECURSE ARMIX_APPROVED_GUI_BINARIES CONFIGURE_DEPENDS
"${ARMIX_APPROVED_GUI_DIR}/assets/*")
list(SORT ARMIX_APPROVED_GUI_BINARIES)
+# Original Guitar FX artwork is embedded ONLY for the installed JUCE
+# plugin editor; it never becomes a second /preview/ or runtime file path.
+file(GLOB ARMIX_GUITAR_SKIN_PNGS CONFIGURE_DEPENDS
+ "${CMAKE_CURRENT_SOURCE_DIR}/design-references/guitar-fx/assets/*.png")
+list(SORT ARMIX_GUITAR_SKIN_PNGS)
juce_add_binary_data(ARMixAssets SOURCES
"${ARMIX_APPROVED_GUI_DIR}/index.html" ${ARMIX_APPROVED_GUI_BINARIES}
+ ${ARMIX_GUITAR_SKIN_PNGS}
"${ARMIX_BRAND_DIR}/arsonmix-256.png")
target_include_directories(ARMixConsole PRIVATE "${ARMIX_APPROVED_GUI_DIR}")
@@ -133,7 +139,8 @@ target_compile_definitions(ARMixConsole PRIVATE
JUCE_PLUGINHOST_VST3=1
JUCE_APPLICATION_NAME_STRING="AR MIX Studio"
JUCE_APPLICATION_VERSION_STRING="${ARMIX_APP_VERSION}"
- ARMIX_BUILD_SOURCE_SHA="${ARMIX_BUILD_SOURCE_SHA}")
+ ARMIX_BUILD_SOURCE_SHA="${ARMIX_BUILD_SOURCE_SHA}"
+ ARMIX_GFX_EMBED_PNG_SKINS=1)
if(WIN32)
# Windows retains its proven ASIO-first / WASAPI / static WebView2 distribution.
# Never link Windows loader or sound APIs into macOS/Linux builds.
diff --git a/design-references/guitar-fx/README.md b/design-references/guitar-fx/README.md
new file mode 100644
index 000000000..4adb08a4f
--- /dev/null
+++ b/design-references/guitar-fx/README.md
@@ -0,0 +1,31 @@
+# Guitar FX editor design study and original hardware assets
+
+**Not the ArSonMix published mixer. Not an audio processor. No native hardware or PCM claims.**
+
+This folder is an internal visual/interaction study for a future **single native Guitar FX insert** hosted by the already-approved ArSonMix /preview/ mixer. Its hardware-looking PNGs are original procedural drawings, not photos, and must undergo visual review before product promotion. Core contract: [Guitar FX Foundation](../../docs/guitar-fx/GUITAR_FX_FOUNDATION_20261113.md).
+
+## Try the workflow locally
+
+1. Clone this branch, then open `design-references/guitar-fx/editor-prototype.html` in Chrome/Edge.
+2. Select Clean/Blues/Crunch/Rock/Metal/Ambient in the preset library; browser can collapse.
+3. Choose a chain block to focus its *only* hardware editor; use its power dot to bypass independently; drag movable pedals to reorder while AMP/CAB remain paired.
+4. Move knobs vertically or use the accessible range controls; switch A/B; download *design-state* JSON; open Tuner to see the explicit no-audio placeholder.
+5. No controls send native commands or generate audio. The CAB mic position is a placeholder only; no fake acoustic claim or live metering.
+
+## Rebuild PNGs and verify
+
+```sh
+node scripts/build_guitar_fx_assets.mjs
+node --test tests/guitar_fx_assets_contract.test.mjs
+```
+
+Requires Node 18+; uses only built-in JavaScript, no image download, UI screenshot, paid fonts, external brands or pipeline dependencies. The renderer generates all PNG bitmaps byte-identically. The original indexed transparent assets are deliberately compact; CSS/HTML owns legends, values, focus, hit targets and state, not pixels. This preserves accessibility and translation potential.
+
+## Design integration constraints
+
+- Exactly one authoritative /preview/ console and one JUCE native graph; this file is not deployed as a competing mixer GUI.
+- Integration must use the existing FX editor owner, NativeBuiltInFx registry and accepted snapshot path; coordinate with active #605 FX editor and #604 toolbar PR.
+- PNG artwork is decorative and never grounds live meters, model tone, impulse responses or physical signal routes.
+- Do not ship NAM models, amplifier capture files or third-party IRs without separately confirmed terms and exact approved binaries.
+
+See original image files under [assets](assets/) and source generator at [scripts/build_guitar_fx_assets.mjs](../../scripts/build_guitar_fx_assets.mjs).
diff --git a/design-references/guitar-fx/assets/amp-head-class-a.png b/design-references/guitar-fx/assets/amp-head-class-a.png
new file mode 100644
index 000000000..443f617fd
Binary files /dev/null and b/design-references/guitar-fx/assets/amp-head-class-a.png differ
diff --git a/design-references/guitar-fx/assets/cabinet-dual-12.png b/design-references/guitar-fx/assets/cabinet-dual-12.png
new file mode 100644
index 000000000..f8d0fe0bf
Binary files /dev/null and b/design-references/guitar-fx/assets/cabinet-dual-12.png differ
diff --git a/design-references/guitar-fx/assets/knob-brushed-metal.png b/design-references/guitar-fx/assets/knob-brushed-metal.png
new file mode 100644
index 000000000..9583cc7d6
Binary files /dev/null and b/design-references/guitar-fx/assets/knob-brushed-metal.png differ
diff --git a/design-references/guitar-fx/assets/led-active.png b/design-references/guitar-fx/assets/led-active.png
new file mode 100644
index 000000000..4df2376bd
Binary files /dev/null and b/design-references/guitar-fx/assets/led-active.png differ
diff --git a/design-references/guitar-fx/assets/led-bypassed.png b/design-references/guitar-fx/assets/led-bypassed.png
new file mode 100644
index 000000000..d305f44c5
Binary files /dev/null and b/design-references/guitar-fx/assets/led-bypassed.png differ
diff --git a/design-references/guitar-fx/assets/pedal-chorus.png b/design-references/guitar-fx/assets/pedal-chorus.png
new file mode 100644
index 000000000..652b32ccc
Binary files /dev/null and b/design-references/guitar-fx/assets/pedal-chorus.png differ
diff --git a/design-references/guitar-fx/assets/pedal-compressor.png b/design-references/guitar-fx/assets/pedal-compressor.png
new file mode 100644
index 000000000..29638014c
Binary files /dev/null and b/design-references/guitar-fx/assets/pedal-compressor.png differ
diff --git a/design-references/guitar-fx/assets/pedal-delay.png b/design-references/guitar-fx/assets/pedal-delay.png
new file mode 100644
index 000000000..652b32ccc
Binary files /dev/null and b/design-references/guitar-fx/assets/pedal-delay.png differ
diff --git a/design-references/guitar-fx/assets/pedal-gate.png b/design-references/guitar-fx/assets/pedal-gate.png
new file mode 100644
index 000000000..f88c54f47
Binary files /dev/null and b/design-references/guitar-fx/assets/pedal-gate.png differ
diff --git a/design-references/guitar-fx/assets/pedal-modulation.png b/design-references/guitar-fx/assets/pedal-modulation.png
new file mode 100644
index 000000000..29638014c
Binary files /dev/null and b/design-references/guitar-fx/assets/pedal-modulation.png differ
diff --git a/design-references/guitar-fx/assets/pedal-overdrive.png b/design-references/guitar-fx/assets/pedal-overdrive.png
new file mode 100644
index 000000000..0a075cbce
Binary files /dev/null and b/design-references/guitar-fx/assets/pedal-overdrive.png differ
diff --git a/design-references/guitar-fx/assets/pedal-reverb.png b/design-references/guitar-fx/assets/pedal-reverb.png
new file mode 100644
index 000000000..e06f891a1
Binary files /dev/null and b/design-references/guitar-fx/assets/pedal-reverb.png differ
diff --git a/design-references/guitar-fx/editor-prototype.html b/design-references/guitar-fx/editor-prototype.html
new file mode 100644
index 000000000..9bbab750b
--- /dev/null
+++ b/design-references/guitar-fx/editor-prototype.html
@@ -0,0 +1,49 @@
+
+
ArSonMix Guitar FX — UX study (no audio)
+
+
+
ArSonMix GUITAR FX RIGCH 07 · GuitarUX PROTOTYPE · NO AUDIO
+
+
+
SIGNAL CHAINClick to edit · power to bypass · drag to reorder
+AMP / BRITISH CLASS A
Focused editor
BRITISH CLASS A
+
+
GUITAR TUNER
The native pitch detector is not implemented. This design-only view intentionally never invents a tuning note or input meter.
+
\ No newline at end of file
diff --git a/docs/SMART_CI_RUNNER_WORKFLOW.md b/docs/SMART_CI_RUNNER_WORKFLOW.md
index 940045213..3ad74c499 100644
--- a/docs/SMART_CI_RUNNER_WORKFLOW.md
+++ b/docs/SMART_CI_RUNNER_WORKFLOW.md
@@ -197,3 +197,7 @@ Full current-product UI qualification keeps archived V8–V27 migration tests di
## Operator-first fast delivery amendment (2026-11-09)
Read [Autonomous Fast Delivery Contract](AUTONOMOUS_FAST_DELIVERY_CONTRACT_20261109.md). Continue code editing while fast CI runs when tasks are independent; finish one real native Player→MUSIC→MAIN workflow before cosmetic or M2 features. No separate M0 plan/review/merge gate, repeated owner approvals, parallel micro PRs or dummy commits to start expensive Actions. Preserve fail-closed hardware identity, Native/Browser quality, exact-SHA jobs, permissions and branch protection. Trigger early unqualified Windows FAT installer **once** when M1 native audio is integrated, so owner can field-test; any later runtime fix requires a new exact-SHA qualification. Do not claim physical FAT on CI success.
+
+### Portable Windows field preview
+
+Use `/arsonmix-ci field ` when the next step is hands-on testing of the current mixer on Windows. The owner dispatcher runs the existing fast native checks, builds only `ARMixConsole`, verifies the exact-source portable package, and uploads `ArSonMix-Windows-Field-Preview-`. Download the Actions artifact ZIP, extract it and run the included executable. Use `fat` for installer testing or full Windows qualification. The field ZIP records that full CTest was omitted and carries no public release or physical qualification.
diff --git a/docs/guitar-fx/GFX_FIELD_ACCEPTANCE.md b/docs/guitar-fx/GFX_FIELD_ACCEPTANCE.md
new file mode 100644
index 000000000..e12658040
--- /dev/null
+++ b/docs/guitar-fx/GFX_FIELD_ACCEPTANCE.md
@@ -0,0 +1,42 @@
+# Guitar FX Rig — first physical Hi-Z/ASIO field qualification
+**Build:** PR #607 design-native M1 candidate. This is **not** a public release, not NAM/neural modeling and not measured cabinet captures. Never confuse a green GitHub Windows FAT workflow with a guitar/audio hardware FAT.
+
+## Setup
+- Obtain only the exact-SHA, independently verified Windows FAT ZIP artifact linked in PR #607. Check provenance: expected PR HEAD SHA, validated asset bundle and CTest before executing.
+- Use the normal ArSonMix native application. No second Guitar FX executable. Open the approved mixer UI (its existing /preview/ chrome), not a standalone developer HTML file.
+- Select the actual instrument/Hi-Z input of the audio interface for a channel. ASIO is the singer/guitar monitor output. Start with headphones or monitors low, clean input trim and no feedback path. Do not plug guitar directly into mic-level phantom-power input.
+- Establish the existing native WIRE to MAIN/output explicitly (or test existing approved startup routing). `SOURCE ONLY` should still meter at the channel but cannot reach MAIN.
+
+## Acceptance sequence (capture yes/no + audio interface/driver settings)
+1. Insert **FX Rack → Guitar FX Rig** in the intended channel; the existing native editor window should open, with working original PNG amp, gate/drive pedal and cabinet art. Verify FX slot identity stays stable through editor close/reopen.
+2. Play single notes and chords, choose **Clean Studio → Warm Blues → Vintage Crunch → Modern Lead** while output is ON. Expect an audible change of guitar tone and the UI to transition from pending to DSP accepted. Compare wet vs rack bypass at low level. These names are *algorithmic* starting profiles, not emulations of a commercial amplifier.
+3. Edit AMP Gain/Tone/Master and Drive, and toggle Gate/Drive. Each live tweak must reach the **active** callback; historically pending edits were drained only when the entire FX was bypassed. Do not accept a change that only occurs after turning rack OFF.
+4. Observe IN/OUT meters with real guitar and then remove/disconnect the input; the editor must not display a fabricated live meter while there is no processing. Verify mute/solo/fader/PFL and WIRE behavior remain owned by the standard mixer.
+5. Store two different **A/B** tones: adjust A, switch B, select an alternate factory tone, then return A. Verify there is no unexpected bypass, silence or rack instance replacement. Close and reopen the editor and confirm both banks remain independent. Save `.smix`, restart, Open the session, and verify exact active bank plus both tones. Prior one-tone **GRX1 v1** sessions must migrate with the original tone in both banks; malformed bank state must reject without corrupting the accepted graph. Repeat with SOURCE ONLY then restore WIRE to MAIN.
+6. Quickly change presets/parameters at 48 kHz / 128-sample buffer, listening for pops, missed ACK, dropouts and unintended sudden gain changes. Repeat at 44.1 kHz / 256 frames and, if supported by the interface, 96 kHz / 128 frames.
+7. Change/reconnect the selected audio interface while the mixer remains open. Ensure a stale prepared 48kHz program cannot be installed at 44.1kHz. Accepted settings must survive without additional Monitor/ARM wizard clicks.
+8. For ASIO performance, record exact interface/driver, buffer size, sample rate, actual observed round-trip latency (using loopback measurement), number of active guitar channels, xrun/dropout count, and subjective tone quality in headphones.
+
+## Evidence and release gate
+- Workflows: asset/JS contract, native registry PCM fixtures, one exact-SHA Windows build/CTest and verified ZIP. A Windows job alone **does not** prove live Hi-Z/ASIO routing or speaker reproduction.
+- Provide one field test note: exact SHA/build, interface, input/output selection, `.smix` path, tested sample rates and buffers, audible clean/crunch transition, CAB on/off comparison, UI truthfulness, copy of any error.
+- **BLOCK M1 release** if a normal active FX insert fails to apply live edits; if saved state does not match actual audio; if a device restart crashes, loses settings or requires hidden monitoring steps; if physical output does not route through the single native PCM graph; or if the verified Windows ZIP is unavailable.
+- Deferred: editable NAM capture/IR browser, tuner, fully saved A/B, modulation/delay/reverb, manufacturer-level audio profiling. Do not show fake controls for those features in the M1 editor.
+
+## New engine performance verification
+- Synthetic cabinet FIR is 65-tap symmetric, reduced to 33 multiply pairs per sample per channel. This is a code-level operation count, **not** measured wall-clock performance. Benchmark one, four and eight guitar inserts before claiming CPU savings on ASIO hardware.
+- Verify spectral character and transient level by ear across 44.1/48/96 kHz. The intentional 2× antialias path does change preamp harmonics; avoid claims of bit-identical reproduction of pre-M2 audio. Measure exactly **48 samples total fixed GFX PDC** (16 preamp + 32 CAB), with the same timing for Drive/Amp/CAB bypass. Compare 64/128/256 frames in the real interface.
+- Model loading / NAM captures and commercial cabinet IRs are explicitly not supported in M1; see [pro engineering decisions](GFX_PRO_WORKFLOW_AND_DSP_ARCHITECTURE.md).
+
+## GFX Gate engineering qualification
+- Feed a real guitar input with a quiet stereo echo/ambience return at one side. With Gate ON, adjust threshold close to idle-noise floor. The stereo image must remain stable because L/R attenuation is linked; no unintended dual mono gating.
+- Pluck a note, vary HOLD (0–120 ms) and RELEASE (12–240 ms). Short hold/release should damp background noise faster; longer values should preserve decaying guitar notes. Compare against gate OFF using level-matched reference; no invented VU movement.
+- Sweep Threshold −80…−30 dB; fast attacks must not audibly suppress the first pluck. Report pops/flutter, and device/buffer/rate changes at 44.1/48/96kHz.
+- The Drive/Amp are now **2× oversampled** using fixed FIR, not native-rate. Portable high-gain 9kHz→21kHz alias improved from −16.6682 to −57.1979 dBc at 48 kHz with cabinet bypassed. Test real guitar buzz/brightness and level-match before/after switching models or bypass; no claim of NAM capture fidelity or alias-free output across the full spectrum.
+
+## M2 2× antialiasing / ASIO performance acceptance
+
+- Observe the exact installed build SHA after 2× antialias was merged; the earlier M1.6 FAT archive does **not** contain this processing.
+- In a live Hi-Z guitar channel test clean/pedal drive/lead with CAB ON and OFF. Compare headroom, harshness/alias fizz and output loudness; the 2× algorithm must be subjectively acceptable rather than only passing a single spectral fixture.
+- Repeat with 1, 4 and 8 simultaneous Guitar FX inserts at 44.1, 48, and 96 kHz, 64/128/256 frames if supported by the interface. Record ASIO interface driver, xruns, actual loopback latency and CPU; the GitHub 0.75/2.93/5.77% figures are not a guaranteed customer PC benchmark.
+- Verify 48-sample DSP PDC remains matched during CAB/Drive/Amp ON→OFF, rack bypass and dynamic WIRE reconnection. Fast toggle must not output stale samples or unaligned echoes; the matched dry preamp delay remains warm even when distortion is enabled.
diff --git a/docs/guitar-fx/GFX_PRO_WORKFLOW_AND_DSP_ARCHITECTURE.md b/docs/guitar-fx/GFX_PRO_WORKFLOW_AND_DSP_ARCHITECTURE.md
new file mode 100644
index 000000000..39739a320
--- /dev/null
+++ b/docs/guitar-fx/GFX_PRO_WORKFLOW_AND_DSP_ARCHITECTURE.md
@@ -0,0 +1,81 @@
+# Guitar FX Rig — Professional workflow / DSP growth architecture
+**Research-anchored decision · 2026-11-13 · PR #607 · Issue #608**
+
+This is an implementation roadmap for an **in-channel native insert in ArSonMix**, not a standalone program, second audio graph, browser-generated sound, or fictional guitar plugin. Harmonice is a separate vocal-harmony plugin.
+
+## Grounded competitive reference (read before adding modules)
+
+| Reference | Verified professional behavior | Product decision |
+|---|---|---|
+| [NI Guitar Rig signal path](https://docs.native-instruments.com/online-guides/guitar-rig-manual/en/signal-path) and [official product](https://www.native-instruments.com/products/guitar-rig-pro) | Ordered rack/components, readable signal flow; linked browser/presets, cabinet IR loading and global post-rack tools | Keep a compact always-readable chain + collapsible preset library + one focused large hardware editor; do not make a dashboard that always shows every pedal and cab simultaneously |
+| [Line 6 Helix Native guide](https://line6.com/data/6/0a020a41143d65fb6bcb2ed8ca/application/pdf/Helix%20Native%20PilotGuide%20v3.00%20-%20Rev%20N%20-%20English%20.pdf) | Snapshots remember changes of enabled blocks and assigned parameters without rebuilding the preset's complete models; preset vs snapshot workflow is distinct | A/B is a first-class durable native tone comparison, not an HTML-only toggle; moving between two bounded programs uses prepared DSP and 128-frame crossfade, with actual callback ACK |
+| [NI Cabinet component documentation](https://docs.native-instruments.com/ni-tech-manuals/guitar-rig-manual/en/components-reference) | Real captured cabinet IRs, mic/phase options, explicit cabinet mix | Future licensed measured IRs are a *separate resource path* from amplifier processing; current 65-tap original FIR is explicitly synthetic and is never presented as a measured cab/microphone |
+| [NeuralAmpModelerCore](https://github.com/sdatkinson/NeuralAmpModelerCore) and [MIT LICENSE](https://github.com/sdatkinson/NeuralAmpModelerCore/blob/main/LICENSE) | Portable native DSP, separate plugin and training repository, model-benchmark tooling; library code under MIT | Evaluate model backend as optional, reproducibly pinned DSP dependency after measured CPU/latency tests; do not imply all downloadable model files have MIT redistribution rights |
+
+## Implemented M1 shape
+
+`Hardware Hi-Z → existing ChannelId → Guitar FX Rig → channel FX/fader → WIRE → BUS/MAIN → physical output`.
+
+- One existing JUCE audio callback and existing FxInstance; `NativeBuiltInFx` supplies catalog identity. Native editor is opened by the existing editor lease.
+- Original PNG art is compiled into the same installed executable. PNG is *decorative only*; controls, labels, values, availability, and meter are native and honest.
+- First DSP graph: `GATE → OVERDRIVE → AMP → CAB`. Exactly these four modules are prepared and rendered. No fake compressor/reverb/mic-position/tuner audio control.
+- One bounded `GuitarFactoryTones.h` catalog is authoritative for both DSP values and factory preset names. Custom is detected by **complete** program equality, including bypass, all parameters, block IDs and order.
+- A/B is stored in native `GRX1` state **version 2**: 12-byte magic/version/active-bank header; then two bounded program records (count + 44 bytes per block). Version 1 (single program) migrates by copying its accepted tone into both banks. Invalid bank, truncated bytes, unsupported program, wrong amp/cab order or bad normalized values reject without replacing the accepted processor.
+- Program changes are prepared and validated on CONTROL; an SPSC hands them to the existing audio callback, which crossfades for 128 frames and sends an ACK. Pending edits block stale `.smix` snapshot capture. The editor closes without losing the final queued knob or deferred A/B selection while an active processor exists. Stopped audio never fabricates ACK.
+
+## M2 engineering expansion — no naive independent processors per widget
+
+1. **DSP backend contract:** separate immutable prepared program from per-lane audio state. Per-module typed parameters `prepare → process → latency → reset` and bounded state/memory. Keep ChannelId, stable block ID, packet sequence, and ACK exact. A program is accepted atomically, never built in PCM.
+2. **Real audio quality:** 2x polyphase FIR is now installed for nonlinear Drive/Amp, after a measured 9k→21k alias reduction at 48k; keep it as a low-latency always-on quality baseline. Next measure 44.1/48/96 kHz, 64/128/256 samples, multitone/CPU/xrun and actual ASIO hardware before considering a 4x mode or claiming comparable commercial captures.
+3. **NAM backend:** evaluate pinned upstream C++ API and supported `.nam` versions. Load/validate model JSON, weight count, architecture, stated sample rate and runtime buffers strictly **off audio thread**. Keep algorithmic amp as reliable fallback. Audit *individual model* redistribution licenses/provenance separately from MIT core code. Reject unsupported or excessively large models without breaking the last accepted tone.
+4. **Cabinet IR backend:** accept only validated PCM WAV and explicit IR licensing metadata, cap file size/length/channels, reject NaN/non-finite samples, resample/precompute on CONTROL, prepare a bounded convolution plan and dual-state handoff with known latency. A decorative mic icon must not move unless the actual accepted DSP IR changes. Preserve MAIN PDC across bypass and FX rack transitions.
+5. **Additional stages:** compressor → chorus → delay → reverb once verified native processing and state are implemented. Show only real modules; no "enabled" green indicators for placeholder components. Do not couple internal Guitar FX modules to external VST3 leases or a second device.
+6. **Stage controls:** lightweight collapsible preset library, focused amp/cab/pedal, truthful A/B and clip meters, keyboard and future MIDI footswitch mapping; globally stable output trim to avoid loudness jumps **after calibrated tests**. Avoid bulky cards, broad tabs, duplicate routing diagrams and invented live CPU or metering displays.
+
+## Hard acceptance contracts
+
+- Windows MSVC build + actual native registry PCM/restore tests at exact SHA; test 4 factory tones, non-factory Custom, A/B persistence across .smix, v1 migration, wrong bank, corrupt second-bank payload, device restart and bypass edit.
+- Fast Linux core tests: no JUCE/no network, deterministic PNG generator, factory preset identity, bounded graph, FIR fixed latency, stereo PCM, refusal of invalid programs.
+- Realtime callback: zero allocations, blocking, mutex, disk or module construction; one callback authority, no stale snapshots or premature accepted visual indication.
+- Physical audio engineer tests: real guitar/Hi-Z → ASIO processed output, output level safety, SOURCE ONLY/no MAIN, WIRE reconnect, low buffer stress and measured round-trip latency. A Windows CI result cannot prove this; see [GFX field acceptance](GFX_FIELD_ACCEPTANCE.md).
+
+**Out of scope for the current PR:** shipping unlicensed commercial amp/IR images or captures, claiming NAM fidelity, MIDI control before actual tested mapping, a separate standalone mixer, and sound quality approvals based only on CI.
+
+## M1.6 realtime correctness recovery (2026-11-13)
+
+**Root-cause evidence:** Exact-SHA M1.5 FAT #43355170393 compiled in MSVC but failed 1 of 92 CTests: `M4NativeFxCatalogExtensionAndStatePreparation` hit `legacy.getSize()==12u+4u*44u`. This fixture queried a `juce::MemoryBlock` while its `MemoryOutputStream` was still open and reserving spare capacity. JUCE documents `flush()` or destruction to trim the final byte size. The fixture now checks `writer.getDataSize()` then calls `writer.flush()` **before** asserting the MemoryBlock length. It was not an assertion against the actual rendered guitar sound.
+
+**Active-rig fixes:**
+- `GuitarRigCore::inheritCompatibleHistory()` copies audio-owned gate envelope, drive/amp filter histories and 65-tap cabinet circular buffers to prepared snapshots only when sample rate, stable module IDs and topology match. 128-frame crossfade now starts with matching warm audio history instead of newly zeroed delay taps. All DSP preparation remains on CONTROL; copying bounded histories remains inside one audio callback.
+- `GuitarRigProcessor::onRealtimeBypass()` handles the existing host callback's **fully bypassed** signal: stops a partial wet-only crossfade, resets stale cabinet/gate state after the rack finishes fading to dry, and applies later SPSC updates without waiting for PCM that the host deliberately skips. Re-enabling wet does not replay old FIR tails.
+- `GuitarRigEditor::loadArt()` uses a function-local static cache for five embedded original PNG skins, so closing and reopening a floating native editor does not repeatedly decode images. Native controls, meters, and actual accepted DSP state still render independently of the bitmap artwork.
+
+**New tests:** portable C++ checks identical future PCM after warm history transfer, rejection of cross-rate transfers and nonzero warm vs cold behavior; native registry regression covers mid-crossfade → fully bypassed → next A/B ACK and no stale cabinet tail after re-enable; path-scoped JS checks cached hardware skin decoding. No unnecessary second graph, time-consuming DSP preparation on callback, or imaginary music controls.
+
+**Quality research:** JUCE's documented `dsp::Oversampling` supports 2×/4× with FIR/IIR filter tradeoffs. A nonlinear guitar amp may alias; future anti-alias mode must quantify spectral energy and CPU/PDC latency on 44.1/48/96 kHz and realistic ASIO buffers before selecting oversampling in production. See https://docs.juce.com/master/classjuce_1_1dsp_1_1Oversampling.html. Helix snapshot behavior remains our benchmark for seamless parameter/bypass changes, not a claim of identical audio modeling.
+
+**Pending release evidence:** run a single exact-SHA Windows native FAT/CTest after complete fast checks and main reconciliation; verify ZIP and installer provenance. Hardware Hi-Z/ASIO audition and commercial-grade amp tone acceptance remain mandatory.
+
+## M1.7 musical gate + measurable aliasing baseline (13 Nov 2026)
+
+Based on the [FabFilter Pro-G stereo sidechain guide](https://prod.fabfilter.com/help/pro-g/using/expertmode), [Pro-G Hold/Release/Hysteresis guidance](https://prod.fabfilter.com/help/pro-g/using/timecontrols) and [Ableton Live 12 Gate](https://www.ableton.com/en/manual/live-audio-effect-reference/), a studio gate should preserve stereo localization while suppressing idle noise and allow musical tail shaping. Added one **stereo-linked maximum-amplitude detector** before drive/amp (no L/R mono summing); both channels receive one identical gain curve. Hysteresis remains a lower close threshold (0.65 × open threshold).
+
+The native gate editor now has three actual state-backed parameters: **Threshold −80…−30 dB** (`values[0]`), **Hold 0…120 ms** (`values[1]`), and **Release 12…240 ms** (`values[2]`). These reuse the existing normalized 8-value GRX1 block schema, so no new audio graph, PDC or binary version is required. The pre-existing factory tones keep reserved values[1..2] equal to zero (valid backward save/restore). Their envelope timing is intentionally refined for better guitar dynamics; **binary compatibility does not claim sample-for-sample equality with an older executable**.
+
+GFX portable PCM tests now distinguish stereo-linked behavior from per-channel gating, verify sustained Hold vs zero Hold, verify Release makes an audible amplitude change, and reject invalid numeric programs. Additional non-gating spectral baseline measures a 9-kHz high-gain guitar input's third harmonic folding to 21 kHz at 48 kHz when CAB is bypassed; prints dBc to CI logs. This is **characterization**, not a declaration that current native-rate nonlinear amp is alias-free. Professional oversampling would require a measured improvement at multiple rates and a PDC/ASIO CPU budget before enabling any additional latency.
+
+The live editor keeps a compact one-focus-module layout. The new gate values are displayed as physical dB and milliseconds instead of misleading percentages. A NAM model or commercial IR is **not** bundled and their redistribution rights still require separate review.
+
+## M2 — 2× antialiasing first-sound quality gate (13 Nov 2026)
+
+A high-gain 9-kHz sine at 48 kHz creates upper odd harmonics. With the handcrafted 65-tap CAB **bypassed** to isolate the preamp, the native-rate baseline produced a folded 21-kHz spectral line at **−16.6682 dBc** relative to the 9-kHz fundamental. This is audible-band aliasing risk in guitar audio; a marketing sound-quality claim would be premature.
+
+Implemented `engine/builtin_fx/guitar/GuitarOversampling2x.h`: CONTROL-prepared 33-tap Hamming-windowed FIR interpolation + 33-tap decimation, two polyphase input branches (17+16 tap multiplications) and 33 downsampling multiplications per base frame. Drive/Amp run at 2× sample rate (including their HP/tone poles); gate and cabinet retain the hardware rate. No new audio callback or dynamic allocation on RT. The dry path remains truly clean when both nonlinear modules are OFF, with a **warm 16-sample base-rate delay** matching the two-FIR interpolation/decimation path.
+
+The preamp adds **exactly 16 samples** of filter group delay to the existing CAB's 32 samples, so the Guitar FX host declares **48 samples total fixed PDC** regardless of Drive/Amp/CAB bypass states. This adds 16 samples compared with M1.6 (0.333 milliseconds at 48 kHz), not a new buffer or extra audio device. Existing .smix v1/v2 field payloads remain accepted; playback quality/latency can differ between executable versions even though state bytes retain compatibility.
+
+Portable spectral gate (48kHz, 9kHz high-gain sine, CAB OFF): after 2× processing, **−57.1979 dBc** at 21 kHz, a reduction of approximately **40.53 dB**. A conservative regression threshold of **below −35 dBc** detects a future accidental return to native-rate aliasing. This establishes one robust high-gain benchmark, not a guarantee of no aliasing at all guitar notes and model settings.
+
+Non-gating GitHub Linux runner CPU probe at 48kHz, 128-frame blocks (not an ASIO hardware claim): 1 insert **0.75%**, 4 inserts **2.93%**, 8 inserts **5.77%** of equivalent realtime wall-clock budget. Real laptop/ASIO/FAT benchmarks still required; CPU samples depend strongly on machine, compiler, channel count, power settings and competing FX.
+
+Research: [JUCE Oversampling API](https://docs.juce.com/master/classjuce_1_1dsp_1_1Oversampling.html) explicitly distinguishes FIR linear-phase latency and IIR phase/latency tradeoffs. The chosen bounded polyphase implementation uses its own fixed FIR resources instead of secretly changing a JUCE processor's latency on GUI knob turns. Future NAM adapter should share the same clear prepared-state/latency contract; no external capture is bundled here.
diff --git a/docs/guitar-fx/GUITAR_FX_FOUNDATION_20261113.md b/docs/guitar-fx/GUITAR_FX_FOUNDATION_20261113.md
new file mode 100644
index 000000000..0f353e097
--- /dev/null
+++ b/docs/guitar-fx/GUITAR_FX_FOUNDATION_20261113.md
@@ -0,0 +1,122 @@
+# ArSonMix Guitar FX Rig — product contract, UX, assets, and native architecture
+
+Status: **foundation/design only** (2026-11-13). Not installed in ArSonMix, not a working amp simulation, and not evidence of ASIO/PCM. This is an implementation contract for one coherent vertical slice, not a new approval gate.
+
+Baseline: `main@94f9b6a2d1de81c9e3dab4978aaf2d44dcf7870e`. Read the **latest** main and active PRs again before implementation. Existing unrelated PRs at authoring: #605 (picker opens editor), #604 (GAIN/FX Rack), #601 (8D SonKu), #521 and #512. Do not overwrite their work.
+
+## Product outcome
+
+An ordinary guitarist selects the verified Hi-Z input on a normal ArSonMix audio channel, chooses **Add FX > Guitar FX Rig**, selects a usable tone, and plays through existing FX/channel/WIRE/BUS/MAIN to an explicitly verified hardware output. **No independent audio device, no audio callback, no second mixer, no Monitor/ARM wizard.** Guitar FX is one first-party native insert with an internal modular effect chain.
+
+The initial playable target is **guitar instrument -> gate -> drive -> amp model -> cabinet IR -> channel fader -> WIRE -> MAIN**. Compressor, modulation, delay and reverb can be added/bypassed within the same insert; the accepted chain is bounded and stored in the FX's versioned state. It remains compatible with ordinary external VST3 inserts elsewhere in the rack.
+
+## User-facing workflow — no guessing
+
+1. **Insert:** on a verified audio channel, open normal FX picker, select *Guitar FX Rig*. Native insertion is accepted only after a real processor lease + same-revision snapshot; when loaded, open the editor using the existing generic editor-target path (reconcile #605). If no hardware exists, retain LOGICAL_ONLY and mark audio unavailable; do not display live meters.
+2. **First sound:** load the *Clean Studio* starting preset. With an authorized output and source/WIRE route, the guitarist hears a full-range-ready tone; cabinet IR active by default. Input clip indication shows a genuine DSP peak, not simulated data.
+3. **Tone selection:** one-line top toolbar has category-filtered preset search, previous/next, favorite, A/B snapshots and a real tuner overlay. Presets may be previewed by selection; modified/dirty state is visible. No destructive preset overwrite.
+4. **Signal flow:** always-visible compact horizontal chain. Click a block to focus the **one** large editor below; click its power indicator to bypass that block; drag movable pedals to reorder. Amp/Cab are paired/guarded in V1; illegal drops rejected without altering accepted chain. Per-block change is native-ACK/readback driven in production.
+5. **Focus editor:** when AMP selected, show a realistic *amp head only* with six tactile knobs and model selector. When CAB selected, replace amp illustration with *cabinet/IR* view and microphone/IR controls. When pedal selected, show that pedal with its appropriate parameters. **Do not show amp and cabinet permanently side by side** or duplicate a second redundant tab bar below the signal chain.
+6. **Live use:** tune via overlay (audio may be temporarily muted by explicit tuner choice), change A/B snapshot intentionally, toggle all FX with the existing rack bypass (not a second bypass ownership). Input/output meter and clip are slim; CPU/latency diagnostics are accessible without dominating screen.
+7. **Save/reopen:** FX state persists through existing `.smix` and existing user-preset mechanics, using a versioned FX blob. Device reconnect retains model identity, IR reference and pedal chain; missing model/IR reports a recoverable error and keeps the previous accepted state wherever possible.
+8. **No misleading UX:** a browser-only design study must say *no audio*; actual browser /preview/ is not PCM authority. No instant green LED/processed meter before native confirmation.
+
+## Visual system and original PNG assets
+
+Hardware realism uses original *decorative* multi-resolution raster PNG layers in `design-references/guitar-fx/assets/`. The generator at `scripts/build_guitar_fx_assets.mjs` is deterministic and needs no third-party image, copyright-protected brand logo or runtime canvas. The currently committed hardware skins are original procedural drawings, not product photographs or third-party bitmaps. Their realism must be visually reviewed before production promotion.
+
+**Never embed labels, values, preset names, focus indicators, hit areas, LED logic, or translated text inside PNGs.** Render these separately in HTML/CSS over the artwork, using native ACK/readback as truth. Hardware art is not the control source of truth.
+
+| Role | PNG | Runtime behavior |
+|---|---|---|
+| Amp shell | `amp-head-class-a.png` | Original tolex and brushed faceplate. Model name, knobs, power and mode are overlays; future amp variants are skin entries, not new host controls. |
+| Cabinet shell | `cabinet-dual-12.png` | Grill/speaker drawing, mic position is a separate interactive overlay and **not** a claim that a real mic image changes DSP. |
+| Pedal chassis | `pedal-gate.png`, `pedal-compressor.png`, `pedal-overdrive.png`, `pedal-delay.png`, `pedal-modulation.png`, `pedal-chorus.png`, `pedal-reverb.png` | Shared chassis geometry. Gate, compressor, chorus and reverb each have original themed PNG skins; parameter schema is separate. |
+| Shared control | `knob-brushed-metal.png` | Rotate the same original asset based on parameter value; visible value and keyboard accessible input are separate. |
+| Status lamps | `led-active.png`, `led-bypassed.png` | Visual state after accepted snapshot, never optimistic mock PCM. |
+
+Asset design rules: preserve intrinsic aspect ratio; use `object-fit:contain` for hardware images; no dynamic raster per frame; load each raster only once; do not scale the same knob differently in ON/OFF state; target 1×/2× available by responsive CSS first and only introduce true additional exported sizes if measured blur requires it. Screen readers must access actual parameter names/values; reduced motion and keyboard focus cannot depend on decorative images. Avoid heavy CSS filters and moving full-canvas shadows.
+
+**Asset provenance gate:** each PNG must parse as valid PNG, be indexed+transparent (when applicable), non-empty and within a recorded byte-size budget; builder output must be byte-identical across runs. Replacing the image is a design review, not a hotfix to DSP.
+
+## Approved in-product editor anatomy
+
+- Row 1, compact **utility toolbar** (preset / search / favorites / A/B / Undo / tuner) and truthful IN/OUT levels, no new host device selector.
+- Row 2, one **signal chain** that communicates order, current focus and block bypass distinctly. Fit into width; if narrow, chain scrolls horizontally with visible directional affordance rather than shrinking labels below legibility.
+- Row 3, one **large focused hardware editor**. Preset browser is collapsible; stage and cab pages are alternatives, not simultaneously permanent views.
+- Row 4, slim **status footer** with accepted channel identity and route readback; never claim an arbitrary 'GUITAR IN 1 → MAIN' route if the installed ChannelId/EdgeId graph says SOURCE ONLY.
+- Editor opens in a movable/resizable native floating workspace if the generic existing FX editor supports it; preserve owner-approved mixer buttons and `/preview/`.
+
+For developer-only interactions see `design-references/guitar-fx/editor-prototype.html`. It is **not** a second published mixer, native editor, or audio producer; do not copy any of its fake values into `/preview/` as live status.
+
+## Native module and ownership boundaries
+
+```text
+approved /preview/ FX picker & existing editor host
+ -> existing web native bridge (typed request, not DSP)
+ -> NativeFxControlRequest / accepted instanceId, ChannelId, epoch, revision
+ -> NativeBuiltInFx registry: armix.builtin.guitar-rig.v1 [only after processor exists]
+ -> GuitarRigProcessor : juce::AudioProcessor
+ -> immutable GuitarRigProgram / bounded ordered ModuleDescriptor[]
+ -> Gate / Dynamics / Drive (native DSP)
+ -> AmpModelAdapter (NAM runtime on prepared compatible model)
+ -> CabinetConvolver (prepared IR)
+ -> Mod/Delay/Reverb (bounded native DSP)
+ -> existing DynamicChannelFxLeaseBank and single installed native PCM graph
+ -> existing channel WIRE / BUS / MAIN, ASIO device binding
+```
+
+**Files to extend only at integration time:** `engine/builtin_fx/GuitarRigProcessor.h` and focused DSP helpers; `src/NativeBuiltInFx.h` (catalog); existing accepted FX state/readback/restore and inspector editor; existing assets bundling recipe; focused PCM and browser tests. **No new callback**, graph publisher, ASIO manager, JS PCM path, VST3-wrapper process, or copied Main.cpp FX switch. Consult `docs/architecture/FEATURE_EXTENSION_PLAYBOOK.md`. Harmonice is a *separate vocal harmony processor*; never reuse its identity for Guitar FX.
+
+### Prepared DSP and realtime budget
+
+All NAM models, IR files, resampling tables, filters, buffers and session states load/validate/allocate on CONTROL or worker threads before an atomic processor/graph handoff. PCM callback must be bounded, no allocation, blocking, disk/network access, logging, VST3 instantiation or IR/model loading. Fixed-capacity circular buffers and parameter smoothers are per-instance. Bypass retains state and uses click-managed transitions; switch program by bounded safe crossfade and retiring old graph on CONTROL. Reject unbounded/malformed neural models and IR lengths before preparation.
+
+Start at 48 kHz / 128-sample ASIO with live cabinet active. **Never label buffer duration as round-trip latency.** Measure CPU/xrun and measured hardware round-trip latency with exact model/IR/sample rate in FAT. High-resolution/oversampling modes must declare actual PDC and explicitly cap processor time. Model and IR licensing require separately reviewed distribution; NAM runtime licensing does not automatically approve bundling third-party capture files.
+
+### Versioned program data (proposed contract, NOT installed)
+
+```json
+{
+ "schemaVersion": 1,
+ "programId": "factory.clean-studio.v1",
+ "blocks": [
+ {"id":"gate-1","type":"gate","enabled":true,"params":{"thresholdDb":-60}},
+ {"id":"drive-1","type":"drive","enabled":false,"params":{"gain":0.3}},
+ {"id":"amp-1","type":"amp","enabled":true,"modelRef":"verified-model-id"},
+ {"id":"cab-1","type":"cab","enabled":true,"irRef":"verified-ir-id"}
+ ],
+ "focusedBlockId": "amp-1",
+ "snapshotA": {},
+ "snapshotB": {}
+}
+```
+
+The persisted DSP state is independent of what is focused/expanded in the editor. Block identity is stable; reorder affects IDs, not processor lease identity. `programId` never substitutes an unverified file path. Do not store absolute transient hardware device paths in the program. State migration must be tested for V1→V2 changes. Snapshot switching is user intent with monotonic revision, not an uncorrelated JS-only optimistic mutation.
+
+## Milestones and acceptance
+
+**Foundation F0 (this branch):** UX contract, original PNG sources+rendered bitmaps, manifest, local interactive editor study and asset contracts. No audio source modifications and no user-facing new FX picker until a real processor is ready. Inspect diff, asset verifier and local editor. No Windows/Chromium heavy CI for design-only work.
+
+**M1 playable vertical slice:** ONE real native GuitarRigProcessor with gate, overdrive, a usable amp model and cabinet IR; approved FX picker/host editor, generic typed ACK, audio through ChannelId / WIRE / MAIN, valid .smix restore and safe missing-IR behavior, exact-SHA native tests and real ASIO FAT. A compiled stub with silent/pass-through audio does **not** pass.
+
+**M2 modular performance:** per-block reordering, modulation/delay/reverb, tuner, A/B snapshot, more factory presets, efficient no-pops transitions, focused editor, accessible controls and real source-vs-output meter. UI integration must reuse the existing editor and preserve /preview/ authoritative mixer.
+
+**M3 quality/reliability:** varied licensed NAM models and IRs, measured amp/cab profiling, MIDI foot control, resource limiter, 44.1/48/96k + 64/128/256 sample device tests; still one native callback. No release claim without witnessed ASIO guitar-input FAT.
+
+### Non-negotiable tests
+
+- golden-PCM: guitar -> amp/cab changes frequency/harmonic content; real wet chain vs bypass and output gain matching; no NaN/Inf/denorm problems, no silence with valid input;
+- offline: malformed/too-large/unsupported model, corrupt IR, missing file on restart, stale device epoch, duplicate command, stale block ID, invalid/multiple block reorder;
+- routing: CH05 direct IN→GuitarFX→MAIN, SOURCE ONLY keeps channel meter but MAIN silent, BUS + FX, mono/stereo device switch, external VST3 elsewhere still works;
+- RT: zero dynamic allocation/disk/locks inside processBlock, bounded DSP, accurate known PDC, deterministic clean bypass, no dangling retirement;
+- editor: keyboard/mouse/touch knob, focus vs bypass distinction, preset browsing, no false live meter, width-reflow, reduced motion, accepted snapshot after every native edit;
+- licensing/packaging: original PNG provenance, approved model+IR license/sha, rebuild reproducibility, assets bundled offline.
+
+### Trade-offs / explicit non-goals
+
+- Do not simulate mic distance or speaker blend in DSP solely because the decorative cabinet UI has a microphone circle; expose only working controls.
+- Do not conflate premium photorealism with cloning trademarked hardware logos or screenshots.
+- Do not implement an exhaustive Helix-like graph/router in M1; reserve a bounded model for later parallel paths.
+- Do not fork ArSonMix into a separate DAW or create another public `/preview/`.
+- **Realistic art needs visual iteration with the user**. The initial procedural asset pack is a lawful, reproducible starting set, not yet the finished photo-grade visual target.
diff --git a/engine/builtin_fx/GuitarRigEditor.h b/engine/builtin_fx/GuitarRigEditor.h
new file mode 100644
index 000000000..4e4ae9f8e
--- /dev/null
+++ b/engine/builtin_fx/GuitarRigEditor.h
@@ -0,0 +1,416 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+#pragma once
+#include "GuitarRigProcessor.h"
+#include
+#include
+#include
+#include
+#include
+#if defined(ARMIX_GFX_EMBED_PNG_SKINS)
+#include "BinaryData.h"
+#endif
+
+// Single native JUCE editor opened by the ALREADY EXISTING FxInstance
+// vendor-editor lease. No second WebView, callback, device or mixer.
+// Decorative original PNGs are embedded into ARMixAssets ONLY in the
+// production app; test binaries use a lightweight drawn fallback.
+namespace armix::builtin_fx {
+class GuitarRigEditor final : public juce::AudioProcessorEditor,
+ private juce::Timer {
+ using Program=armix::guitarfx::Program;
+ using Module=armix::guitarfx::Module;
+ struct HardwareKnobs final : juce::LookAndFeel_V4 {
+ juce::Image image;
+ void drawRotarySlider(juce::Graphics& g,int x,int y,int w,int h,
+ float pos,float start,float end,
+ juce::Slider& slider) override {
+ if(!image.isValid()) {
+ juce::LookAndFeel_V4::drawRotarySlider(g,x,y,w,h,pos,start,end,slider);
+ return;
+ }
+ juce::Graphics::ScopedSaveState saved(g);
+ const float cx=static_cast(x+w/2),cy=static_cast(y+h/2);
+ const float radians=start+pos*(end-start);
+ g.addTransform(juce::AffineTransform::rotation(radians,cx,cy));
+ g.drawImageWithin(image,x+3,y+3,w-6,h-6,
+ juce::RectanglePlacement::centred);
+ }
+ };
+public:
+ explicit GuitarRigEditor(GuitarRigProcessor& processor)
+ : juce::AudioProcessorEditor(processor),processor_(processor) {
+ setOpaque(true);
+ // An earlier window may have closed after PCM applied a preset but
+ // before its timer drained the completion. Reduce it before showing
+ // the restored tone: opening another editor must not display stale
+ // accepted settings from the previous window.
+ processor_.serviceCompletions();
+ selectedBank_=processor_.activeBank();
+ bankDrafts_[0]=processor_.acceptedBankProgram(0);
+ bankDrafts_[1]=processor_.acceptedBankProgram(1);
+ draft_=bankDrafts_[selectedBank_];
+ accepted_=draft_;
+ loadArt();
+ knobsLook_.image=knob_;
+ setSize(1060,640);
+ for(std::size_t i=0;i(i)+1);
+ preset_.addItem("Custom / saved state",5);
+ selectedPreset_=armix::guitarfx::identifyFactoryTone(draft_);
+ preset_.setSelectedId(selectedPreset_?selectedPreset_:5,
+ juce::dontSendNotification);
+ preset_.onChange=[this]{choosePreset(preset_.getSelectedId());};
+ addAndMakeVisible(preset_);
+ for(std::size_t i=0;i<2;++i){
+ bankButtons_[i].setButtonText(i==0?"A":"B");
+ bankButtons_[i].onClick=[this,i] {
+ requestBank(static_cast(i));
+ };
+ addAndMakeVisible(bankButtons_[i]);
+ }
+ for(std::size_t i=0;i<4;++i){
+ library_[i].setButtonText(armix::guitarfx::factoryToneNames[i]);
+ library_[i].onClick=[this,i]{
+ const int id=static_cast(i)+1;
+ preset_.setSelectedId(id,juce::dontSendNotification);
+ choosePreset(id);
+ };
+ addAndMakeVisible(library_[i]);
+ }
+ for(std::size_t i=0;i<4;++i){
+ const auto* name=names_[i];
+ focusButtons_[i].setButtonText(name);
+ focusButtons_[i].onClick=[this,i]{
+ focus_=i;refreshWidgets();repaint();
+ };
+ addAndMakeVisible(focusButtons_[i]);
+ power_[i].setButtonText("ON");
+ power_[i].setClickingTogglesState(false);
+ power_[i].onClick=[this,i]{
+ if(draft_.count<=i)return;
+ draft_.blocks[i].enabled=!draft_.blocks[i].enabled;
+ markCustom();dirty_=true;refreshWidgets();repaint();
+ };
+ addAndMakeVisible(power_[i]);
+ }
+ for(std::size_t i=0;i<3;++i){
+ sliders_[i].setSliderStyle(juce::Slider::RotaryHorizontalVerticalDrag);
+ sliders_[i].setTextBoxStyle(juce::Slider::NoTextBox,false,0,0);
+ sliders_[i].setRange(0.,1.,0.005);
+ sliders_[i].setLookAndFeel(&knobsLook_);
+ sliders_[i].onValueChange=[this,i] {
+ if(refreshing_ || focus_>=draft_.count)return;
+ draft_.blocks[focus_].values[i]=static_cast(
+ sliders_[i].getValue());
+ markCustom();dirty_=true;repaint();
+ };
+ addAndMakeVisible(sliders_[i]);
+ }
+ status_.setJustificationType(juce::Justification::centredRight);
+ status_.setColour(juce::Label::textColourId,
+ juce::Colour::fromRGB(213,170,112));
+ addAndMakeVisible(status_);
+ refreshWidgets();
+ startTimerHz(15); // UI only, never a second audio timer/callback.
+ }
+ ~GuitarRigEditor() override {
+ stopTimer();
+ // Closing a floating native editor must not discard the last knob
+ // movement made between 15 Hz UI ticks. Ownership remains in the
+ // processor after the window disappears; callback ACK can still be
+ // reduced by .smix save/reopen, without any hidden editor timer.
+ if(dirty_ && processor_.isReady()){
+ const auto id=processor_.nextRequestId();
+ if(id && processor_.queueProgram(draft_,id,selectedBank_))
+ dirty_=false;
+ }
+ // If the performer selected B while A was applying, retain B as a
+ // separate ordered intent when the editor closes mid-transition.
+ if(requestedBank_>=0 && processor_.isReady()){
+ const auto target=static_cast(requestedBank_);
+ const auto id=processor_.nextRequestId();
+ if(id) (void)processor_.queueProgram(bankDrafts_[target],id,target);
+ }
+ for(auto& slider:sliders_)slider.setLookAndFeel(nullptr);
+ }
+ void paint(juce::Graphics& g) override {
+ g.fillAll(juce::Colour::fromRGB(18,21,26));
+ const auto gold=juce::Colour::fromRGB(211,159,94);
+ const auto muted=juce::Colour::fromRGB(155,166,179);
+ g.setColour(juce::Colour::fromRGB(33,39,46));
+ g.fillRect(0,0,getWidth(),64);
+ g.fillRect(0,64,getWidth(),92);
+ g.fillRect(0,156,204,getHeight()-156);
+ g.setColour(juce::Colour::fromRGB(58,64,71));
+ g.drawLine(0.f,64.f,static_cast(getWidth()),64.f,1.f);
+ g.drawLine(0.f,156.f,static_cast(getWidth()),156.f,1.f);
+ g.drawLine(204.f,156.f,204.f,static_cast(getHeight()),1.f);
+ g.setColour(gold);
+ g.setFont(juce::Font(juce::FontOptions(20.f,juce::Font::bold)));
+ g.drawText("ArSonMix / GUITAR FX RIG",18,17,390,31,
+ juce::Justification::centredLeft);
+ g.setColour(muted);
+ g.setFont(juce::Font(juce::FontOptions(11.f)));
+ g.drawText("TONE",18,77,162,25,juce::Justification::centredLeft);
+ g.drawText("SIGNAL CHAIN • click hardware to focus",224,70,540,20,
+ juce::Justification::centredLeft);
+ g.drawText("FACTORY TONES",18,177,171,24,
+ juce::Justification::centredLeft);
+ // Focus shell deliberately uses only ONE major visual device.
+ const auto stage=juce::Rectangle(226,177,getWidth()-250,286);
+ g.setColour(juce::Colour::fromRGB(36,39,44));
+ g.fillRoundedRectangle(stage.toFloat(),12.f);
+ g.setColour(juce::Colour::fromRGB(72,70,67));
+ g.drawRoundedRectangle(stage.toFloat(),12.f,1.f);
+ const auto hero=focus_==2?amp_:focus_==3?cab_:focus_==0?gate_:pedal_;
+ const auto art=stage.reduced(20,20);
+ if(hero.isValid())
+ g.drawImageWithin(hero,art.getX(),art.getY(),art.getWidth(),
+ art.getHeight(),juce::RectanglePlacement::centred);
+ else {
+ g.setColour(juce::Colour::fromRGB(71,62,54));
+ g.fillRoundedRectangle(art.toFloat().reduced(25.f,14.f),15.f);
+ g.setColour(gold);
+ g.setFont(juce::Font(juce::FontOptions(26.f)));
+ g.drawText(names_[focus_],art,juce::Justification::centred);
+ }
+ // Bitmap artwork never contains parameter legends or live values.
+ g.setColour(gold);
+ g.setFont(juce::Font(juce::FontOptions(14.f)));
+ g.drawText(names_[focus_],246,184,290,27,
+ juce::Justification::centredLeft);
+ g.setColour(muted);
+ g.setFont(juce::Font(juce::FontOptions(12.f)));
+ for(std::size_t i=0;i(i)*188;
+ g.drawText(controlNames_[focus_][i],cx-40,549,110,22,
+ juce::Justification::centred);
+ g.setColour(gold);
+ const float normalized=draft_.blocks[focus_].values[i];
+ juce::String reading;
+ if(focus_==0 && i==0)
+ reading=juce::String(-80.f+50.f*normalized,0)+" dB";
+ else if(focus_==0 && i==1)
+ reading=juce::String(120.f*normalized,0)+" ms";
+ else if(focus_==0 && i==2)
+ reading=juce::String(12.f+228.f*normalized,0)+" ms";
+ else reading=juce::String(normalized*100.f,0)+"%";
+ g.drawText(reading,cx-40,570,110,18,
+ juce::Justification::centred);
+ g.setColour(muted);
+ }
+ if(focus_==3){
+ g.setFont(juce::Font(juce::FontOptions(12.f)));
+ g.drawText("65-TAP CABINET FIR · 32-SAMPLE CAB / 48-SAMPLE FX PDC",
+ 305,495,570,29,juce::Justification::centred);
+ }
+ g.setColour(juce::Colour::fromRGB(51,57,65));
+ g.fillRect(205,getHeight()-37,getWidth()-205,37);
+ g.setColour(muted);
+ const auto serial=processor_.observedBlockSerial();
+ const bool live=serial>0 && nowMs_-lastBlockMs_<900;
+ g.drawText(live?"PCM CALLBACK OBSERVED":"PCM OFFLINE · NO FAKE METER",
+ 225,getHeight()-34,240,30,juce::Justification::centredLeft);
+ const int peakX=getWidth()-363,peakW=125;
+ const auto paintPeak=[&](int x,float peak,const juce::String& title){
+ g.setColour(muted);
+ g.drawText(title,x-32,getHeight()-32,28,26,
+ juce::Justification::centredRight);
+ g.setColour(juce::Colour::fromRGB(24,29,34));
+ g.fillRoundedRectangle(static_cast(x),
+ static_cast(getHeight()-25),static_cast(peakW),10.f,3.f);
+ if(live){
+ const auto magnitude=std::clamp(std::isfinite(peak)?peak:0.f,0.f,1.f);
+ g.setColour(juce::Colour::fromRGB(107,193,143));
+ g.fillRoundedRectangle(static_cast(x),
+ static_cast(getHeight()-25),
+ std::max(1.f,magnitude*peakW),10.f,3.f);
+ }
+ };
+ paintPeak(peakX,processor_.observedInputPeak(),"IN");
+ paintPeak(peakX+178,processor_.observedOutputPeak(),"OUT");
+ g.setColour(live?juce::Colour::fromRGB(98,197,141):
+ juce::Colour::fromRGB(108,113,119));
+ g.fillEllipse(static_cast(getWidth()-17),
+ static_cast(getHeight()-23),9.f,9.f);
+ }
+ void resized() override {
+ preset_.setBounds(getWidth()-280,16,258,33);
+ bankButtons_[0].setBounds(getWidth()-384,18,43,30);
+ bankButtons_[1].setBounds(getWidth()-337,18,43,30);
+ status_.setBounds(16,getHeight()-105,175,46);
+ for(std::size_t i=0;i<4;++i){
+ library_[i].setBounds(18,216+static_cast(i)*54,168,43);
+ }
+ for(std::size_t i=0;i<4;++i){
+ const int x=228+static_cast(i)*199;
+ focusButtons_[i].setBounds(x,104,151,39);
+ power_[i].setBounds(x+155,108,38,30);
+ }
+ for(std::size_t i=0;i<3;++i)
+ sliders_[i].setBounds(259+static_cast(i)*188,473,116,80);
+ }
+private:
+ void timerCallback() override {
+ processor_.serviceCompletions();
+ const auto receipt=processor_.lastCompletion();
+ if(waitingId_ && receipt.requestId==waitingId_){
+ if(receipt.applied){
+ accepted_=receipt.program;
+ }else{
+ dirty_=true; // retain unsent draft after failed/cancelled command
+ }
+ waitingId_=0;
+ }
+ const auto serial=processor_.observedBlockSerial();
+ nowMs_=juce::Time::getMillisecondCounter();
+ if(serial!=lastSerial_){lastSerial_=serial;lastBlockMs_=nowMs_;}
+ if(requestedBank_>=0&&!dirty_&&!waitingId_) {
+ const auto next=static_cast(requestedBank_);
+ requestedBank_=-1;
+ activateBank(next);
+ }
+ // The existing host consumes native edits even while this FX
+ // instance or the entire rack is fully bypassed. Do not wait for
+ // observed wet PCM here: otherwise changing a pedal while bypassed
+ // silently fails, and its state is not ready when bypass turns ON.
+ // No callback -> the queued intent remains PENDING, never fake-ACKed.
+ if(dirty_&&!waitingId_&&processor_.isReady()) {
+ const auto id=processor_.nextRequestId();
+ if(id && processor_.queueProgram(draft_,id,selectedBank_)){
+ waitingId_=id;dirty_=false;
+ }
+ }
+ juce::String message;
+ if(waitingId_)message="APPLYING · awaiting PCM ACK";
+ else if(dirty_)message="PENDING · tone not yet accepted";
+ else message=(nowMs_-lastBlockMs_<900)?"DSP ACCEPTED":"DSP OFFLINE";
+ if(requestedBank_>=0)message="A/B SWITCH QUEUED";
+ status_.setText(message,juce::dontSendNotification);
+ repaint();
+ }
+ void loadArt() {
+#if defined(ARMIX_GFX_EMBED_PNG_SKINS)
+ // JUCE Image uses reference-counted image storage. Decoding 5 PNGs
+ // on every floating editor reopen is avoidable startup work; the
+ // first UI creation populates this thread-safe function-local cache
+ // and later editors only share image handles. No audio-thread IO.
+ static const std::array skins=[] {
+ return std::array{
+ juce::ImageFileFormat::loadFrom(
+ BinaryData::ampheadclassa_png,
+ static_cast(BinaryData::ampheadclassa_pngSize)),
+ juce::ImageFileFormat::loadFrom(
+ BinaryData::cabinetdual12_png,
+ static_cast(BinaryData::cabinetdual12_pngSize)),
+ juce::ImageFileFormat::loadFrom(
+ BinaryData::pedalgate_png,
+ static_cast(BinaryData::pedalgate_pngSize)),
+ juce::ImageFileFormat::loadFrom(
+ BinaryData::pedaloverdrive_png,
+ static_cast(BinaryData::pedaloverdrive_pngSize)),
+ juce::ImageFileFormat::loadFrom(
+ BinaryData::knobbrushedmetal_png,
+ static_cast(BinaryData::knobbrushedmetal_pngSize))
+ };
+ }();
+ amp_=skins[0];cab_=skins[1];gate_=skins[2];
+ pedal_=skins[3];knob_=skins[4];
+#endif
+ }
+ std::size_t activeControlCount() const noexcept {
+ return focus_==3?0u:(focus_==0||focus_==2)?3u:1u;
+ }
+ void refreshWidgets(){
+ refreshing_=true;
+ for(std::size_t i=0;i<2;++i){
+ bankButtons_[i].setColour(juce::TextButton::buttonColourId,
+ i==selectedBank_?juce::Colour::fromRGB(119,79,40):
+ juce::Colour::fromRGB(43,49,55));
+ }
+ for(std::size_t i=0;i<4;++i){
+ library_[i].setColour(juce::TextButton::buttonColourId,
+ selectedPreset_==static_cast(i)+1?
+ juce::Colour::fromRGB(91,67,43):
+ juce::Colour::fromRGB(39,44,50));
+ power_[i].setButtonText(draft_.blocks[i].enabled?"ON":"OFF");
+ focusButtons_[i].setColour(juce::TextButton::buttonColourId,
+ i==focus_?juce::Colour::fromRGB(93,67,43):
+ juce::Colour::fromRGB(49,55,61));
+ }
+ for(std::size_t i=0;i<3;++i){
+ sliders_[i].setVisible(i1)return;
+ if(target==selectedBank_){requestedBank_=-1;return;}
+ if(dirty_||waitingId_) {
+ requestedBank_=static_cast(target);
+ return;
+ }
+ activateBank(target);
+ }
+ void activateBank(std::uint8_t target) {
+ selectedBank_=target;
+ draft_=bankDrafts_[target];
+ selectedPreset_=armix::guitarfx::identifyFactoryTone(draft_);
+ preset_.setSelectedId(selectedPreset_?selectedPreset_:5,
+ juce::dontSendNotification);
+ dirty_=true;
+ refreshWidgets();
+ repaint();
+ }
+ void choosePreset(int id){
+ if(id<1||id>4)return;
+ draft_=armix::guitarfx::factoryTone(
+ static_cast(id-1));
+ bankDrafts_[selectedBank_]=draft_;
+ selectedPreset_=id;
+ dirty_=true;
+ refreshWidgets();repaint();
+ }
+ GuitarRigProcessor& processor_;
+ HardwareKnobs knobsLook_{};
+ juce::Image amp_,cab_,gate_,pedal_,knob_;
+ juce::ComboBox preset_;
+ juce::Label status_;
+ std::array focusButtons_{};
+ std::array library_{};
+ std::array bankButtons_{};
+ std::array power_{};
+ std::array sliders_{};
+ Program draft_{},accepted_{};
+ std::array bankDrafts_{};
+ std::uint8_t selectedBank_=0;
+ int requestedBank_=-1;
+ std::size_t focus_=2;
+ std::uint64_t waitingId_=0,lastSerial_=0;
+ juce::uint32 nowMs_=0,lastBlockMs_=0;
+ int selectedPreset_=1;
+ bool refreshing_=false,dirty_=false;
+ static constexpr std::array names_{
+ "GATE","OVERDRIVE","AMPLIFIER","CABINET"};
+ static constexpr std::array,4> controlNames_{{
+ {"THRESHOLD","HOLD","RELEASE"},
+ {"DRIVE","",""},
+ {"GAIN","TONE","MASTER"},
+ {"","",""}
+ }};
+};
+inline juce::AudioProcessorEditor* GuitarRigProcessor::createEditor(){
+ return new GuitarRigEditor(*this);
+}
+} // namespace armix::builtin_fx
diff --git a/engine/builtin_fx/GuitarRigProcessor.h b/engine/builtin_fx/GuitarRigProcessor.h
new file mode 100644
index 000000000..d29a59c51
--- /dev/null
+++ b/engine/builtin_fx/GuitarRigProcessor.h
@@ -0,0 +1,331 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+#pragma once
+#include "guitar/GuitarRigCore.h"
+#include "FxSpsc.h"
+#include "../core/RealtimeNativeFxControl.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+// M1 first-sound insert: one ordinary FxInstance, *not* a new mixer renderer.
+// The amp and speaker FIR are original algorithmic DSP; commercial cabinet
+// captures and NeuralAmpModeler are NOT silently embedded or represented.
+namespace armix::builtin_fx {
+class GuitarRigProcessor final : public juce::AudioProcessor,
+ public armix::mixer::RealtimeNativeFxControl {
+public:
+ static constexpr const char* catalogIdentity="armix.builtin.guitar-rig.v1";
+ static constexpr std::uint32_t stateMagic=0x47525831; // GRX1
+ static constexpr int stateHeaderBytes=12;
+ static constexpr int stateBlockBytes=44;
+ static constexpr int sessionStateVersion=2; // v1 single-tone restore retained
+ static constexpr std::uint8_t useCurrentBank=255;
+ static constexpr int crossfadeFrames=128;
+ struct Completion {
+ std::uint64_t requestId=0;
+ armix::guitarfx::Program program{};
+ bool applied=false;
+ std::uint8_t bank=0;
+ };
+
+ GuitarRigProcessor()
+ : juce::AudioProcessor(BusesProperties()
+ .withInput("Input",juce::AudioChannelSet::stereo(),true)
+ .withOutput("Output",juce::AudioChannelSet::stereo(),true)) {
+ setLatencySamples(armix::guitarfx::GuitarRigCore::processingLatencySamples);
+ }
+ const juce::String getName() const override {return "Guitar FX Rig";}
+ bool acceptsMidi() const override {return false;}
+ bool producesMidi() const override {return false;}
+ bool isMidiEffect() const override {return false;}
+ double getTailLengthSeconds() const override {return 0.;}
+ int getNumPrograms() override {return 1;}
+ int getCurrentProgram() override {return 0;}
+ void setCurrentProgram(int) override {}
+ const juce::String getProgramName(int) override {return "Studio Guitar";}
+ void changeProgramName(int,const juce::String&) override {}
+ // Uses existing generic FX editor ownership from the host. Its original
+ // hardware PNGs are linked only into the production application.
+ bool hasEditor() const override {return true;}
+ juce::AudioProcessorEditor* createEditor() override;
+ bool isBusesLayoutSupported(const BusesLayout& layout) const override {
+ return layout.getMainInputChannelSet()==juce::AudioChannelSet::stereo() &&
+ layout.getMainOutputChannelSet()==juce::AudioChannelSet::stereo();
+ }
+ void prepareToPlay(double sampleRate,int maxBlock) override {
+ // Host only calls prepare while detached/quiescent. Drain accepted
+ // completions before retuning the program to the NEW sample rate.
+ serviceCompletions();
+ Edit stale{};
+ while(queued_.pop(stale)) {
+ pending_.fetch_sub(1,std::memory_order_release);
+ lastCompletion_={stale.requestId,stale.program,false,stale.bank};
+ }
+ fadeLeft_=0;
+ fullyBypassed_=false;
+ ready_=maxBlock>=16&&maxBlock<=8192&&
+ core_.prepare(sampleRate,accepted_);
+ rate_=ready_?sampleRate:0.;
+ inputPeak_.store(0.f,std::memory_order_relaxed);
+ outputPeak_.store(0.f,std::memory_order_relaxed);
+ }
+ void releaseResources() override {ready_=false;}
+ void processBlock(juce::AudioBuffer& pcm,juce::MidiBuffer&) override {
+ juce::ScopedNoDenormals denormals;
+ if(!ready_||pcm.getNumChannels()<2){pcm.clear();return;}
+ const int samples=pcm.getNumSamples();
+ if(samples<=0)return;
+ // Exactly like EQ/Compressor/Harmonice: consume once per live block.
+ // The FxInstance also drains on its fully-bypassed fast path.
+ // Without this, knob/preset edits stall whenever Guitar FX is ON.
+ consumeRealtimeEdits();
+ auto* const left=pcm.getWritePointer(0);
+ auto* const right=pcm.getWritePointer(1);
+ float inPeak=0.f;
+ for(int i=0;i0) {
+ float newL=left[processed],newR=right[processed];
+ float oldL=newL,oldR=newR;
+ core_.processStereo(&newL,&newR,1);
+ beforeSwitch_.processStereo(&oldL,&oldR,1);
+ const float t=1.f-static_cast(fadeLeft_-1)/
+ static_cast(crossfadeFrames);
+ left[processed]=oldL*(1.f-t)+newL*t;
+ right[processed]=oldR*(1.f-t)+newR*t;
+ --fadeLeft_;++processed;
+ }
+ if(processed(samples-processed));
+ float outPeak=0.f;
+ for(int i=0;i& pcm,juce::MidiBuffer&) override {
+ pcm.clear(); // No silently unprocessed double-precision guitar output.
+ }
+ void onRealtimeBypass(bool /*requested*/,bool fully) noexcept override {
+ // The host calls this from the SINGLE callback before either its wet
+ // processBlock or its fully-bypassed CPU-saving fast path. A Guitar FX
+ // crossfade must not wait forever for PCM that is deliberately skipped.
+ if(fully&&!fullyBypassed_) {
+ // With no wet PCM consumed, a 32-sample cabinet delay would
+ // otherwise replay an old note on re-enable. Discard the stale
+ // history only when the host has finished fading to dry.
+ core_.reset();
+ beforeSwitch_.reset();
+ }
+ fullyBypassed_=fully;
+ if(fully)fadeLeft_=0;
+ }
+ void consumeRealtimeEdits() noexcept override {
+ Edit next{};
+ if(!ready_||fadeLeft_>0||!completed_.canPush()||!queued_.pop(next))return;
+ // An immutable program is prepared by CONTROL before publication.
+ // Reuse compatible delay/envelope history; unmodified filters are
+ // not restarted cold every time the player adjusts a small knob.
+ // Once fully bypassed, processBlock is intentionally skipped by the
+ // host: install the new state without a crossfade that cannot finish.
+ if(!fullyBypassed_)beforeSwitch_=core_;
+ (void)next.prepared.inheritCompatibleHistory(core_);
+ core_=next.prepared;
+ fadeLeft_=fullyBypassed_?0:crossfadeFrames;
+ (void)completed_.push({next.requestId,next.program,true,next.bank});
+ }
+
+ // SINGLE message-thread producer; reject malformed programs before
+ // touching the live DSP. No DSP compilation in processBlock.
+ std::uint64_t nextRequestId() noexcept {
+ // CONTROL only. Preserve exact monotonic identity across editor
+ // close/reopen; never use zero as a potentially valid ACK.
+ return requestSerial_::max()?
+ ++requestSerial_:0;
+ }
+ bool queueProgram(const armix::guitarfx::Program& program,
+ std::uint64_t requestId,
+ std::uint8_t bank=useCurrentBank) noexcept {
+ const auto selected=bank==useCurrentBank?activeBank_:bank;
+ if(selected>1 ||!ready_||!requestId||!std::isfinite(rate_)||
+ !armix::guitarfx::GuitarRigCore::supportsProgram(program))
+ return false;
+ Edit next{};
+ next.requestId=requestId;
+ next.program=program;
+ next.bank=selected;
+ if(!next.prepared.prepare(rate_,program))return false;
+ // CONTROL publishes outstanding intent before AUDIO can see a packet.
+ // This closes the pop->ACK gap in stateSnapshotQuiescent(); .smix
+ // must never save stale accepted state while audio applies a tone.
+ pending_.fetch_add(1,std::memory_order_release);
+ if(queued_.push(next))return true;
+ pending_.fetch_sub(1,std::memory_order_release);
+ return false;
+ }
+ // CONTROL-only. Editor timers and Show capture share one reducer.
+ // A pending GUI edit is not accepted until callback completion.
+ void serviceCompletions() noexcept {
+ Completion next{};
+ for(int i=0;i<4&&completed_.pop(next);++i) {
+ if(next.applied) {
+ accepted_=next.program;
+ bankPrograms_[next.bank]=next.program;
+ activeBank_=next.bank;
+ }
+ lastCompletion_=next;
+ pending_.fetch_sub(1,std::memory_order_release);
+ }
+ }
+ Completion lastCompletion() const noexcept {return lastCompletion_;}
+ std::uint8_t activeBank() const noexcept {return activeBank_;}
+ const armix::guitarfx::Program& acceptedBankProgram(
+ std::uint8_t bank) const noexcept {
+ // CONTROL only; callers must pass 0 or 1.
+ return bankPrograms_[bank<2?bank:0];
+ }
+ std::uint32_t pendingProgramChanges() const noexcept {
+ return pending_.load(std::memory_order_acquire);
+ }
+
+ bool isReady() const noexcept {return ready_&&core_.isReady();}
+ void sealForRealtime() noexcept override {published_=true;}
+ bool stateSnapshotQuiescent() const noexcept override {
+ // CONTROL only: closed editors cannot strand accepted completions.
+ const_cast(this)->serviceCompletions();
+ return pending_.load(std::memory_order_acquire)==0 &&
+ queued_.empty()&&completed_.empty();
+ }
+ double acceptedSampleRate() const noexcept {return rate_;}
+ const armix::guitarfx::Program& acceptedProgram() const noexcept {
+ return accepted_; // CONTROL only, after quiescent state capture.
+ }
+ float observedInputPeak() const noexcept {
+ return inputPeak_.load(std::memory_order_relaxed);
+ }
+ float observedOutputPeak() const noexcept {
+ return outputPeak_.load(std::memory_order_relaxed);
+ }
+ std::uint64_t observedBlockSerial() const noexcept {
+ return processedBlocks_.load(std::memory_order_acquire);
+ }
+
+ void getStateInformation(juce::MemoryBlock& destination) override {
+ serviceCompletions(); // CONTROL only; host holds FX snapshot gate.
+ // GRX1 v2: magic, storage version, active bank, then two bounded
+ // program blocks. Stable field-by-field schema, not struct memcpy.
+ // Legacy v1 single-tone snapshots are accepted below.
+ juce::MemoryOutputStream writer(destination,false);
+ writer.writeInt(static_cast(stateMagic));
+ writer.writeInt(sessionStateVersion);
+ writer.writeInt(static_cast(activeBank_));
+ for(const auto& bank:bankPrograms_){
+ writer.writeInt(static_cast(bank.count));
+ for(std::size_t i=0;i(block.id));
+ writer.writeInt(static_cast(block.module));
+ writer.writeInt(block.enabled?1:0);
+ for(float value:block.values)writer.writeFloat(value);
+ }
+ }
+ }
+ bool restoreUnpublishedState(const void* bytes,int length) {
+ constexpr int maxBytes=stateHeaderBytes+2*4+
+ 2*static_cast(armix::guitarfx::maxBlocks)*stateBlockBytes;
+ if(published_||!bytes||lengthmaxBytes)
+ return false;
+ juce::MemoryInputStream reader(bytes,static_cast(length),false);
+ if(static_cast(reader.readInt())!=stateMagic)
+ return false;
+ const int storageVersion=reader.readInt();
+ if(storageVersion!=1 && storageVersion!=sessionStateVersion)return false;
+ int selected=0;
+ if(storageVersion==sessionStateVersion) {
+ selected=reader.readInt();
+ if(selected<0||selected>1)return false;
+ }
+ std::array candidateBanks{};
+ int byteCount=storageVersion==1?8:stateHeaderBytes;
+ const int entries=storageVersion==1?1:2;
+ for(int bank=0;bankstatic_cast(armix::guitarfx::maxBlocks))
+ return false;
+ // Reject corrupt sizes before reading any DSP fields.
+ if(length(bank)];
+ candidate.count=static_cast(count);
+ for(int i=0;i(i)];
+ const int rawId=reader.readInt();
+ const int rawType=reader.readInt();
+ const int rawEnabled=reader.readInt();
+ if(rawId<=0||rawEnabled<0||rawEnabled>1)return false;
+ block.id=static_cast(rawId);
+ block.module=static_cast(rawType);
+ block.enabled=rawEnabled!=0;
+ for(auto& value:block.values)value=reader.readFloat();
+ }
+ byteCount+=count*stateBlockBytes;
+ if(!armix::guitarfx::GuitarRigCore::supportsProgram(candidate))
+ return false;
+ }
+ if(byteCount!=length||!reader.isExhausted())return false;
+ if(storageVersion==1)candidateBanks[1]=candidateBanks[0];
+ const auto& chosen=candidateBanks[static_cast(selected)];
+ if(ready_){
+ // CONTROL and unpublished only. No partial commit on bad state.
+ armix::guitarfx::GuitarRigCore replacement{};
+ if(!replacement.prepare(rate_,chosen))return false;
+ core_=replacement;
+ }
+ bankPrograms_=candidateBanks;
+ activeBank_=static_cast(selected);
+ accepted_=chosen;
+ return true;
+ }
+ void setStateInformation(const void* data,int size) override {
+ (void)restoreUnpublishedState(data,size);
+ }
+private:
+ struct Edit {
+ std::uint64_t requestId=0;
+ armix::guitarfx::Program program{};
+ armix::guitarfx::GuitarRigCore prepared{};
+ std::uint8_t bank=0;
+ };
+ armix::guitarfx::GuitarRigCore core_{};
+ armix::guitarfx::GuitarRigCore beforeSwitch_{};
+ FxSpsc queued_{};
+ FxSpsc completed_{};
+ Completion lastCompletion_{};
+ // CONTROL increments before publish and retires only on ACK/cancel.
+ // Tracks the in-flight gap between queue pop and completed_.push.
+ std::atomic pending_{0};
+ std::uint64_t requestSerial_=0; // CONTROL only
+ int fadeLeft_=0; // audio-owned
+ bool fullyBypassed_=false; // AUDIO callback only, host bypass hint
+ armix::guitarfx::Program accepted_=
+ armix::guitarfx::GuitarRigCore::startingProgram();
+ std::array bankPrograms_{{
+ armix::guitarfx::GuitarRigCore::startingProgram(),
+ armix::guitarfx::GuitarRigCore::startingProgram()
+ }};
+ std::uint8_t activeBank_=0; // CONTROL only, after ACK
+ std::atomic inputPeak_{0.f},outputPeak_{0.f};
+ std::atomic processedBlocks_{0};
+ double rate_=0.;
+ bool ready_=false,published_=false;
+};
+} // namespace armix::builtin_fx
diff --git a/engine/builtin_fx/guitar/GuitarFactoryTones.h b/engine/builtin_fx/guitar/GuitarFactoryTones.h
new file mode 100644
index 000000000..de061cac1
--- /dev/null
+++ b/engine/builtin_fx/guitar/GuitarFactoryTones.h
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+#pragma once
+#include "GuitarProgramModel.h"
+#include
+#include
+
+// Factory tone identity and DSP values share ONE implementation across
+// native editor, processor and restore. No duplicated UI-only preset guesses.
+// These are original algorithmic start tones, not commercial amp captures.
+namespace armix::guitarfx {
+inline constexpr std::array factoryToneNames{
+ "Clean Studio", "Warm Blues", "Vintage Crunch", "Modern Lead"
+};
+constexpr Program factoryTone(std::size_t index) noexcept {
+ Program p{};
+ p.count=4;
+ p.blocks[0]={1,Module::gate,true,{}};
+ p.blocks[1]={2,Module::overdrive,false,{}};
+ p.blocks[2]={3,Module::amplifier,true,{}};
+ p.blocks[3]={4,Module::cabinet,true,{}};
+ p.blocks[0].values[0]=0.22f;
+ p.blocks[1].values[0]=0.45f;
+ p.blocks[2].values[0]=0.20f;
+ p.blocks[2].values[1]=0.57f;
+ p.blocks[2].values[2]=0.66f;
+ switch(index) {
+ case 1:
+ p.blocks[1].enabled=true;
+ p.blocks[1].values[0]=0.22f;
+ p.blocks[2].values[0]=0.43f;
+ break;
+ case 2:
+ p.blocks[1].enabled=true;
+ p.blocks[1].values[0]=0.45f;
+ p.blocks[2].values[0]=0.62f;
+ break;
+ case 3:
+ p.blocks[1].enabled=true;
+ p.blocks[1].values[0]=0.73f;
+ p.blocks[2].values[0]=0.91f;
+ break;
+ default: break;
+ }
+ return p;
+}
+constexpr bool sameTone(const Program& a,const Program& b) noexcept {
+ if(a.version!=b.version || a.count!=b.count)return false;
+ for(std::size_t i=0;i(i)+1;
+ return 0;
+}
+static_assert(validate(factoryTone(0))==ProgramError::none);
+static_assert(validate(factoryTone(3))==ProgramError::none);
+static_assert(identifyFactoryTone(factoryTone(1))==2);
+} // namespace armix::guitarfx
diff --git a/engine/builtin_fx/guitar/GuitarOversampling2x.h b/engine/builtin_fx/guitar/GuitarOversampling2x.h
new file mode 100644
index 000000000..d4660a7e5
--- /dev/null
+++ b/engine/builtin_fx/guitar/GuitarOversampling2x.h
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+#pragma once
+#include
+#include
+#include
+#include
+
+// Bounded polyphase 2x anti-alias stage for nonlinear guitar Drive/Amp.
+// Fixed 33-tap symmetric interpolation and decimation FIR, each with 16
+// high-rate samples of group delay. Combined = 32 high-rate / 2 = exactly
+// 16 BASE-RATE samples, including 2x bypass. Prepared on CONTROL only.
+// No allocation, coefficient generation, file I/O, locks, or branches on
+// a mutable quality setting in the realtime callback.
+namespace armix::guitarfx {
+class GuitarOversampling2x final {
+public:
+ static constexpr int taps=33;
+ static constexpr int latencySamples=16;
+ static constexpr int historySamples=(taps+1)/2;
+ bool prepare(double rate) noexcept {
+ if(!std::isfinite(rate)||rate<32000.||rate>192000.)return false;
+ constexpr double pi=3.14159265358979323846;
+ // At 44.1/48k the passband is wide enough for guitar harmonics;
+ // the measured cabinet itself already rolls off well below 14kHz.
+ // A conservative transition band prevents 27kHz products folding
+ // into 21kHz on the 48kHz output.
+ const double cutoff=std::min(14000.,rate*0.30);
+ const double fsHigh=rate*2.;
+ const double fc=cutoff/fsHigh;
+ std::array next{};
+ double sum=0.;
+ for(int i=0;i(i)]=
+ static_cast(sinc*window);
+ sum+=next[static_cast(i)];
+ }
+ if(!std::isfinite(sum)||sum<=0.)return false;
+ for(auto& v:next)v=static_cast(v/sum);
+ for(int i=0;i<(taps-1)/2;++i)
+ next[static_cast(taps-1-i)]=
+ next[static_cast(i)];
+ kernel_=next;
+ rate_=rate;
+ reset();
+ ready_=true;
+ return true;
+ }
+ void reset() noexcept {
+ low_={};high_={};direct_={};
+ lowCursor_=highCursor_=directCursor_=0;
+ }
+ bool inheritHistory(const GuitarOversampling2x& previous) noexcept {
+ if(!ready_||!previous.ready_||rate_!=previous.rate_)return false;
+ low_=previous.low_;high_=previous.high_;
+ direct_=previous.direct_;
+ lowCursor_=previous.lowCursor_;
+ highCursor_=previous.highCursor_;
+ directCursor_=previous.directCursor_;
+ return true;
+ }
+ // Two output samples are interpolated from one input. Polyphase 17+16
+ // multiplications, instead of two wasteful 33-tap zero-stuffed loops.
+ void upsamplePair(float x,float& even,float& odd) noexcept {
+ low_[lowCursor_]=x;
+ float a=0.f,b=0.f;
+ std::size_t pos=lowCursor_;
+ for(int tap=0;tap(2*tap)]*previous;
+ if(tap(2*tap+1)]*previous;
+ pos=pos==0?historySamples-1:pos-1;
+ }
+ lowCursor_=lowCursor_+1==historySamples?0:lowCursor_+1;
+ even=a*2.f;
+ odd=b*2.f;
+ }
+ // Decimator output taken at the EVEN high-rate phase. Combined 2x
+ // interpolation+decimation FIR group delay is exactly 16 base frames.
+ float decimateEven(float shapedEven,float shapedOdd) noexcept {
+ const float out=downFir(shapedEven);
+ (void)downFir(shapedOdd);
+ return out;
+ }
+ // When BOTH Drive and Amp are off, preserve a real (unfiltered) dry
+ // signal with identical PDC. No 2x lowpass should color this bypass.
+ float bypassDelay(float dry) noexcept {
+ const float out=direct_[directCursor_];
+ direct_[directCursor_]=dry;
+ directCursor_=directCursor_+1==latencySamples?0:directCursor_+1;
+ return out;
+ }
+private:
+ float downFir(float input) noexcept {
+ high_[highCursor_]=input;
+ std::size_t pos=highCursor_;
+ float result=0.f;
+ for(float tap:kernel_){
+ result+=tap*high_[pos];
+ pos=pos==0?taps-1:pos-1;
+ }
+ highCursor_=highCursor_+1==taps?0:highCursor_+1;
+ return result;
+ }
+ std::array kernel_{};
+ std::array low_{};
+ std::array high_{};
+ std::array direct_{};
+ std::size_t lowCursor_=0,highCursor_=0,directCursor_=0;
+ double rate_=0.;
+ bool ready_=false;
+};
+static_assert(GuitarOversampling2x::latencySamples==16);
+} // namespace armix::guitarfx
diff --git a/engine/builtin_fx/guitar/GuitarProgramModel.h b/engine/builtin_fx/guitar/GuitarProgramModel.h
new file mode 100644
index 000000000..f80f6a86d
--- /dev/null
+++ b/engine/builtin_fx/guitar/GuitarProgramModel.h
@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+#pragma once
+#include
+#include
+#include
+
+// Guitar FX *program model*, not a second processor/graph/callback.
+// This is independent of JUCE and hardware; mutations and validation happen
+// on CONTROL. Future prepared DSP snapshots consume a validated COPY only.
+namespace armix::guitarfx {
+
+inline constexpr std::size_t maxBlocks=16;
+inline constexpr std::size_t valuesPerBlock=8;
+inline constexpr std::uint32_t schemaVersion=1;
+
+enum class Module : std::uint8_t {
+ gate=1, compressor, overdrive, amplifier, cabinet, chorus, delay, reverb
+};
+enum class ProgramError : std::uint8_t {
+ none, unsupportedSchema, invalidCount, invalidId, duplicateId,
+ invalidModule, invalidParameter, missingAmplifier, missingCabinet,
+ duplicateAmplifier, duplicateCabinet, amplifierCabinetOrder
+};
+
+struct Block {
+ // Stable *in-program* block identity. Never a ChannelId, slot, processor
+ // lease or JUCE pointer, and never inferred from a DOM position.
+ std::uint32_t id=0;
+ Module module=Module::gate;
+ bool enabled=true;
+ // Normalized domain values; typed per-module mapping comes later.
+ std::array values{};
+};
+struct Program {
+ std::uint32_t version=schemaVersion;
+ std::uint8_t count=0;
+ std::array blocks{};
+};
+
+constexpr bool known(Module kind) noexcept {
+ return kind>=Module::gate && kind<=Module::reverb;
+}
+constexpr ProgramError validate(const Program& p) noexcept {
+ if(p.version!=schemaVersion)return ProgramError::unsupportedSchema;
+ if(p.count<2||p.count>maxBlocks)return ProgramError::invalidCount;
+ std::size_t amp=maxBlocks,cab=maxBlocks;
+ for(std::size_t i=0;i=0.0f && v<=1.0f))return ProgramError::invalidParameter;
+ }
+ for(std::size_t j=i+1;jinsert;--i)
+ candidate.blocks[i]=candidate.blocks[i-1];
+ candidate.blocks[insert]=moved;
+ if(validate(candidate)!=ProgramError::none)return false;
+ result=candidate;
+ return true;
+}
+constexpr bool setEnabled(const Program& accepted,std::uint32_t id,bool enabled,
+ Program& result) noexcept {
+ if(validate(accepted)!=ProgramError::none)return false;
+ Program candidate=accepted;
+ for(std::size_t i=0;i=valuesPerBlock||
+ !(value>=0.0f&&value<=1.0f))return false;
+ Program candidate=accepted;
+ for(std::size_t i=0;i
+#include
+#include
+#include
+#include
+#include
+
+// Portable, allocation-free M1 DSP. No second audio callback or vendor model.
+// Cabinet uses a *generated original FIR*, NOT a sampled commercial cab IR;
+// neural amp captures/hi-fi IR selection are explicitly later milestones.
+namespace armix::guitarfx {
+class GuitarRigCore final {
+public:
+ static constexpr int cabinetTaps=65;
+ static constexpr int cabinetLatencySamples=(cabinetTaps-1)/2;
+ static constexpr int oversamplingLatencySamples=
+ GuitarOversampling2x::latencySamples;
+ static constexpr int processingLatencySamples=
+ cabinetLatencySamples+oversamplingLatencySamples;
+ struct Coefficients {
+ float gateThreshold=0.001f;
+ float gateCloseThreshold=0.0007f;
+ float gateAttack=0.5f,gateRelease=0.999f;
+ float gateOpenSmooth=0.995f,gateCloseSmooth=0.999f;
+ int gateHoldSamples=0;
+ float driveGain=2.f,driveHighPass=0.993f;
+ float ampGain=4.f,ampHighPass=0.997f;
+ float ampTonePole=0.5f,ampVolume=0.7f;
+ };
+
+ static constexpr Program startingProgram() noexcept {
+ return factoryTone(0);
+ }
+
+ // M1 supports exactly the four stages represented by its native
+ // hardware editor. The generic versioned Program can express richer
+ // future graphs, but this DSP never silently accepts a mismatched UI.
+ static constexpr bool supportsProgram(const Program& p) noexcept {
+ return validate(p)==ProgramError::none && p.count==4 &&
+ p.blocks[0].module==Module::gate &&
+ p.blocks[1].module==Module::overdrive &&
+ p.blocks[2].module==Module::amplifier &&
+ p.blocks[3].module==Module::cabinet;
+ }
+
+ // CONTROL only: validate complete program, construct FIR/filter constants,
+ // and reset all audio histories before publication. On failure, reject
+ // without mutating an existing ready core.
+ bool prepare(double rate,const Program& program) noexcept {
+ if(!std::isfinite(rate)||rate<32000.||rate>192000.||
+ !supportsProgram(program))return false;
+ for(std::size_t i=0;i nextIR{};
+ if(!makeCabinetIR(rate,nextIR))return false;
+ std::array nextOversampling{};
+ for(auto& o:nextOversampling)
+ if(!o.prepare(rate))return false;
+ std::array nextCoeff{};
+ for(std::size_t i=0;i(std::pow(10.,db/20.));
+ c.gateCloseThreshold=c.gateThreshold*0.65f;
+ c.gateAttack=static_cast(std::exp(-1./(0.002*rate)));
+ c.gateRelease=static_cast(std::exp(-1./(0.030*rate)));
+ // Threshold is values[0]. The unused reserved values[1..2]
+ // now control genuine hold (0..120ms) and gain RELEASE
+ // (12..240ms) without changing GRX1 v1/v2 storage.
+ const double holdSeconds=0.120*block.values[1];
+ const double closeSeconds=0.012+0.228*block.values[2];
+ c.gateHoldSamples=static_cast(rate*holdSeconds);
+ c.gateOpenSmooth=static_cast(
+ std::exp(-1./(0.0012*rate)));
+ c.gateCloseSmooth=static_cast(
+ std::exp(-1./(closeSeconds*rate)));
+ } else if(block.module==Module::overdrive){
+ c.driveGain=1.f+18.f*param*param;
+ c.driveHighPass=static_cast(
+ std::exp(-2.*pi*54./(rate*2.)));
+ } else if(block.module==Module::amplifier) {
+ c.ampGain=1.f+22.f*param*param;
+ c.ampHighPass=static_cast(
+ std::exp(-2.*pi*23./(rate*2.)));
+ const float cutoff=3200.f+4600.f*block.values[1];
+ c.ampTonePole=static_cast(
+ std::exp(-2.*pi*cutoff/(rate*2.)));
+ c.ampVolume=0.3f+0.9f*block.values[2];
+ }
+ }
+ program_=program;
+ coeff_=nextCoeff;
+ ir_=nextIR;
+ oversampling_=nextOversampling;
+ lane_={};
+ sampleRate_=rate;
+ ready_=true;
+ return true;
+ }
+ void reset() noexcept {
+ lane_={};
+ for(auto& o:oversampling_)o.reset();
+ }
+ bool isReady() const noexcept {return ready_;}
+ // AUDIO-only; the prepared program owns its new coefficients/IR, but
+ // compatible running delay/filter/envelope state is inherited from the
+ // outgoing core before the 128-frame transition. No heap, blocking,
+ // preparation or race with the CONTROL-owned prepared object.
+ // This prevents every small knob turn from starting with an empty
+ // cabinet history and cold gate. Old and new DSP run from the SAME
+ // temporal point, rather than crossfading a warm voice into silence.
+ bool inheritCompatibleHistory(const GuitarRigCore& previous) noexcept {
+ if(!ready_||!previous.ready_||
+ sampleRate_!=previous.sampleRate_ ||
+ program_.count!=previous.program_.count)return false;
+ for(std::size_t i=0;i modules{};
+ std::array cabDelay{};
+ std::size_t cabCursor=0;
+ };
+ // Bounded 65-tap symmetric, band-limited handcrafted speaker coloration.
+ // Latency is exactly the integer group delay (32 samples at all rates).
+ // It is NOT an acoustic capture of any named cabinet.
+ static bool makeCabinetIR(double rate,
+ std::array& dst) noexcept {
+ constexpr double low=95.,high=4900.;
+ constexpr double test=1000.;
+ const int center=cabinetLatencySamples;
+ for(int i=0;i(i)/(cabinetTaps-1));
+ dst[static_cast(i)]=static_cast(ideal*window);
+ }
+ // Enforce BIT-IDENTICAL mirror coefficients before pairing reads.
+ // Independently evaluated cosine windows can differ by a final ULP.
+ for(int i=0;i(cabinetTaps-1-i)]=
+ dst[static_cast(i)];
+ // Normalize at 1kHz rather than DC (this is a band-pass speaker).
+ double real=0.,imag=0.;
+ for(int i=0;i(i)]*std::cos(phase);
+ imag-=dst[static_cast(i)]*std::sin(phase);
+ }
+ const double magnitude=std::sqrt(real*real+imag*imag);
+ if(!std::isfinite(magnitude)||magnitude<1.e-5)return false;
+ for(auto& value:dst)value=static_cast(value/magnitude);
+ return true;
+ }
+ static float saturate(float x) noexcept {
+ // Smooth, bounded asymptotic overdrive; no tanh in PCM callback.
+ return x/(1.f+std::fabs(x));
+ }
+ float linkedGateGain(float amplitude) noexcept {
+ auto& history=lane_[0].modules[0]; // shared stereo detector
+ const auto& c=coeff_[0];
+ const float smooth=amplitude>history.envelope?
+ c.gateAttack:c.gateRelease;
+ history.envelope=smooth*history.envelope+
+ (1.f-smooth)*amplitude;
+ if(history.envelope>c.gateThreshold){
+ history.gateOpen=true;
+ history.gateHoldRemaining=c.gateHoldSamples;
+ } else if(history.gateOpen) {
+ if(history.gateHoldRemaining>0)
+ --history.gateHoldRemaining;
+ else if(history.envelope(cabinetLatencySamples);
+ ++tap) {
+ result+=ir_[tap]*(
+ lane.cabDelay[lo]+lane.cabDelay[hi]);
+ lo=lo==0?cabinetTaps-1:lo-1;
+ hi=hi+1==cabinetTaps?0:hi+1;
+ }
+ result+=ir_[cabinetLatencySamples]*lane.cabDelay[lo];
+ sample=result;
+ } else {
+ // CAB OFF is PDC-compatible even if Drive/Amp are bypassed.
+ const auto delayed=(lane.cabCursor+cabinetTaps-
+ cabinetLatencySamples)%cabinetTaps;
+ sample=lane.cabDelay[delayed];
+ }
+ lane.cabCursor=(lane.cabCursor+1)%cabinetTaps;
+ if(!std::isfinite(sample))return 0.f;
+ return sample>1.25f?1.25f:sample< -1.25f?-1.25f:sample;
+ }
+ Program program_{};
+ std::array coeff_{};
+ std::array ir_{};
+ std::array oversampling_{};
+ std::array lane_{};
+ double sampleRate_=0.;
+ bool ready_=false;
+};
+} // namespace armix::guitarfx
diff --git a/scripts/build_guitar_fx_assets.mjs b/scripts/build_guitar_fx_assets.mjs
new file mode 100644
index 000000000..770fae3a5
--- /dev/null
+++ b/scripts/build_guitar_fx_assets.mjs
@@ -0,0 +1,170 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Original Guitar FX decorative PNGs: deterministic, dependency-free asset builder.
+// Node: node scripts/build_guitar_fx_assets.mjs
+// Uses indexed PNG to keep hardware textures small; labels, control values,
+// hit targets and focus rings are always rendered as accessible HTML/CSS.
+const GUITAR_ASSETS = [
+ {name:"amp-head-class-a.png", w:920,h:340, kind:"amp",theme:"copper"},
+ {name:"cabinet-dual-12.png", w:720,h:360,kind:"cab",theme:"copper"},
+ {name:"pedal-gate.png",w:260,h:360,kind:"pedal",theme:"silver"},
+ {name:"pedal-compressor.png",w:260,h:360,kind:"pedal",theme:"green"},
+ {name:"pedal-overdrive.png",w:260,h:360,kind:"pedal",theme:"copper"},
+ {name:"pedal-delay.png",w:260,h:360,kind:"pedal",theme:"blue"},
+ {name:"pedal-modulation.png",w:260,h:360,kind:"pedal",theme:"green"},
+ {name:"pedal-chorus.png",w:260,h:360,kind:"pedal",theme:"blue"},
+ {name:"pedal-reverb.png",w:260,h:360,kind:"pedal",theme:"violet"},
+ {name:"knob-brushed-metal.png",w:148,h:148,kind:"knob",theme:"copper"},
+ {name:"led-active.png",w:48,h:48,kind:"ledOn",theme:"green"},
+ {name:"led-bypassed.png",w:48,h:48,kind:"ledOff",theme:"copper"}
+];
+function fxClamp(v,a=0,b=63){ return Math.max(a,Math.min(b,Math.round(v))); }
+function fxNoise(x,y,seed=0){
+ let n=(Math.imul(x,374761393)^Math.imul(y,668265263)^Math.imul(seed+71,2246822519))|0;
+ n=Math.imul(n^(n>>>13),1274126177); return ((n^(n>>>16))>>>0)/4294967295;
+}
+function fxInside(x,y,a,b,c,d,r){
+ if(xc||yd)return false;
+ const cx=Math.max(a+r,Math.min(c-r,x)),cy=Math.max(b+r,Math.min(d-r,y));
+ return (x-cx)*(x-cx)+(y-cy)*(y-cy)<=r*r;
+}
+function fxPalette(theme){
+ const bytes=new Uint8Array(768);
+ const themeRGB=theme==="blue"?[47,99,137]:theme==="green"?[56,103,77]:theme==="violet"?[104,76,124]:theme==="silver"?[102,110,119]:[143,85,46];
+ const put=(i,r,g,b)=>{bytes[i*3]=fxClamp(r,0,255);bytes[i*3+1]=fxClamp(g,0,255);bytes[i*3+2]=fxClamp(b,0,255);};
+ for(let j=0;j<64;j++){
+ const v=j/63;
+ put(j,j?11+57*v:0,j?12+54*v:0,j?15+53*v:0);
+ put(64+j,54+156*v,54+146*v,55+130*v);
+ put(128+j,64+177*v,42+135*v,19+76*v);
+ put(192+j,themeRGB[0]*.38+themeRGB[0]*1.12*v,
+ themeRGB[1]*.35+themeRGB[1]*1.23*v,themeRGB[2]*.4+themeRGB[2]*1.14*v);
+ }
+ return bytes;
+}
+function fxPixel(o,x,y){
+ const {w,h,kind}=o; const n=fxNoise(x,y,kind.length);
+ if(kind==="amp"){
+ if(!fxInside(x,y,5,15,w-6,h-9,29))return 0;
+ if(x>310&&x<610&&y<37){
+ const hd=Math.min(Math.abs(y-18),9);
+ return 64+fxClamp(18+(9-hd)*2+n*9);
+ }
+ const inner=fxInside(x,y,14,25,w-15,h-17,24);
+ if(!inner)return 1+fxClamp(5+20*n);
+ if(!fxInside(x,y,24,39,w-25,h-29,17))return 128+fxClamp(15+16*n);
+ if(y<157){
+ const stripe=(x+y)%7===0?4:0;
+ return 1+fxClamp(19+n*16+stripe+5*Math.sin(y/21));
+ }
+ if(y<163)return 128+fxClamp(37+7*n);
+ const face=fxInside(x,y,31,168,w-32,h-35,7);
+ if(!face)return 128+fxClamp(18+16*n);
+ const brushed=fxNoise(0,y,4),line=Math.sin(y*1.7)*3;
+ const v=14+35*(1-(y-168)/(h-203))+brushed*6+n*4+line;
+ if(y>h-50)return 128+fxClamp(12+n*8);
+ const sx=(x<65||x>w-65)&&(y>180&&yh*.285&&dh-28)return 64+fxClamp(15+n*14);
+ if(x<26||x>w-27)return 192+fxClamp(29+n*14);
+ const shade=7+(x/w)*7+(1-y/h)*22+n*10;
+ let body=192+fxClamp(shade);
+ const fs=Math.hypot(x-w/2,y-h*.76);
+ if(fs<31)body=64+fxClamp(44-fs*.4+n*8);
+ if(fs<19)body=64+fxClamp(16+fs*.3+n*6);
+ if(fs<9)body=64+fxClamp(41+n*9);
+ const screw=((x-38)**2+(y-39)**2<32)||((x-(w-38))**2+(y-39)**2<32);
+ if(screw)body=128+fxClamp(22+n*18);
+ return body;
+ }
+ if(kind==="knob"){
+ const cx=w/2,cy=h/2,d=Math.hypot(x-cx,y-cy);
+ if(d>w*.47)return 0;
+ const a=Math.atan2(y-cy,x-cx);
+ if(d>w*.40)return 1+fxClamp(15+n*12);
+ if(d>w*.34)return 128+fxClamp(19+21*Math.abs(Math.cos(a*19))+n*10);
+ if(d>w*.29)return 64+fxClamp(27+n*19);
+ const radial=Math.sin(a*37)*2,lighting=(cx-x)/w*25+(cy-y)/h*14;
+ let v=30+lighting+radial+8*n;
+ if(x>cx-3&&xcy-w*.25)v=62;
+ if(d23)return 0;
+ if(kind==="ledOff")return 1+fxClamp(11+8*n+(23-d)*.2);
+ if(d>17)return 1+fxClamp(6+(23-d)*3+n*4);
+ return 192+fxClamp(19+(17-d)*2+n*7);
+ }
+ return 0;
+}
+function fxCRC32(bytes){
+ let c=0xffffffff;
+ for(const b of bytes){c^=b;for(let k=0;k<8;k++)c=(c>>>1)^((c&1)?0xedb88320:0);}
+ return (c^0xffffffff)>>>0;
+}
+function fxU32(v){return [(v>>>24)&255,(v>>>16)&255,(v>>>8)&255,v&255];}
+function fxChunk(type,data){
+ const t=Array.from(type).map(c=>c.charCodeAt(0)),part=Uint8Array.from([...t,...data]);
+ return Uint8Array.from([...fxU32(data.length),...part,...fxU32(fxCRC32(part))]);
+}
+function fxPng(o){
+ const {w,h}=o,raw=new Uint8Array((w+1)*h);
+ for(let y=0;y>>8,(~length)&255,((~length)>>>8)&255);
+ for(let i=start;i>>0));
+ const ihdr=Uint8Array.from([...fxU32(w),...fxU32(h),8,3,0,0,0]);
+ const pal=fxPalette(o.theme);
+ const chunks=[fxChunk("IHDR",ihdr),fxChunk("PLTE",pal),fxChunk("tRNS",Uint8Array.from([0])),fxChunk("IDAT",Uint8Array.from(z)),fxChunk("IEND",new Uint8Array())];
+ const size=8+chunks.reduce((v,x)=>v+x.length,0),png=new Uint8Array(size);
+ png.set([137,80,78,71,13,10,26,10],0);let pos=8;
+ for(const c of chunks){png.set(c,pos);pos+=c.length;}
+ return png;
+}
+function fxBase64(bytes){
+ const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ let out="";
+ for(let i=0;i>>2]+chars[((a&3)<<4)|(b>>>4)]+(i+1>>6)]:"=")+(i+2({...o,bytes:fxPng(o)}));}
+
+import {mkdir,writeFile} from "node:fs/promises";
+import {fileURLToPath} from "node:url";
+import {resolve,dirname} from "node:path";
+const repoRoot=resolve(dirname(fileURLToPath(import.meta.url)),"..");
+const output=resolve(repoRoot,"design-references/guitar-fx/assets");
+await mkdir(output,{recursive:true});
+for(const a of buildGuitarAssets())await writeFile(resolve(output,a.name),a.bytes);
+console.log("Generated "+GUITAR_ASSETS.length+" original Guitar FX PNG assets in "+output);
diff --git a/scripts/chat_ci_dispatch.mjs b/scripts/chat_ci_dispatch.mjs
index 0c1412c37..5e6a0bb62 100644
--- a/scripts/chat_ci_dispatch.mjs
+++ b/scripts/chat_ci_dispatch.mjs
@@ -5,7 +5,7 @@ import {setTimeout as sleep} from 'node:timers/promises';
export function parseMilestoneCommand(body) {
if(typeof body!=='string')return null;
- const m=/^\/arsonmix-ci (ui|native|fat) ([0-9a-f]{40})$/.exec(body.trim());
+ const m=/^\/arsonmix-ci (ui|native|fat|field) ([0-9a-f]{40})$/.exec(body.trim());
return m?{lane:m[1],sha:m[2]}:null;
}
export function isTrustedOwnerComment(event,repo) {
@@ -78,7 +78,7 @@ export function hasPriorDispatch(runs,sha) {
// Never infer provenance from head_sha or an unstructured display title.
export function parseWindowsMilestoneRun(run) {
if(run?.event!=='workflow_dispatch')return null;
- const m=/^ArSonMix (NATIVE|FAT) PR([1-9][0-9]*) ([0-9a-f]{40})$/
+ const m=/^ArSonMix (NATIVE|FAT|FIELD) PR([1-9][0-9]*) ([0-9a-f]{40})$/
.exec(run.display_title||'');
return m?{lane:m[1].toLowerCase(),number:Number(m[2]),sha:m[3]}:null;
}
@@ -103,6 +103,11 @@ export async function guardWindowsMilestone({target,api}) {
run,identity:parseWindowsMilestoneRun(run)
})).filter(x=>x.identity?.number===target.number);
const same=runs.filter(x=>x.identity.sha===target.sha);
+ if(target.lane==='field'){
+ const existing=same.find(({run,identity})=>['fat','field'].includes(identity.lane) &&
+ (isActiveWindowsRun(run)||run.conclusion==='success'));
+ return existing?{kind:'skipped',reason:'portable-already-available-or-scheduled',target}:null;
+ }
const activeFat=runs.find(x=>x.identity.lane==='fat'&&isActiveWindowsRun(x.run));
// Never cancel an RC package build even after later PR edits: it is
// immutable field-test evidence. A new request can be made after it ends.
@@ -189,6 +194,7 @@ export async function performMilestone({event,repo,api,waitForQuick=()=>sleep(50
const inputs=target.lane==='ui'?{expected_sha:target.sha}:
{expected_sha:target.sha,package_fat:target.lane==='fat',
request_pr_number:String(target.number),
+ ...(target.lane==='field'?{field_preview:true}:{}),
...(focusedHarmony?{focused_harmony_fat:true}:{})};
// Windows always uses the reviewed CI definition from main, and checks
// out the exact PR source SHA. Run-name also carries the verified PR/SHA
diff --git a/site/preview-v2/index.html b/site/preview-v2/index.html
index eed76a44b..019006a77 100644
--- a/site/preview-v2/index.html
+++ b/site/preview-v2/index.html
@@ -1006,9 +1006,9 @@
const ceiling=Math.max(12,Math.min(100,Number(limit)||72));
const sag=Math.max(10,Math.min(ceiling,Math.min(ceiling-5,28+Math.sqrt(span)*1.55)));
const c=sag*4/3;
- // A short physical patch cable has little slack: scale its displacement,
- // number of visible lobes AND propagation time, continuously with length.
- // Long cables preserve the user-approved V62 520ms whip and end damping.
+ // V67: one-channel patches need a lively visible flex, not a nearly
+ // flat jacket. Keep wavelength/travel length-aware and retain the
+ // approved two-channel+ behaviour without increasing its impulse.
const length01=Math.max(0,Math.min(1,(chord-95)/300));
const longMix=length01*length01*(3-2*length01);
const travel=360+160*longMix;
@@ -1017,8 +1017,13 @@
const front=1-Math.pow(1-u,1.45);
const settle=Math.max(0,Math.min(1,(elapsedMs-travel)/WIRE_IMPACT_SETTLE_MS));
const fade=Math.pow(1-settle,2);
+ // The V63 .27 baseline made a one-channel cable visibly lifeless.
+ // Floor its energy near the approved two-channel feel. For a very tiny
+ // span, scale against its actual chord so the curl stays contained.
+ // At >= ~280px the V66 waveform is bit-for-bit unchanged.
+ const shortEnergy=Math.max(.78,.27+.73*longMix)*Math.min(1,chord/120);
const amplitude=Math.min(22,Math.max(14,Math.sqrt(span)*1.6))*
- (.27+.73*longMix)*fade;
+ shortEnergy*fade;
let d='M '+x0.toFixed(1)+' '+y0.toFixed(1);
for(let i=1;i<=64;i++){
const t=i/64,v=1-t;
@@ -1100,8 +1105,11 @@
const width=.59-.24*longMix;
const sag=Math.min(44,Math.max(10,Math.sqrt(chord)*2.1))*
Math.pow(remaining,.78);
+ // Keep the fast OUT-origin reel lively even for adjacent-channel wires.
+ // At two-channel spans and beyond the V66 motion remains unchanged.
+ const shortEnergy=Math.max(.80,.46+.54*longMix);
const amplitude=Math.min(32,Math.max(14,Math.sqrt(chord)*1.5))*
- (.46+.54*longMix)*Math.pow(remaining,.29)*
+ shortEnergy*Math.pow(remaining,.29)*
Math.min(1,p/.07)*Math.min(1,chord*remaining/55);
const recoil=amplitude*.13*catchUp*
Math.sin(2*Math.PI*Math.max(0,p-.19)/.26);
diff --git a/src/Main.cpp b/src/Main.cpp
index 65682c5ea..3e0f13a55 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -6884,13 +6884,13 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
servicePendingNativeThrow();
saveClosedLogicalVendorEditor();
// A hidden JUCE/WebView2 peer may defer first navigation. Expose the
- // compositor behind the opaque startup splash after the first tick;
- // the user sees the completed mixer only after the ready handshake.
+ // compositor while the opaque always-on-top splash masks its first
+ // frame. Never call toBack(): it can leave the finished mixer behind
+ // unrelated desktop windows when Windows refuses foreground activation.
if (!webViewPeerWarmed_)
{
webViewPeerWarmed_ = true;
setVisible (true);
- toBack();
browser_.resized(); // first visible HWND, not its pre-splash size
}
// Existing message-thread 12 Hz timer: no extra worker or DSP work.
@@ -7377,8 +7377,8 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer
if (window_) window_->setVisible (false);
updateProbeCompleteTick_ = juce::Time::getMillisecondCounter();
}
- else if (window_)
- window_->toFront (true);
+ else if (stage == 2)
+ presentMixerOnStartup();
}
});
#if defined(_WIN32)
@@ -7426,6 +7426,39 @@ class ConsoleApp final : public juce::JUCEApplication, private juce::Timer
#endif
}
private:
+ void presentMixerOnStartup()
+ {
+ // GUI ready is the *only* normal-launch transition that may foreground
+ // the mixer. No polling, always-on-top mixer or focus stealing after
+ // a user starts working in another app. The updater's silent probe
+ // must remain entirely invisible.
+ if (startupMixerPresented_ || !window_ || isAutoUpdateHealthProbe())
+ return;
+ startupMixerPresented_ = true;
+ window_->setVisible (true);
+ window_->setMinimised (false);
+ window_->toFront (true);
+#if defined(_WIN32)
+ if (auto* peer = window_->getPeer())
+ {
+ auto* hwnd = static_cast (peer->getNativeHandle());
+ if (hwnd != nullptr && ::IsWindow (hwnd))
+ {
+ // Windows may ignore JUCE's initial foreground request after
+ // the splash was a separate TOPMOST HWND. Raise once through
+ // the native Z-order, then immediately return to NOTOPMOST.
+ // This is not a persistent Always On Top setting.
+ constexpr auto flags = SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE;
+ ::SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags);
+ ::SetWindowPos (hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, flags);
+ ::SetForegroundWindow (hwnd); // best effort; Windows owns focus policy
+ }
+ }
+#endif
+ window_->grabKeyboardFocus();
+ }
+ bool startupMixerPresented_ = false;
+
#if defined(_WIN32)
void serviceSmartUpdateAcknowledgement()
{
diff --git a/src/NativeBuiltInFx.h b/src/NativeBuiltInFx.h
index 6bd9ba6d1..28e00b8c0 100644
--- a/src/NativeBuiltInFx.h
+++ b/src/NativeBuiltInFx.h
@@ -6,6 +6,7 @@
#include "../engine/builtin_fx/ChannelHarmonyProcessor.h"
#include "../engine/builtin_fx/VocalThrowProcessor.h"
#include "../engine/builtin_fx/SonKuSpatialProcessor.h"
+#include "../engine/builtin_fx/GuitarRigEditor.h"
#include "../engine/core/PreparedMixerBlock.h"
#include
#include
@@ -77,6 +78,11 @@ inline constexpr std::array nativeBuiltInFx{
"NATIVE_THROW_UNSUPPORTED_AUDIO_FORMAT","NATIVE_THROW_PREPARE_REJECTED",
"NATIVE_THROW_PREPARE_EXCEPTION","Saved native Vocal Throw state rejected; graph unchanged",
prepareNativeBuiltInFx},
+ NativeBuiltInFx{GuitarRigProcessor::catalogIdentity,"Guitar FX Rig","Guitar",true,32000.,192000.,
+ "NATIVE_GFX_HOST_UNAVAILABLE","NATIVE_GFX_DEVICE_CHANGED",
+ "NATIVE_GFX_UNSUPPORTED_AUDIO_FORMAT","NATIVE_GFX_PREPARE_REJECTED",
+ "NATIVE_GFX_PREPARE_EXCEPTION","Saved Guitar FX Rig state rejected; graph unchanged",
+ prepareNativeBuiltInFx},
NativeBuiltInFx{SonKuSpatialProcessor::catalogIdentity,"8D-SonKu","Spatial",true,44100.,48000.,
"NATIVE_SONKU_HOST_UNAVAILABLE","NATIVE_SONKU_DEVICE_CHANGED",
"NATIVE_SONKU_UNSUPPORTED_AUDIO_FORMAT","NATIVE_SONKU_PREPARE_REJECTED",
diff --git a/tests/approved_native_m2_contract.test.cjs b/tests/approved_native_m2_contract.test.cjs
index 327d67991..8e09afd3d 100644
--- a/tests/approved_native_m2_contract.test.cjs
+++ b/tests/approved_native_m2_contract.test.cjs
@@ -2164,6 +2164,35 @@ test("O3 OUTPUTS stays in one existing Audio I/O with safe, read-only DOM",()=>{
assert.doesNotMatch(bridge,/owner\.innerHTML=patch/);
});
+test("Guitar FX picker binding is real, visible and matches native installed registry",()=>{
+ const bridge=read("web/approved-native-bridge.js");
+ const catalog=read("src/NativeBuiltInFx.h");
+ const processor=read("engine/builtin_fx/GuitarRigProcessor.h");
+ const host=read("src/Main.cpp");
+ const guiBuilder=read("scripts/build_approved_native_gui.py");
+ const id="armix.builtin.guitar-rig.v1";
+ const start=bridge.indexOf("let nativeBuiltins=Object.freeze([");
+ const end=bridge.indexOf("const presentFxCatalog=",start);
+ assert.ok(start>0 && end>start,"compiled native catalog exists");
+ const builtinSlice=bridge.slice(start,end);
+ assert.ok(builtinSlice.includes('id:"'+id+'",name:"Guitar FX Rig"'));
+ assert.ok(builtinSlice.includes('category:"Guitar",format:"Native",source:"builtin"'));
+ assert.ok(processor.includes('catalogIdentity="'+id+'"'),
+ "native processor ID matches UI catalog");
+ assert.ok(catalog.includes('GuitarRigProcessor::catalogIdentity,"Guitar FX Rig","Guitar",true'),
+ "C++ native registry advertises exactly the same visible FX");
+ assert.ok(host.includes('for(const auto& fx:armix::builtin_fx::nativeBuiltInFx)'));
+ assert.ok(host.includes('entry->setProperty("showInPicker",fx.showInPicker)'));
+ assert.ok(host.includes('setProperty("builtIns",juce::var(builtIns))'));
+ assert.ok(bridge.includes("if(Array.isArray(catalog.builtIns))"));
+ assert.ok(bridge.includes("nativeBuiltins=catalog.builtIns.filter"));
+ assert.ok(bridge.includes("const presentFxCatalog=()=>scope?.setNativeCatalog?.("));
+ assert.ok(guiBuilder.includes("setNativeCatalog(rows)"));
+ assert.ok(guiBuilder.includes("renderPluginCatalog();renderFastPicker();"));
+ assert.ok(bridge.includes('controller.intent("LOAD_INSERT",nativeId,'));
+ assert.ok(bridge.includes('pendingFxInsert={authority:"CHANNEL_ID"'));
+});
+
test("SOF double-click and target selection never commandeer MAIN fader",()=>{
const html=read("site/preview-v2/index.html");
const bridge=read("web/approved-native-bridge.js");
diff --git a/tests/approved_native_offline_logical_smoke.py b/tests/approved_native_offline_logical_smoke.py
index 0bf4d3a2e..ff07d608a 100644
--- a/tests/approved_native_offline_logical_smoke.py
+++ b/tests/approved_native_offline_logical_smoke.py
@@ -135,15 +135,33 @@ def main():
e.payload?.action==='logicalVendorFxEditor')?.payload""")
assert vendor["instanceId"]=="logical-vendor" and vendor["deviceEpoch"]=="0"
assert not page.locator("#fastPicker").is_visible()
+ # Genuine native GFX must be exposed before any asynchronous VST
+ # discovery. The static fallback is validated against the same
+ # catalog ID compiled into the GuitarRigProcessor.
+ rack.locator('[data-action="openPlugin"][data-slot="2"]').click()
+ assert page.locator('[data-fast-id="armix.builtin.guitar-rig.v1"]').is_visible(), (
+ "Guitar FX missing at first native picker open")
+ page.locator("#fastClose").click()
emit(page, "arMixCatalog", {"items": [], "builtIns": [
{"id": "armix.builtin.fixture.v1", "name": "Fixture processor", "category": "Utility"},
+ {"id": "armix.builtin.guitar-rig.v1", "name": "Guitar FX Rig",
+ "category": "Guitar", "showInPicker": True},
{"id": "armix.builtin.hidden.v1", "name": "Hidden processor", "showInPicker": False},
]})
rack.locator('[data-action="openPlugin"][data-slot="2"]').click()
assert page.locator("#fastPicker").is_visible()
assert page.locator('[data-fast-id="armix.builtin.fixture.v1"]').is_visible()
assert page.locator('[data-fast-id="armix.builtin.hidden.v1"]').count() == 0
+ guitar=page.locator('[data-fast-id="armix.builtin.guitar-rig.v1"]')
+ assert guitar.is_visible(), "Guitar FX Rig missing from user-facing FX picker"
+ search=page.locator("#fastSearch")
+ search.fill("guitar")
+ assert guitar.is_visible(), "Guitar FX Rig must be searchable by name/category"
+ assert page.locator('[data-fast-id="armix.builtin.fixture.v1"]').count() == 0
page.locator("#fastClose").click()
+ # We test pending guitar INSERT at the END of this workspace.
+ # Creating a pending logical edit here would otherwise contaminate
+ # subsequent CREATE_CHANNEL/WIRE_TRANSACTION assertions.
# The approved mixer virtualizes/banks strips. Count native-owned
# model channels, not only the currently mounted DOM bank.
assert page.evaluate("()=>window.__ARMIX_NATIVE_SCOPE__.tracks.length")==14
@@ -221,6 +239,21 @@ def main():
emit(page,"arMixLogicalAck",{"requestId":fresh["requestId"],
"status":"REJECTED","errorCode":"TEST_DISK_WRITE_FAILED","revision":"3"})
assert page.evaluate("()=>window.__ARMIX_NATIVE_SCOPE__.tracks.length")==14
+ # Now assert actual selection dispatches the correct Guitar FX id.
+ # Leave pending ADD_FX_REFERENCE as the LAST edit; it must not
+ # falsely advertise a physical processor or block other fixtures.
+ page.locator("#tracks .strip").first.locator(
+ '[data-action="openPlugin"][data-slot="0"]').click()
+ guitar=page.locator('[data-fast-id="armix.builtin.guitar-rig.v1"]')
+ assert guitar.is_visible(), "Guitar FX missing after changing workspaces"
+ page.locator("#fastSearch").fill("guitar")
+ guitar.click()
+ page.wait_for_function("""()=>window.__events.some(e=>
+ e.name==='arMixLogicalIntent' &&
+ e.payload?.operation==='ADD_FX_REFERENCE' &&
+ e.payload?.payload?.catalogId==='armix.builtin.guitar-rig.v1')""")
+ assert page.locator("#fastPicker").is_visible(), (
+ "Unacknowledged Guitar FX insert must not look accepted")
assert not errors,errors
page.close()
# Device-loss boundary: the retained PCM graph may still carry a
diff --git a/tests/chat_ci_dispatch_contract.test.mjs b/tests/chat_ci_dispatch_contract.test.mjs
index eb8c9dd49..e64f414ff 100644
--- a/tests/chat_ci_dispatch_contract.test.mjs
+++ b/tests/chat_ci_dispatch_contract.test.mjs
@@ -19,7 +19,7 @@ const pr=(head=sha)=>({
});
test('owner command parser requires a single bounded command and lowercase SHA',()=>{
- for(const lane of ['ui','native','fat'])
+ for(const lane of ['ui','native','fat','field'])
assert.deepEqual(parseMilestoneCommand('/arsonmix-ci '+lane+' '+sha),{lane,sha});
for(const bad of ['/arsonmix-ci all '+sha,'/arsonmix-ci fat main',
'/arsonmix-ci fat '+sha+'; rm -rf .','/arsonmix-ci fat '+sha+'\necho unsafe',
@@ -275,7 +275,7 @@ test('CI workflow preserves FAT while deduplicating cheaper native builds and up
assert.match(wf,/request_pr_number:/);
assert.match(wf,/inputs\.package_fat && github\.run_id/);
assert.match(wf,/cancel-in-progress: .*?!inputs\.package_fat/);
- assert.equal(wf.match(/compression-level: 0/g)?.length,2);
+ assert.equal(wf.match(/compression-level: 0/g)?.length,3);
assert.match(wf,/Build executable and native RT tests/);
assert.match(wf,/ctest --test-dir build -C Release --output-on-failure/);
assert.match(wf,/build_verify_windows_installer\.ps1/);
@@ -290,7 +290,8 @@ test('FAT upload is independently retryable without a second Windows compiler an
assert.match(build,/Seal exact-SHA FAT delivery payload after all installer tests/);
assert.match(build,/Save completed FAT packages for retryable upload job/);
assert.match(build,/actions\/cache\/save@v4/);
- assert.doesNotMatch(build,/actions\/upload-artifact@v4/);
+ assert.equal((build.match(/actions\/upload-artifact@v4/g)||[]).length,1);
+ assert.match(build,/Upload portable Windows field preview\n +if: \$\{\{ env\.FIELD_PREVIEW == 'true' \}\}\n +uses: actions\/upload-artifact@v4/);
assert.match(upload,/needs: windows-build/);
assert.match(upload,/runs-on: windows-2022/);
assert.match(upload,/actions\/cache\/restore@v4/);
@@ -306,3 +307,21 @@ test('FAT upload is independently retryable without a second Windows compiler an
assert.match(build,/Prove two authentic historical Inno releases upgrade and roll back/);
assert.match(build,/build_verify_windows_installer\.ps1/);
});
+
+
+test('field preview dispatches exact source without cancelling native or another PR',async()=>{
+ const request=event('/arsonmix-ci field '+sha);
+ const calls=[];
+ const active=[windowsRun(1,'native',418,sha),windowsRun(2,'field',419,sha)];
+ assert.equal((await performMilestone({event:request,repo,api:checkedApi(active,calls)})).kind,'dispatched');
+ assert.equal(calls.some(call=>call.path.endsWith('/cancel')),false);
+ assert.deepEqual(calls.at(-1).data,{ref:'main',inputs:{
+ expected_sha:sha,package_fat:false,request_pr_number:'418',field_preview:true
+ }});
+ for(const lane of ['field','fat']){
+ const duplicate=[];
+ assert.equal((await performMilestone({event:request,repo,api:checkedApi(
+ [windowsRun(3,lane,418,sha)],duplicate)})).reason,'portable-already-available-or-scheduled');
+ assert.equal(duplicate.some(call=>call.method==='POST'),false);
+ }
+});
diff --git a/tests/ci_workflow_efficiency_test.mjs b/tests/ci_workflow_efficiency_test.mjs
index 8bc4e72df..bfe1b40af 100644
--- a/tests/ci_workflow_efficiency_test.mjs
+++ b/tests/ci_workflow_efficiency_test.mjs
@@ -71,14 +71,17 @@ test('native PCM and device changes always use Windows/CTest, never Chromium by
});
test('Full native/release qualification retains all CTests; focused vocal harmony FAT compiles only its verified targets', () => {
- assert.match(native, /-DBUILD_TESTING=ON/);
+ assert.match(native, /-DBUILD_TESTING=\$\{\{ env\.FIELD_PREVIEW == 'true' && 'OFF' \|\| 'ON' \}\}/);
+ assert.match(native, /Build portable Windows field preview[\s\S]*?--target ARMixConsole/);
+ assert.match(native, /FIELD_PREVIEW_FULL_CTEST_NOT_RUN/);
+ assert.match(native, /Upload portable Windows field preview[\s\S]*?name: ArSonMix-Windows-Field-Preview-/);
const fullBuild = native.indexOf('run: cmake --build build --config Release --parallel 2');
const fullCTest = native.indexOf('run: ctest --test-dir build -C Release --output-on-failure');
assert.ok(fullBuild >= 0 && fullCTest > fullBuild,
'Full CTest still requires the default all-target CMake build');
assert.match(native, /focused_harmony_fat:/);
assert.match(native, /FOCUSED_HARMONY_FAT: \$\{\{ github\.event_name == 'workflow_dispatch' && inputs\.package_fat == true && inputs\.focused_harmony_fat == true \}\}/);
- assert.match(native, /if: \$\{\{ env\.FOCUSED_HARMONY_FAT != 'true' \}\}/);
+ assert.match(native, /if: \$\{\{ env\.FOCUSED_HARMONY_FAT != 'true' && env\.FIELD_PREVIEW != 'true' \}\}/);
assert.match(native, /if: \$\{\{ env\.FOCUSED_HARMONY_FAT == 'true' \}\}/);
assert.match(native, /cmake --build build --config Release --parallel 2 --target \$targets/);
assert.match(native, /'ARMixConsole'/);
@@ -336,3 +339,16 @@ test('CI-only main commits never schedule unqualified full Chromium or Pages wor
assert.match(pages,/github\.event\.workflow_run\.conclusion == 'success'/);
assert.match(pages,/github\.event\.workflow_run\.event == 'push'/);
});
+
+test('portable Windows preview metadata is written before release ZIP verification, with no unverified extra files',()=>{
+ const fieldMark=native.indexOf('- name: Mark unqualified field preview BEFORE independent distribution verification');
+ const verify=native.indexOf('- name: Independently verify release ZIP and embedded GUI/engine before upload');
+ const upload=native.indexOf('- name: Upload portable Windows field preview');
+ assert.ok(fieldMark>=0&&fieldMarkcreateHash("sha256").update(b).digest("hex");
+function readPNG(path){
+ const b=readFileSync(path),sig=Buffer.from([137,80,78,71,13,10,26,10]);
+ assert(b.subarray(0,8).equals(sig),"valid PNG signature");
+ const w=b.readUInt32BE(16),h=b.readUInt32BE(20);
+ assert.equal(b[24],8,"8-bit depth");assert.equal(b[25],3,"indexed palette");
+ let off=8,idat=[],alpha=false,palette=false,end=false;
+ while(off+12<=b.length){
+ const n=b.readUInt32BE(off),tag=b.toString("ascii",off+4,off+8);
+ assert(off+n+12<=b.length,"PNG chunk bounds");
+ const d=b.subarray(off+8,off+8+n);
+ if(tag==="PLTE")palette=true;
+ if(tag==="tRNS")alpha=d[0]===0;
+ if(tag==="IDAT")idat.push(d);
+ if(tag==="IEND"){end=true;break}
+ off+=12+n;
+ }
+ assert(palette&&alpha&&end&&idat.length>0,"complete indexed PNG with transparency");
+ const rows=inflateSync(Buffer.concat(idat));
+ assert.equal(rows.length,h*(w+1),"exact image data");
+ for(let y=0;yi%(w+1)!==0&&v!==0),"not blank");
+ return {b,w,h};
+}
+test("all original PNGs decode within bounded dimensions and sizes",()=>{
+ for(const [name,w,h,limit] of expected){
+ const f=readPNG(resolve(assetDir,name));
+ assert.equal(f.w,w,name);assert.equal(f.h,h,name);
+ assert(f.b.length<=limit,name+" exceeds asset budget");
+ }
+});
+test("generator is deterministic and isolated from approved mixer assets",()=>{
+ const paths=expected.map(([name])=>resolve(assetDir,name));
+ const before=paths.map(p=>sha256(readFileSync(p)));
+ execFileSync(process.execPath,["scripts/build_guitar_fx_assets.mjs"],{cwd:root,stdio:"pipe"});
+ assert.deepEqual(paths.map(p=>sha256(readFileSync(p))),before,"byte-identical rerun");
+ const src=readFileSync(resolve(root,"scripts/build_guitar_fx_assets.mjs"),"utf8");
+ assert(src.includes("GUITAR_ASSETS"));
+ assert(!src.includes("site/preview-buttons"));
+});
+test("editor prototype cannot claim PCM nor send production native control",()=>{
+ const html=readFileSync(resolve(root,"design-references/guitar-fx/editor-prototype.html"),"utf8");
+ for(const s of ["DESIGN ONLY","NO AUDIO","assets/amp-head-class-a.png","cabinet-dual-12.png","assets/knob-brushed-metal.png","data-power","reorder("])
+ assert(html.includes(s),"expected design marker "+s);
+ assert(!html.includes("arMixConsoleIntent"));
+ assert(!html.includes("AudioContext"));
+});
+
+test("native JUCE editor uses the generated binary resource identifiers",()=>{
+ const editor=readFileSync(resolve(root,"engine/builtin_fx/GuitarRigEditor.h"),"utf8");
+ const cmake=readFileSync(resolve(root,"CMakeLists.txt"),"utf8");
+ const main=readFileSync(resolve(root,"src/Main.cpp"),"utf8");
+ // JUCE BinaryData strips hyphens from stems: arsonmix-256.png is
+ // BinaryData::arsonmix256_png, NOT BinaryData::arsonmix_256_png.
+ assert(main.includes("BinaryData::arsonmix256_png"),"verified production JUCE naming");
+ assert(cmake.includes("ARMIX_GUITAR_SKIN_PNGS"),"GFX images are embedded");
+ assert(cmake.includes("juce_add_binary_data(ARMixAssets"),"one existing app resource target");
+ for(const name of [
+ "amp-head-class-a.png",
+ "cabinet-dual-12.png",
+ "pedal-gate.png",
+ "pedal-overdrive.png",
+ "knob-brushed-metal.png"
+ ]){
+ const id=name.replace(/\.png$/,"").replace(/[^A-Za-z0-9_]/g,"")+"_png";
+ assert(editor.includes("BinaryData::"+id),name+" correct generated JUCE identifier");
+ assert(editor.includes("BinaryData::"+id+"Size"),name+" corresponding size constant");
+ assert(!editor.includes("BinaryData::"+name.replaceAll("-","_").replace(".png","_png")),
+ name+" must not reference non-existent underscore-hyphen symbol");
+ }
+});
+
+test("reopened native editor reduces prior accepted PCM completions before painting the tone",()=>{
+ const editor=readFileSync(resolve(root,"engine/builtin_fx/GuitarRigEditor.h"),"utf8");
+ const start=editor.indexOf("explicit GuitarRigEditor(");
+ const consume=editor.indexOf("processor_.serviceCompletions();",start);
+ const bankA=editor.indexOf("bankDrafts_[0]=processor_.acceptedBankProgram(0);",start);
+ const bankB=editor.indexOf("bankDrafts_[1]=processor_.acceptedBankProgram(1);",start);
+ const chosen=editor.indexOf("draft_=bankDrafts_[selectedBank_];",start);
+ assert(start>=0 && consume>start && bankA>consume && bankB>bankA &&
+ chosen>bankB,"editor must restore both native A/B snapshots after ACK");
+ assert(editor.includes("processor_.queueProgram(draft_,id,selectedBank_)"),
+ "A/B selection must name the native target bank during control ACK");
+});
+
+test("bypassed Guitar FX editor may enqueue tone without a live wet meter",()=>{
+ const editor=readFileSync(resolve(root,"engine/builtin_fx/GuitarRigEditor.h"),"utf8");
+ const processor=readFileSync(resolve(root,"engine/builtin_fx/GuitarRigProcessor.h"),"utf8");
+ assert(editor.includes("processor_.queueProgram(draft_,id,selectedBank_)"));
+ assert(!editor.includes("processor_.isReady()&&serial>0"),
+ "guitar bypass must not disable native tone edits");
+ assert(processor.includes("pending_.fetch_add(1,std::memory_order_release)"),
+ "unacknowledged tone must block stale session save");
+ assert(editor.includes("~GuitarRigEditor() override") &&
+ editor.includes("processor_.queueProgram(bankDrafts_[target],id,target)"),
+ "closing editor must preserve queued native A/B switch");
+});
+
+test("native hardware PNG decoding is cached across editor close/reopen",()=>{
+ const editor=readFileSync(resolve(root,"engine/builtin_fx/GuitarRigEditor.h"),"utf8");
+ assert(editor.includes("static const std::array skins"),
+ "native editor must not decode all five PNG resources for every window");
+ for(const key of ["amp_","cab_","gate_","pedal_","knob_"])
+ assert(editor.includes(key+"=skins["),key+" shares cached image resource");
+});
+
+test("Guitar FX stereo-linked gate and visible hold/release are real native controls",()=>{
+ const core=readFileSync(resolve(root,"engine/builtin_fx/guitar/GuitarRigCore.h"),"utf8");
+ const editor=readFileSync(resolve(root,"engine/builtin_fx/GuitarRigEditor.h"),"utf8");
+ assert(core.includes("linkedGateGain(") &&
+ core.includes("std::max(std::fabs(leftIn),std::fabs(rightIn))"),
+ "stereo-linked guitar gate must use max level without summing to mono");
+ assert(core.includes("gateHoldSamples") && core.includes("gateCloseSmooth"),
+ "Hold/Release parameters must change DSP timing");
+ assert(editor.includes('{"THRESHOLD","HOLD","RELEASE"}'),
+ "visible controls must match three real gate parameters");
+ for(const value of ["-80.f+50.f*normalized","120.f*normalized",
+ "12.f+228.f*normalized"])
+ assert(editor.includes(value),"gate values must use engineering dB/ms labels");
+});
+
+test("Guitar FX 2x polyphase processing preserves an authoritative fixed PDC",()=>{
+ const core=readFileSync(resolve(root,"engine/builtin_fx/guitar/GuitarRigCore.h"),"utf8");
+ const proc=readFileSync(resolve(root,"engine/builtin_fx/GuitarRigProcessor.h"),"utf8");
+ const overs=readFileSync(resolve(root,"engine/builtin_fx/guitar/GuitarOversampling2x.h"),"utf8");
+ const portable=readFileSync(resolve(root,"tests/guitar_fx_core_pcm_test.cpp"),"utf8");
+ assert(overs.includes("static constexpr int latencySamples=16"));
+ assert(core.includes("processingLatencySamples=") &&
+ core.includes("cabinetLatencySamples+oversamplingLatencySamples"));
+ assert(proc.includes("setLatencySamples(armix::guitarfx::GuitarRigCore::processingLatencySamples)"));
+ assert(overs.includes("upsamplePair(") && overs.includes("decimateEven("));
+ assert(core.includes("const float matchedDry=oversampling_[ch].bypassDelay(input)"),
+ "clean path must have same fixed PDC and warm dry history");
+ assert(portable.includes("assert(aliasedThirdDb < -35.0)"),
+ "folded 21kHz alias must remain a hard regression gate");
+});
diff --git a/tests/guitar_fx_core_pcm_test.cpp b/tests/guitar_fx_core_pcm_test.cpp
new file mode 100644
index 000000000..14f01e985
--- /dev/null
+++ b/tests/guitar_fx_core_pcm_test.cpp
@@ -0,0 +1,295 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+#if defined(NDEBUG)
+#undef NDEBUG
+#endif
+#include "../engine/builtin_fx/guitar/GuitarRigCore.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace armix::guitarfx;
+static_assert(GuitarRigCore::cabinetLatencySamples==32);
+static_assert(GuitarRigCore::oversamplingLatencySamples==16);
+static_assert(GuitarRigCore::processingLatencySamples==48);
+int main() {
+ GuitarRigCore core;
+ const auto factory=GuitarRigCore::startingProgram();
+ assert(validate(factory)==ProgramError::none);
+ assert(!core.prepare(0.,factory));
+ assert(!core.prepare(std::numeric_limits::quiet_NaN(),factory));
+ assert(!core.prepare(192001.,factory));
+ assert(core.prepare(48000.,factory));
+ assert(core.isReady());
+ std::array l{},r{};
+ constexpr float gain=0.11f;
+ for(std::size_t i=0;i0.00001 && difference>0.005 && changed>0.001);
+ const auto priorWet=wet;
+ Program quiet=factory;
+ quiet.blocks[2].values[0]=0.95f; // higher amp drive produces a different PCM.
+ assert(core.prepare(48000.,quiet));
+ l=original;r=original;
+ core.processStereo(l.data(),r.data(),l.size());
+ double differenceInTone=0.;
+ for(std::size_t i=128;i same output
+ assert(differenceInTone<1.e-6);
+ double moreDrive=0.;
+ for(auto s:l)moreDrive+=s*s;
+ assert(std::fabs(priorWet-moreDrive)>1.e-5);
+
+ // Explicit cabinet bypass preserves group delay but not spectral contour.
+ auto raw=factory;raw.blocks[3].enabled=false;raw.blocks[0].enabled=false;
+ raw.blocks[2].enabled=false;raw.blocks[1].enabled=false;
+ assert(core.prepare(48000.,raw));
+ l.fill(0.f);r.fill(0.f);l[0]=1.f;r[0]=1.f;
+ core.processStereo(l.data(),r.data(),l.size());
+ for(int i=0;i(i)])<1.e-7f);
+ assert(std::fabs(l[GuitarRigCore::processingLatencySamples]-1.f)<1.e-7f);
+ assert(std::fabs(r[GuitarRigCore::processingLatencySamples]-1.f)<1.e-7f);
+
+ // The original 65-tap symmetric cabinet FIR must remain linear-phase
+ // after pairwise multiply optimization. Partitioning buffers cannot
+ // change output, history ownership or the 32-sample PDC.
+ auto cabinetOnly=raw;
+ cabinetOnly.blocks[3].enabled=true;
+ for(const double rate:{44100.,48000.,96000.}){
+ assert(core.prepare(rate,cabinetOnly));
+ l.fill(0.f);r.fill(0.f);l[0]=1.f;r[0]=1.f;
+ core.processStereo(l.data(),r.data(),l.size());
+ const auto full=l;
+ for(int i=0;i(
+ GuitarRigCore::oversamplingLatencySamples+i);
+ const auto mirror=static_cast(
+ GuitarRigCore::oversamplingLatencySamples+
+ GuitarRigCore::cabinetTaps-1-i);
+ assert(std::fabs(l[left]-l[mirror])<0.000001f);
+ assert(std::isfinite(l[left]) && l[left]==r[left]);
+ }
+ assert(std::fabs(l[GuitarRigCore::processingLatencySamples])>0.02f);
+ core.reset();
+ l.fill(0.f);r.fill(0.f);l[0]=1.f;r[0]=1.f;
+ for(std::size_t offset=0;offset warmLeft{},warmRight{};
+ for(std::size_t i=0;i(i)/48000.f);
+ source.processStereo(warmLeft.data(),warmRight.data(),warmLeft.size());
+ assert(!changedRate.inheritCompatibleHistory(source));
+ assert(same.inheritCompatibleHistory(source));
+ assert(changedTone.inheritCompatibleHistory(source));
+ std::array advance{},reference{},bright{},coldInput{};
+ for(std::size_t i=0;i(512+i)/48000.f);
+ advance[i]=reference[i]=bright[i]=coldInput[i]=value;
+ }
+ auto expectedRight=advance;
+ auto actualRight=reference;
+ source.processStereo(advance.data(),expectedRight.data(),advance.size());
+ same.processStereo(reference.data(),actualRight.data(),reference.size());
+ for(std::size_t i=0;i0.0001); // history is materially preserved
+
+ // A professional stereo gate is a LINKED detector, not two competing
+ // channel gates. A quiet L lane must stay at exactly the same gain
+ // reduction as a louder R lane; the processed stereo ratio is preserved.
+ Program gateOnly=factory;
+ gateOnly.blocks[1].enabled=false; // isolate gate from nonlinear stages
+ gateOnly.blocks[2].enabled=false;
+ gateOnly.blocks[3].enabled=false; // same fixed 32-sample dry PDC
+ gateOnly.blocks[0].values[0]=0.5f; // -55 dB
+ gateOnly.blocks[0].values[1]=0.0f;
+ gateOnly.blocks[0].values[2]=0.0f;
+ GuitarRigCore stereoGate{};
+ assert(stereoGate.prepare(48000.,gateOnly));
+ std::array weak{},strong{};
+ weak.fill(0.0008f);strong.fill(0.08f);
+ stereoGate.processStereo(weak.data(),strong.data(),weak.size());
+ for(std::size_t i=512;i0.07f);
+ assert(std::fabs(weak[i]/strong[i]-0.01f)<0.000002f);
+ }
+ // Hold is truly implemented in DSP. With a threshold of -30 dB and
+ // a quiet sustained tail, the no-hold gate closes while the linked
+ // 120ms hold gate remains open. The release knob changes real audio
+ // attenuation, not merely the appearance of the GUI.
+ gateOnly.blocks[0].values[0]=1.f;
+ auto longHold=gateOnly;
+ longHold.blocks[0].values[1]=1.f;
+ auto slowClose=gateOnly;
+ slowClose.blocks[0].values[2]=1.f;
+ GuitarRigCore noHold{},held{},slow{};
+ assert(noHold.prepare(48000.,gateOnly));
+ assert(held.prepare(48000.,longHold));
+ assert(slow.prepare(48000.,slowClose));
+ std::array loudA{},loudB{};
+ loudA.fill(0.1f);loudB.fill(0.1f);
+ for(int block=0;block<12;++block){ // 64ms to establish open gate
+ auto a=loudA,b=loudB;noHold.processStereo(a.data(),b.data(),a.size());
+ a=loudA;b=loudB;held.processStereo(a.data(),b.data(),a.size());
+ a=loudA;b=loudB;slow.processStereo(a.data(),b.data(),a.size());
+ }
+ std::array tailNoHold{},tailHold{},tailSlow{};
+ std::array tailR1{},tailR2{},tailR3{};
+ tailNoHold.fill(0.005f);tailHold.fill(0.005f);tailSlow.fill(0.005f);
+ tailR1=tailNoHold;tailR2=tailHold;tailR3=tailSlow;
+ noHold.processStereo(tailNoHold.data(),tailR1.data(),tailNoHold.size());
+ held.processStereo(tailHold.data(),tailR2.data(),tailHold.size());
+ slow.processStereo(tailSlow.data(),tailR3.data(),tailSlow.size());
+ const auto finalSample=tailNoHold.size()-64u;
+ assert(tailHold[finalSample]>0.004f);
+ assert(tailNoHold[finalSample]<0.0010f);
+ assert(tailSlow[finalSample]>tailNoHold[finalSample]*3.f);
+ assert(tailHold[finalSample]==tailR2[finalSample]);
+ // The normalized control schema remains unchanged: old GRX1 v1
+ // programs with reserved zeros are still valid first-class tones.
+ assert(validate(gateOnly)==ProgramError::none);
+ assert(GuitarRigCore::supportsProgram(gateOnly));
+ assert(validate(longHold)==ProgramError::none);
+ assert(validate(slowClose)==ProgramError::none);
+
+ // Neither a malformed program nor unimplemented enabled modules may
+ // silently claim a valid guitar DSP graph. Previous accepted core remains.
+ Program invalid=factory;
+ invalid.blocks[2].id=1;
+ assert(!core.prepare(48000.,invalid));
+ assert(core.isReady() && core.program().blocks[2].id==3);
+ invalid=factory;invalid.count=5;
+ invalid.blocks[4]={5,Module::reverb,true,{}};
+ assert(!core.prepare(48000.,invalid));
+ assert(core.isReady() && core.program().count==4);
+ // No exotic input should yield NaN, infinity or corrupt output.
+ l.fill(0.f);r.fill(0.f);
+ l[3]=std::numeric_limits::infinity();
+ r[5]=std::numeric_limits::quiet_NaN();
+ core.processStereo(l.data(),r.data(),l.size());
+ for(auto sample:l)assert(std::isfinite(sample));
+ for(auto sample:r)assert(std::isfinite(sample));
+
+ // Hard spectral regression: 2x oversampled nonlinear drive and amp
+ // must suppress folded high-gain harmonics. Legacy native-rate output
+ // measured -16.6682 dBc at 48kHz (9k input => 21k alias).
+ // At 48kHz a 9kHz driven input creates a third harmonic at 27kHz,
+ // folding to 21kHz. Cabinet is bypassed for an unbiased measurement.
+ // A regression exceeding -35dBc fails this portable DSP test.
+ auto driven=factoryTone(3);
+ driven.blocks[0].enabled=false;
+ driven.blocks[3].enabled=false;
+ GuitarRigCore audit{};
+ assert(audit.prepare(48000.,driven));
+ constexpr std::size_t warmup=480,window=4800,total=warmup+window;
+ std::array probeL{},probeR{};
+ for(std::size_t i=0;i(i)/48000.f);
+ probeL[i]=probeR[i]=x;
+ }
+ audit.processStereo(probeL.data(),probeR.data(),total);
+ const auto spectralAmplitude=[&](int bin) noexcept {
+ constexpr double twicePi=6.28318530717958647692;
+ const double omega=twicePi*static_cast(bin)/
+ static_cast(window);
+ double real=0.,imag=0.;
+ for(std::size_t i=0;i(i);
+ const double sample=probeL[warmup+i];
+ real+=sample*std::cos(phase);
+ imag-=sample*std::sin(phase);
+ }
+ return 2.*std::hypot(real,imag)/static_cast(window);
+ };
+ const auto f9000=spectralAmplitude(900);
+ const auto f21000=spectralAmplitude(2100);
+ assert(std::isfinite(f9000)&&std::isfinite(f21000));
+ assert(f9000>1.e-7);
+ const double aliasedThirdDb=20.*std::log10(
+ std::max(f21000,1.e-12)/f9000);
+ assert(std::isfinite(aliasedThirdDb));
+ assert(aliasedThirdDb < -35.0); // ~22dB margin vs current -57.2dBc
+ std::cout<<"GFX 2X ALIAS PASS 9k -> 21k: "
+ < rigs{};
+ for(int v=0;v(v)].prepare(48000.,driven));
+ std::array perfL{},perfR{};
+ const auto start=std::chrono::steady_clock::now();
+ constexpr int blocks=128;
+ for(int frame=0;frame(frame*128+
+ static_cast(i))/48000.f);
+ }
+ rigs[static_cast(voice)].processStereo(
+ perfL.data(),perfR.data(),perfL.size());
+ checkSum+=perfL[64];
+ }
+ }
+ const double seconds=std::chrono::duration(
+ std::chrono::steady_clock::now()-start).count();
+ const double simulatedSeconds=
+ static_cast(blocks*128)/48000.;
+ std::cout<<"GFX CI CPU PROBE "<
+#include
+#include
+#include
+
+using namespace armix::guitarfx;
+static_assert(maxBlocks==16);
+static_assert(valuesPerBlock==8);
+static_assert(std::is_trivially_copyable_v);
+static_assert(validate(factoryCleanProgram())==ProgramError::none);
+static_assert(factoryToneNames.size()==4);
+static_assert(identifyFactoryTone(factoryTone(0))==1);
+static_assert(identifyFactoryTone(factoryTone(1))==2);
+static_assert(identifyFactoryTone(factoryTone(2))==3);
+static_assert(identifyFactoryTone(factoryTone(3))==4);
+static_assert(sameTone(factoryTone(2),factoryTone(2)));
+static_assert(!sameTone(factoryTone(1),factoryTone(3)));
+
+int main() {
+ constexpr auto base=factoryCleanProgram();
+ for(std::size_t i=0;i(i)+1);
+ auto custom=tone;
+ custom.blocks[0].enabled=!custom.blocks[0].enabled;
+ assert(identifyFactoryTone(custom)==0);
+ custom=tone;
+ custom.blocks[2].values[1]=0.99f;
+ assert(identifyFactoryTone(custom)==0);
+ custom=tone;
+ custom.blocks[3].enabled=false;
+ assert(identifyFactoryTone(custom)==0);
+ }
+ Program output{};
+ output.version=999; // Sentinel proves rejected mutation preserves output.
+ assert(moveBefore(base,5,1,output));
+ assert(output.blocks[0].id==5);
+ assert(output.blocks[3].module==Module::amplifier);
+ assert(output.blocks[4].module==Module::cabinet);
+ assert(base.blocks[0].id==1); // Accepted program is immutable.
+ assert(validate(output)==ProgramError::none);
+
+ Program sentinel{};
+ sentinel.version=777;
+ assert(!moveBefore(base,3,1,sentinel)); // AMP is anchored.
+ assert(!moveBefore(base,4,1,sentinel)); // CAB is anchored.
+ assert(!moveBefore(base,1,4,sentinel)); // Cannot split AMP→CAB.
+ assert(!moveBefore(base,42,1,sentinel));
+ assert(!moveBefore(base,1,42,sentinel));
+ assert(sentinel.version==777);
+
+ assert(setEnabled(base,2,false,output));
+ assert(!output.blocks[1].enabled);
+ assert(base.blocks[1].enabled);
+ assert(!setEnabled(base,500,false,sentinel));
+ assert(sentinel.version==777);
+
+ assert(setNormalizedValue(base,3,0,.74f,output));
+ assert(output.blocks[2].values[0]==.74f);
+ assert(!setNormalizedValue(base,3,valuesPerBlock,.4f,sentinel));
+ assert(!setNormalizedValue(base,3,0,1.01f,sentinel));
+ assert(!setNormalizedValue(base,3,0,-.01f,sentinel));
+ assert(!setNormalizedValue(base,3,0,std::numeric_limits::quiet_NaN(),sentinel));
+ assert(sentinel.version==777);
+
+ Program bad=base;
+ bad.version=999;
+ assert(validate(bad)==ProgramError::unsupportedSchema);
+ bad=base;bad.count=0;
+ assert(validate(bad)==ProgramError::invalidCount);
+ bad=base;bad.count=17;
+ assert(validate(bad)==ProgramError::invalidCount);
+ bad=base;bad.blocks[0].id=0;
+ assert(validate(bad)==ProgramError::invalidId);
+ bad=base;bad.blocks[1].id=1;
+ assert(validate(bad)==ProgramError::duplicateId);
+ bad=base;bad.blocks[0].module=static_cast(255);
+ assert(validate(bad)==ProgramError::invalidModule);
+ bad=base;bad.blocks[2].values[0]=std::numeric_limits::infinity();
+ assert(validate(bad)==ProgramError::invalidParameter);
+ bad=base;bad.blocks[2].module=Module::gate;
+ assert(validate(bad)==ProgramError::missingAmplifier);
+ bad=base;bad.blocks[3].module=Module::reverb;
+ assert(validate(bad)==ProgramError::missingCabinet);
+ bad=base;bad.blocks[0].module=Module::amplifier;
+ assert(validate(bad)==ProgramError::duplicateAmplifier);
+ bad=base;bad.blocks[1].module=Module::cabinet;
+ assert(validate(bad)==ProgramError::duplicateCabinet);
+ bad=base;bad.blocks[3].module=Module::reverb;
+ bad.blocks[4].module=Module::cabinet;
+ assert(validate(bad)==ProgramError::amplifierCabinetOrder);
+}
diff --git a/tests/main_v08_native_integration_test.mjs b/tests/main_v08_native_integration_test.mjs
index 2e6c33a75..fa2d159f3 100644
--- a/tests/main_v08_native_integration_test.mjs
+++ b/tests/main_v08_native_integration_test.mjs
@@ -105,3 +105,25 @@ test('startup uses splash before constructing WebView2 and native engine',()=>{
assert.match(main,/onStartupStage_ \(1\)/);
assert.match(main,/onStartupStage_ \(2\)/);
});
+
+test('startup handoff raises mixer once after splash, without permanent topmost or probe focus',()=>{
+ const app=main.slice(main.indexOf('class ConsoleApp final'));
+ const warm=main.slice(main.indexOf('if (!webViewPeerWarmed_)'),
+ main.indexOf('// Existing message-thread 12 Hz timer',main.indexOf('if (!webViewPeerWarmed_)')));
+ assert.match(warm,/setVisible \(true\);/);
+ assert.doesNotMatch(warm,/\btoBack\s*\(/,'warm compositor must not bury the mixer');
+ assert.match(app,/else if \(stage == 2\)\s*presentMixerOnStartup\(\);/);
+ const handoff=app.slice(app.indexOf('void presentMixerOnStartup()'),
+ app.indexOf('void serviceSmartUpdateAcknowledgement()'));
+ assert.match(handoff,/if \(startupMixerPresented_ \|\| !window_ \|\| isAutoUpdateHealthProbe\(\)\)/);
+ assert.match(handoff,/startupMixerPresented_ = true/);
+ assert.match(handoff,/window_->setVisible \(true\);/);
+ assert.match(handoff,/window_->setMinimised \(false\);/);
+ assert.match(handoff,/window_->toFront \(true\);/);
+ assert.match(handoff,/SetWindowPos \(hwnd, HWND_TOPMOST/);
+ assert.match(handoff,/SetWindowPos \(hwnd, HWND_NOTOPMOST/);
+ assert.match(handoff,/::SetForegroundWindow \(hwnd\)/);
+ assert.match(handoff,/window_->grabKeyboardFocus\(\)/);
+ assert.doesNotMatch(handoff,/startTimer|engine_\.start|setAlwaysOnTop\s*\(/);
+ assert.match(app,/if \(isAutoUpdateHealthProbe\(\)\)\s*\{\s*if \(window_\) window_->setVisible \(false\);/);
+});
diff --git a/tests/native_fx_registry_extension_test.cpp b/tests/native_fx_registry_extension_test.cpp
index 84cb7a3a3..3e3dbde77 100644
--- a/tests/native_fx_registry_extension_test.cpp
+++ b/tests/native_fx_registry_extension_test.cpp
@@ -155,8 +155,274 @@ static void verifySharedNativeFxControlRequest() {
assert(max19.valid && max19.sequence("comp-")==9999999999999999999ULL);
}
+static void verifyFirstSoundGuitarProcessor() {
+ // This is the REAL production native registry path, not a fixture
+ // or browser mock. The resulting processor is inserted as one FxInstance.
+ const auto* guitar=armix::builtin_fx::findNativeBuiltInFx(
+ armix::builtin_fx::GuitarRigProcessor::catalogIdentity);
+ assert(guitar && guitar->showInPicker);
+ assert(juce::String(guitar->category)=="Guitar");
+ assert(!guitar->prepare(16000.,128,nullptr,0));
+ auto live=guitar->prepare(48000.,128,nullptr,0);
+ assert(live && live->getName()=="Guitar FX Rig");
+ assert(live->getLatencySamples()==48);
+ auto* guitarTyped=dynamic_cast(live.get());
+ assert(guitarTyped && guitarTyped->isReady());
+ juce::MemoryBlock snapshot;
+ live->getStateInformation(snapshot);
+ assert(snapshot.getSize()==12u+2u*4u+2u*4u*44u); // two durable banks
+ auto restored=guitar->prepare(44100.,128,
+ snapshot.getData(),static_cast(snapshot.getSize()));
+ assert(restored && restored->getLatencySamples()==48);
+ auto broken=snapshot;
+ // Corrupt active-bank index; the whole restore must fail closed.
+ broken[8]=0xff;broken[9]=0xff;broken[10]=0xff;broken[11]=0xff;
+ assert(!guitar->prepare(48000.,128,broken.getData(),
+ static_cast(broken.getSize())));
+ assert(!guitar->prepare(48000.,128,
+ snapshot.getData(),static_cast(snapshot.getSize())-1));
+
+ auto badSecondBank=snapshot;
+ // v2: 12-byte header + countA + 4*44-byte A + countB.
+ // Set Bank B's first block identity to zero, preserving exact length.
+ constexpr std::size_t secondBankFirstId=12u+4u+4u*44u+4u;
+ for(std::size_t i=0;i<4;++i)badSecondBank[secondBankFirstId+i]=0;
+ assert(!guitar->prepare(48000.,128,badSecondBank.getData(),
+ static_cast(badSecondBank.getSize())));
+ // GRX1 v1 single-program snapshots remain loadable, migrated to both
+ // bank slots without changing the approved tone or DSP.
+ juce::MemoryBlock legacy;
+ juce::MemoryOutputStream legacyWriter(legacy,false);
+ legacyWriter.writeInt(static_cast(
+ armix::builtin_fx::GuitarRigProcessor::stateMagic));
+ legacyWriter.writeInt(1);
+ const auto legacyTone=armix::guitarfx::factoryTone(2);
+ legacyWriter.writeInt(static_cast(legacyTone.count));
+ for(std::size_t i=0;i(block.id));
+ legacyWriter.writeInt(static_cast(block.module));
+ legacyWriter.writeInt(block.enabled?1:0);
+ for(const float v:block.values)legacyWriter.writeFloat(v);
+ }
+ // JUCE MemoryOutputStream reserves spare capacity in MemoryBlock until
+ // flush/destruction; getSize() is NOT the encoded payload length yet.
+ // This previously failed on MSVC after 91/92 other CTests passed.
+ assert(legacyWriter.getDataSize()==12u+4u*44u);
+ legacyWriter.flush();
+ assert(legacy.getSize()==12u+4u*44u);
+ auto legacyRestored=guitar->prepare(48000.,128,
+ legacy.getData(),static_cast(legacy.getSize()));
+ auto* legacyRig=dynamic_cast(
+ legacyRestored.get());
+ assert(legacyRig && legacyRig->activeBank()==0);
+ assert(armix::guitarfx::sameTone(legacyRig->acceptedBankProgram(0),legacyTone));
+ assert(armix::guitarfx::sameTone(legacyRig->acceptedBankProgram(1),legacyTone));
+
+ juce::AudioBuffer pcm(2,1024);
+ for(int i=0;i(i)/48000.f);
+ pcm.setSample(0,i,source);
+ pcm.setSample(1,i,source);
+ }
+ juce::MidiBuffer midi;
+ live->processBlock(pcm,midi);
+ double outputEnergy=0.,difference=0.;
+ for(int i=0;i(i)/48000.f);
+ const float result=pcm.getSample(0,i);
+ assert(std::isfinite(result));
+ assert(std::fabs(result-pcm.getSample(1,i))<0.00001f);
+ outputEnergy+=static_cast(result)*result;
+ difference+=std::fabs(result-source);
+ }
+ assert(outputEnergy>0.00001 && difference>0.01);
+ assert(guitarTyped->observedBlockSerial()==1);
+ assert(guitarTyped->observedOutputPeak()>0.f);
+ assert(guitarTyped->hasEditor()); // same generic routed editor host
+ // Active and fully bypassed rack paths share an authenticated mailbox.
+ // No PCM processing is necessary to acknowledge edits at full bypass:
+ // the existing FxInstance fast path calls consumeRealtimeEdits().
+ auto bypassed=guitar->prepare(48000.,128,nullptr,0);
+ auto* bypassRig=dynamic_cast(
+ bypassed.get());
+ assert(bypassRig && bypassRig->observedBlockSerial()==0);
+ auto bypassTone=armix::guitarfx::factoryTone(1);
+ assert(bypassRig->queueProgram(bypassTone,99,0));
+ assert(!bypassRig->stateSnapshotQuiescent());
+ bypassRig->consumeRealtimeEdits(); // same callback hook as host bypass
+ assert(bypassRig->stateSnapshotQuiescent());
+ assert(bypassRig->lastCompletion().requestId==99);
+ assert(armix::guitarfx::sameTone(bypassRig->acceptedProgram(),bypassTone));
+ assert(bypassRig->observedBlockSerial()==0); // no fake wet PCM claim
+ // A second adjustment while fully bypassed must ACK on the next native
+ // host callback, even though processBlock is not invoked at all.
+ bypassRig->onRealtimeBypass(true,true);
+ auto secondBypassTone=armix::guitarfx::factoryTone(3);
+ assert(bypassRig->queueProgram(secondBypassTone,100,1));
+ bypassRig->consumeRealtimeEdits();
+ assert(bypassRig->stateSnapshotQuiescent());
+ assert(bypassRig->activeBank()==1);
+ assert(bypassRig->pendingProgramChanges()==0);
+ assert(bypassRig->observedBlockSerial()==0);
+ assert(armix::guitarfx::sameTone(
+ bypassRig->acceptedBankProgram(0),bypassTone));
+ assert(armix::guitarfx::sameTone(
+ bypassRig->acceptedBankProgram(1),secondBypassTone));
+ // More severe: wet output starts transitioning, then the host becomes
+ // fully bypassed before all 128 crossfade samples have been rendered.
+ // Its next tone MUST NOT wait forever for skipped wet samples.
+ auto partiallyWet=guitar->prepare(48000.,128,nullptr,0);
+ auto* partiallyWetRig=dynamic_cast<
+ armix::builtin_fx::GuitarRigProcessor*>(partiallyWet.get());
+ assert(partiallyWetRig);
+ juce::AudioBuffer tiny(2,32);
+ tiny.clear();
+ juce::MidiBuffer tinyMidi;
+ assert(partiallyWetRig->queueProgram(bypassTone,1,0));
+ partiallyWet->processBlock(tiny,tinyMidi); // 96 samples of fade remain
+ assert(partiallyWetRig->stateSnapshotQuiescent());
+ partiallyWetRig->onRealtimeBypass(true,true);
+ assert(partiallyWetRig->queueProgram(secondBypassTone,2,1));
+ partiallyWetRig->consumeRealtimeEdits();
+ assert(partiallyWetRig->stateSnapshotQuiescent());
+ assert(partiallyWetRig->activeBank()==1);
+ assert(partiallyWetRig->lastCompletion().requestId==2);
+ // Wet reactivation never resurrects an old transition or fake meter.
+ partiallyWetRig->onRealtimeBypass(false,false);
+ tiny.clear();
+ partiallyWet->processBlock(tiny,tinyMidi);
+ assert(partiallyWetRig->pendingProgramChanges()==0);
+ // Cabinet impulse history must not leak after the 128-frame host
+ // rack-bypass envelope reaches fully dry. No old note on wet return.
+ auto noTail=guitar->prepare(48000.,128,nullptr,0);
+ auto* noTailRig=dynamic_cast<
+ armix::builtin_fx::GuitarRigProcessor*>(noTail.get());
+ assert(noTailRig);
+ tiny.clear();
+ tiny.setSample(0,0,0.6f);
+ tiny.setSample(1,0,0.6f);
+ noTail->processBlock(tiny,tinyMidi); // populate FIR's 32-sample history
+ noTailRig->onRealtimeBypass(true,true);
+ noTailRig->onRealtimeBypass(false,false);
+ tiny.clear();
+ noTail->processBlock(tiny,tinyMidi);
+ for(int i=0;iacceptedProgram();
+ edit.blocks[2].values[0]=0.78f;
+ edit.blocks[1].enabled=true;
+ edit.blocks[1].values[0]=0.64f;
+ assert(guitarTyped->queueProgram(edit,101));
+ // A queued GUI intent is NOT durable/accepted until audio callback ACK.
+ assert(guitarTyped->acceptedProgram().blocks[2].values[0]!=0.78f);
+ assert(!guitarTyped->stateSnapshotQuiescent());
+ assert(guitarTyped->pendingProgramChanges()==1);
+ pcm.clear();
+ pcm.setSample(0,0,0.15f);
+ pcm.setSample(1,0,0.15f);
+ live->processBlock(pcm,midi); // LIVE block drains edit and crossfades
+ assert(guitarTyped->stateSnapshotQuiescent());
+ assert(guitarTyped->pendingProgramChanges()==0);
+ assert(guitarTyped->acceptedProgram().blocks[2].values[0]==0.78f);
+ assert(guitarTyped->lastCompletion().requestId==101);
+ assert(guitarTyped->lastCompletion().applied);
+ juce::MemoryBlock acceptedBytes;
+ live->getStateInformation(acceptedBytes);
+ auto acceptedRestore=guitar->prepare(96000.,128,
+ acceptedBytes.getData(),static_cast(acceptedBytes.getSize()));
+ assert(acceptedRestore);
+ auto* acceptedGuitar=dynamic_cast<
+ armix::builtin_fx::GuitarRigProcessor*>(acceptedRestore.get());
+ assert(acceptedGuitar && acceptedGuitar->acceptedProgram().blocks[2].values[0]==0.78f);
+ edit.blocks[2].id=0;
+ assert(!guitarTyped->queueProgram(edit,102)); // invalid ID -> no graph edit
+ edit=guitarTyped->acceptedProgram();
+ edit.blocks[2].values[0]=0.49f;
+ assert(guitarTyped->queueProgram(edit,103));
+ assert(guitarTyped->pendingProgramChanges()==1);
+ // Device rate changes cancel stale prepared packets and preserve last
+ // applied program; a 48kHz FIR must never be applied to a 44.1k graph.
+ live->prepareToPlay(44100.,128);
+ assert(guitarTyped->stateSnapshotQuiescent());
+ assert(guitarTyped->lastCompletion().requestId==103);
+ assert(!guitarTyped->lastCompletion().applied);
+ assert(guitarTyped->pendingProgramChanges()==0);
+ assert(guitarTyped->acceptedProgram().blocks[2].values[0]==0.78f);
+ assert(guitarTyped->getLatencySamples()==48);
+
+ // Two accepted live edits must never interrupt a 128-frame crossfade:
+ // a second intent waits in the queue until the first transition ends.
+ auto first=guitarTyped->acceptedProgram();
+ first.blocks[2].values[0]=0.33f;
+ auto second=first;
+ second.blocks[2].values[0]=0.62f;
+ assert(guitarTyped->queueProgram(first,105));
+ juce::AudioBuffer shortBlock(2,32);
+ shortBlock.clear();
+ shortBlock.setSample(0,0,0.25f);
+ shortBlock.setSample(1,0,0.25f);
+ live->processBlock(shortBlock,midi); // first intent becomes audio-owned
+ assert(guitarTyped->queueProgram(second,106));
+ assert(guitarTyped->pendingProgramChanges()==2);
+ // Save must be blocked while the second edit waits and the first ACK
+ // has not yet been consumed on CONTROL.
+ assert(!guitarTyped->stateSnapshotQuiescent());
+ for(int block=0;block<3;++block){
+ shortBlock.clear();
+ live->processBlock(shortBlock,midi);
+ }
+ assert(guitarTyped->pendingProgramChanges()==1);
+ assert(!guitarTyped->stateSnapshotQuiescent());
+ shortBlock.clear();
+ live->processBlock(shortBlock,midi); // now the next block starts second fade
+ assert(guitarTyped->stateSnapshotQuiescent());
+ assert(guitarTyped->pendingProgramChanges()==0);
+ assert(guitarTyped->lastCompletion().requestId==106);
+ assert(guitarTyped->acceptedProgram().blocks[2].values[0]==0.62f);
+ // Helix-style live A/B comparison is not a second processor/FX slot.
+ // Bank A retains the accepted 0.62 tone. Applying B changes only its
+ // own bank and persists both choices through the exact same .smix blob.
+ auto alternate=armix::guitarfx::factoryTone(3);
+ assert(guitarTyped->queueProgram(alternate,107,1));
+ for(int block=0;block<8 && guitarTyped->pendingProgramChanges();++block){
+ shortBlock.clear();
+ live->processBlock(shortBlock,midi); // previous fade then Bank B
+ }
+ assert(guitarTyped->stateSnapshotQuiescent());
+ assert(guitarTyped->lastCompletion().requestId==107);
+ assert(guitarTyped->lastCompletion().bank==1);
+ assert(guitarTyped->activeBank()==1);
+ assert(guitarTyped->acceptedBankProgram(0).blocks[2].values[0]==0.62f);
+ assert(armix::guitarfx::sameTone(
+ guitarTyped->acceptedBankProgram(1),alternate));
+ assert(!guitarTyped->queueProgram(alternate,108,3)); // invalid bank
+ juce::MemoryBlock banksSaved;
+ live->getStateInformation(banksSaved);
+ auto twoBanks=guitar->prepare(48000.,128,
+ banksSaved.getData(),static_cast(banksSaved.getSize()));
+ auto* twoBankRig=dynamic_cast(
+ twoBanks.get());
+ assert(twoBankRig && twoBankRig->activeBank()==1);
+ assert(twoBankRig->acceptedBankProgram(0).blocks[2].values[0]==0.62f);
+ assert(armix::guitarfx::sameTone(
+ twoBankRig->acceptedBankProgram(1),alternate));
+ // State captured before publication is a reliable round-trip.
+ juce::MemoryBlock roundtrip;
+ restored->getStateInformation(roundtrip);
+ assert(roundtrip==snapshot);
+ guitarTyped->sealForRealtime();
+ assert(!guitarTyped->restoreUnpublishedState(snapshot.getData(),
+ static_cast(snapshot.getSize())));
+}
+
int main() {
- verifySharedNativeFxControlRequest();
+ verifySharedNativeFxControlRequest();
+ verifyFirstSoundGuitarProcessor();
const auto* found=findNativeBuiltInFxIn(injected,"armix.test.fixture-gain.v1");
assert(found==&injected[0]);
assert(!findNativeBuiltInFxIn(injected,""));
diff --git a/tests/pages_v60_fader_wire_tactile_smoke.py b/tests/pages_v60_fader_wire_tactile_smoke.py
index 20d4a6ad1..75ea14eca 100644
--- a/tests/pages_v60_fader_wire_tactile_smoke.py
+++ b/tests/pages_v60_fader_wire_tactile_smoke.py
@@ -34,6 +34,8 @@ def source_contract():
"const passed=pose.front-t;",
"svg.style.clipPath='none'",
"const width=.65-.29*longMix",
+ "const shortEnergy=Math.max(.78,.27+.73*longMix)",
+ "const shortEnergy=Math.max(.80,.46+.54*longMix)",
"const length01=Math.max(0,Math.min(1,(chord-95)/300))",
"function startWireRetraction(sourceId,releasePoint)",
"if(replugRequest)kickWireSpring(replugRequest.sourceId,replugRequest.destId)",
@@ -231,7 +233,8 @@ def test_wire(page):
nearInEarly:displaced(45,60),nearOutEarly:displaced(45,10),
nearOutLate:displaced(420,10),
pluggedOut:displaced(0,0),pluggedIn:displaced(45,64),
- tinyPeak:peak(70),shortPeak:peak(170),longPeak:peak(500)
+ tinyPeak:peak(70),adjacentPeak:peak(145),
+ shortPeak:peak(170),twoChannelPeak:peak(300),longPeak:peak(500)
};
}""")
assert physics and physics["nearInEarly"]< -2.5,("no upward jerk at receiving IN",physics)
@@ -240,10 +243,17 @@ def test_wire(page):
assert abs(physics["nearOutLate"])physics["twoChannelPeak"]*.70,\
+ ("adjacent-channel WIRE is still too quiet vs two-channel WIRE",physics)
+ assert physics["adjacentPeak"]physics["longPeak"]*.60,\
+ ("short cable must have a perceptible whip",physics)
+ assert abs(physics["twoChannelPeak"]-13.38)<.6 and \
+ abs(physics["longPeak"]-16.56)<.6,\
+ ("approved two-channel and long-wire motion must stay unchanged",physics)
assert len(samples)>=5,("no finite spring movement",len(samples))
assert any(" L " in x["d"] for x in samples),("no cable impact",len(samples))
settled=cable.get_attribute("d")
@@ -434,12 +444,72 @@ def test_replug_and_retract(page):
abs(physics["tipX"]-physics["svgTip"][0])<.1, \
("free plug circle detached from last path vertex",physics)
assert abs(physics["completeX"])<.01 and abs(physics["completeY"])<.01,physics
- assert physics["shortAmplitude"]physics["longAmplitude"]*.20 and \
+ physics["shortAmplitude"] CH02 must ripple visibly.
+ No standalone/parallel animation renderer or synthetic graph mutation.
+ """
+ source=page.locator('#tracks .strip[data-id="1"] .wire-node-out')
+ target=page.locator('#tracks .strip[data-id="2"] .wire-node-in')
+ assert source.count()==target.count()==1
+ page.evaluate("""()=>{
+ window.__v67AdjacentSamples=[];
+ window.__v67AdjacentObserver=new MutationObserver(records=>{
+ for(const record of records){
+ const el=record.target;
+ if(!el.matches?.('path.wire-outgoing-line[data-cable-key="1-2"],path.wire-incoming-line[data-cable-key="1-2"]'))continue;
+ const d=el.getAttribute('d');
+ if(d?.includes(' L '))window.__v67AdjacentSamples.push(d);
+ }
+ });
+ window.__v67AdjacentObserver.observe(document.querySelector('#wireLayer'),
+ {subtree:true,attributes:true,attributeFilter:['d']});
+ }""")
+ # Use an explicit OUT -> IN pointer drag, independent of prior focus
+ # and whether the visible jacket is an incoming or outgoing projection.
+ a=source.bounding_box()
+ b=target.bounding_box()
+ assert a and b
+ sx,sy=a["x"]+a["width"]/2,a["y"]+a["height"]/2
+ tx,ty=b["x"]+b["width"]/2,b["y"]+b["height"]/2
+ page.mouse.move(sx,sy)
+ page.mouse.down()
+ page.mouse.move(tx,ty,steps=10)
+ page.mouse.up()
+ cable=page.locator('#wireLayer path.wire-outgoing-line[data-cable-key="1-2"],#wireLayer path.wire-incoming-line[data-cable-key="1-2"]').first
+ assert cable.count()==1,("adjacent patch missing",page.locator('#wireLayer path[data-cable-key]').evaluate_all(
+ "nodes=>nodes.map(n=>[n.getAttribute('class'),n.dataset.cableKey])"))
+ page.wait_for_timeout(780)
+ samples=page.evaluate("window.__v67AdjacentSamples")
+ assert len(samples)>=5,("adjacent WIRE did not animate in Chromium",len(samples))
+ assert " C " in cable.get_attribute("d"),"short WIRE failed to settle to canonical cubic"
+ import re
+ nums=lambda d:[float(v) for v in re.findall(r"-?\d+(?:\.\d+)?",d)]
+ base=nums(cable.get_attribute("d"))
+ assert len(base)==8,("unexpected canonical geometry",base)
+ y0,yc1,yc2,y1=base[1],base[3],base[5],base[7]
+ max_deformation=0
+ for d in samples:
+ points=nums(d)
+ if len(points)!=130:continue
+ for i in range(1,64):
+ t=i/64
+ v=1-t
+ natural=v*v*v*y0+3*v*v*t*yc1+3*v*t*t*yc2+t*t*t*y1
+ max_deformation=max(max_deformation,abs(points[2*i+1]-natural))
+ assert max_deformation>7,("adjacent-channel impact is too subdued",
+ max_deformation,len(samples))
+ assert page.locator('#wireLayer path.wire-interaction-hit[data-cable-key="1-2"]').count()==1
+ page.evaluate("window.__v67AdjacentObserver.disconnect()")
+
+
+
def run():
from playwright.sync_api import sync_playwright
subprocess.run([sys.executable,str(ROOT/"scripts/build_pages.py"),
@@ -457,13 +527,14 @@ def run():
if width==1680:
test_wire(page)
test_replug_and_retract(page)
+ test_adjacent_wire_whip(page)
if width in (640,1680):
page.screenshot(path=f"arsonmix-v60-fader-wire-{width}.png",full_page=False)
assert not errs,(width,errs)
page.close()
finally:
browser.close()
- print("PASS V66 Chromium: 330ms fast reel, whole cable ripple and swing-back free dot with no ghost graph")
+ print("PASS V67 Chromium: lively adjacent-channel WIRE plus V66 long whip and 330ms free-dot reel")
if __name__=="__main__":
diff --git a/tests/pages_wire_incoming_v43_smoke.py b/tests/pages_wire_incoming_v43_smoke.py
index a914c947a..db0ac0efb 100644
--- a/tests/pages_wire_incoming_v43_smoke.py
+++ b/tests/pages_wire_incoming_v43_smoke.py
@@ -17,12 +17,15 @@ def center(el):
def impact_peak(path,baseline):
values=[float(v) for v in re.findall(r"-?\d+(?:\.\d+)?",path)]
base=[float(v) for v in re.findall(r"-?\d+(?:\.\d+)?",baseline)]
- assert " L " in path and len(values)==114,(len(values),path[:90])
+ # V43 used 56 polyline samples; current animator uses 64. Verify
+ # valid topology without hard-coding one historical tessellation size.
+ assert " L " in path and len(values)>=34 and (len(values)-2)%2==0,(len(values),path[:90])
+ n=(len(values)-2)//2
assert " C " in baseline and len(base)==8,(len(base),baseline)
x0,y0,c0x,c0y,c1x,c1y,x1,y1=base
max_point=(0.,0.)
- for i in range(1,57):
- t=i/56.;u=1-t
+ for i in range(1,n+1):
+ t=i/n;u=1-t
x=u*u*u*x0+3*u*u*t*c0x+3*u*t*t*c1x+t*t*t*x1
y=u*u*u*y0+3*u*u*t*c0y+3*u*t*t*c1y+t*t*t*y1
dist=math.hypot(values[i*2]-x,values[i*2+1]-y)
@@ -34,13 +37,16 @@ def impact_motion(path,baseline):
# oscillation crest, this follows the entire slow traveling wave packet.
values=[float(v) for v in re.findall(r"-?\d+(?:\.\d+)?",path)]
base=[float(v) for v in re.findall(r"-?\d+(?:\.\d+)?",baseline)]
- assert " L " in path and len(values)==114,(len(values),path[:90])
+ # V43 used 56 polyline samples; current animator uses 64. Verify
+ # valid topology without hard-coding one historical tessellation size.
+ assert " L " in path and len(values)>=34 and (len(values)-2)%2==0,(len(values),path[:90])
+ n=(len(values)-2)//2
assert " C " in baseline and len(base)==8,(len(base),baseline)
x0,y0,c0x,c0y,c1x,c1y,x1,y1=base
energy=0.
weighted_position=0.
- for i in range(1,57):
- t=i/56.;u=1-t
+ for i in range(1,n+1):
+ t=i/n;u=1-t
x=u*u*u*x0+3*u*u*t*c0x+3*u*t*t*c1x+t*t*t*x1
y=u*u*u*y0+3*u*u*t*c0y+3*u*t*t*c1y+t*t*t*y1
weight=(values[i*2]-x)**2+(values[i*2+1]-y)**2
@@ -121,8 +127,8 @@ def main():
# reacquire the NEW live path and update it rather than a detached path.
page.wait_for_function("()=>window.__v43Wave.length>=16",timeout=4000)
live=page.locator('#wireLayer path.wire-outgoing-line[data-cable-key="5-3"]')
- # Wait for the accepted cable to settle into its original cubic (not
- # frame-count-based indexing; actual temporal damping is ~1600ms).
+ # The V66 impact travels for <=520ms and settles within another 160ms.
+ # Wait for the actual cubic restoration, not an obsolete V43 1.6s timer.
page.wait_for_function("""()=>{
const p=document.querySelector('#wireLayer path.wire-outgoing-line[data-cable-key="5-3"]');
return p&&p.getAttribute('d')?.includes(' C ')&&window.__v43Frames.length>=16;
@@ -140,11 +146,13 @@ def window_motion(lo,hi):
assert len(subset)>=3,("not enough timed animation samples",lo,hi,len(subset))
return (sum(x[0] for x in subset)/len(subset),
sum(x[1] for x in subset)/len(subset))
- early=window_motion(150,400)
- late=window_motion(950,1250)
+ # Both windows sit inside the shipped 680ms impact interval. The
+ # travelling packet begins at IN (t=1) and reaches OUT (t=0).
+ early=window_motion(90,220)
+ late=window_motion(360,520)
assert early[1]>2.0 and late[1]>.35,(early,late)
- assert early[0]-late[0]>.20,("energy packet did not travel IN to OUT",early,late)
- assert late[1].12,("energy packet did not travel IN to OUT",early,late)
+ assert late[1]IN drag and BUS-only routing in real Chromium.
+
+This fixture owns WIRE interaction and routing only. Modern hardware-key,
+PFL, fader, plugin-picker and floating-window contracts are independently
+qualified by their current dedicated Chromium tests. Do not repeat the
+obsolete V15 hardware DOM internals in this WIRE-only regression.
+Browser reference only; not evidence of native PCM processing.
"""
from __future__ import annotations
from pathlib import Path
@@ -22,178 +25,6 @@ def main():
errors=[]
page.on("pageerror",lambda err:errors.append(str(err)))
page.goto(PAGE.as_uri())
- # V6: three identical buttons, no legacy CodePen or PFL-only housing.
- keys=page.locator('#tracks .strip[data-id="1"] .mx-hw-row > button.mx-hw-key')
- assert_true(keys.count()==3,'V6 must render exactly 3 sibling hardware keys')
- rows=keys.evaluate_all("""items=>items.map(e=>({
- kind:e.dataset.hwKind,h:e.getBoundingClientRect().height,
- top:e.getBoundingClientRect().top,
- width:e.getBoundingClientRect().width
- }))""")
- assert_true([x['kind'] for x in rows]==['mute','solo','cue'],rows)
- assert_true(all(abs(x['h']-29)<.5 and x['width']>24 for x in rows),rows)
- assert_true(max(x['top'] for x in rows)-min(x['top'] for x in rows)<.5,rows)
- well=page.locator('#tracks .strip[data-id="1"] .mx-hw-row')
- key=keys.nth(0)
- well_y=well.bounding_box()['y']
- key.scroll_into_view_if_needed()
- rr=key.bounding_box()
- page.mouse.move(rr['x']+rr['width']/2,rr['y']+rr['height']/2)
- page.mouse.down()
- assert_true(abs(well.bounding_box()['y']-well_y)<.25,
- 'Static row must not move while button depresses')
- page.mouse.up()
- key.click() # reset MUTE after test press; WIRE fixture starts from OFF
- selected=page.locator('#tracks .strip.selected').first
- assert_true(selected.count()==1,'No selected channel to verify')
- rim=selected.evaluate("""el=>({
- z:getComputedStyle(el,'::after').zIndex,
- border:getComputedStyle(el,'::after').borderTopWidth,
- events:getComputedStyle(el,'::after').pointerEvents
- })""")
- assert_true(rim['z']=='60' and rim['border']=='1px' and rim['events']=='none',
- 'Selected channel rim is buried behind mixer sections')
- cap=page.locator('#tracks .strip[data-id="1"] .fader-travel .cap')
- capStyle=cap.evaluate("""el=>({
- w:getComputedStyle(el).width,h:getComputedStyle(el).height,
- filter:getComputedStyle(el).filter
- })""")
- assert_true(capStyle['w']=='27px' and capStyle['h']=='54px' and
- capStyle['filter']=='none','M2 cap must remain crisp and correctly scaled')
- track=page.locator('#tracks .strip[data-id="1"] .fader-travel')
- travel=track.evaluate("""el=>({
- top:getComputedStyle(el).top,bottom:getComputedStyle(el).bottom
- })""")
- assert_true(travel['top']=='27px' and travel['bottom']=='27px',
- 'Fader slot not expanded consistently')
- assert_true(not errors,'V22 browser errors: '+str(errors))
- # CSS MUTE follows the owner reference. SOLO/PFL keep SVG cutout keys.
- key=page.locator('#tracks .strip[data-id="1"] button[data-hw-kind="mute"]')
- solo=page.locator('#tracks .strip[data-id="1"] button[data-hw-kind="solo"]')
- cue=page.locator('#tracks .strip[data-id="1"] button[data-hw-kind="cue"]')
- mute_off=key.evaluate("""el=>({
- led:getComputedStyle(el).getPropertyValue('--mx-hw-led').trim(),
- text:el.querySelector('.mx-mute-legend')?.textContent,
- svg:el.querySelectorAll('svg,img').length,
- silver:getComputedStyle(el.querySelector('.mx-mute-face'),'::before').backgroundImage,
- stripe:getComputedStyle(el.querySelector('.mx-mute-lamp')).display
- })""")
- assert_true(mute_off['led']=='255,78,90' and mute_off['text']=='MUTE'
- and mute_off['svg']==0 and 'linear-gradient' in mute_off['silver']
- and mute_off['stripe']!='none','CSS MUTE initial material '+str(mute_off))
- for button,legend,color in ((solo,'SOLO','255,207,68'),(cue,'PFL','101,210,236')):
- data=button.evaluate("""el=>({
- led:getComputedStyle(el).getPropertyValue('--mx-hw-led').trim(),
- text:el.querySelector('svg.mx-hw-face mask text')?.textContent,
- maskTexts:el.querySelectorAll('svg.mx-hw-face mask text').length,
- overlayTexts:el.querySelectorAll('svg.mx-hw-face > text').length,
- lamp:getComputedStyle(el.querySelector('.mx-hw-lamp')).opacity
- })""")
- assert_true(data=={'led':color,'text':legend,'maskTexts':1,
- 'overlayTexts':0,'lamp':'0'},data)
- meter=page.locator('#tracks .strip[data-id="1"] .meter-lane').first
- led=meter.evaluate("""el=>({
- width:getComputedStyle(el).width,
- litWidth:getComputedStyle(el.querySelector('.meter-fill')).width,
- cells:getComputedStyle(el,'::before').backgroundImage,
- peak:!!el.querySelector('.meter-peak-hold')
- })""")
- assert_true(led['width']=='10px' and led['litWidth']=='6px'
- and '12px' in led['cells'] and '14px' in led['cells'] and led['peak'],
- 'V51 LED must be 6x12px portrait optics with 2px gap and independent peak hold')
- # Independent state: reference MUTE cap + original SOLO/PFL lamps.
- key.click();solo.click();cue.click()
- mute_on=key.evaluate("""el=>({
- pressed:el.getAttribute('aria-pressed'),
- led:getComputedStyle(el).getPropertyValue('--mx-hw-led').trim(),
- caption:getComputedStyle(el.querySelector('.mx-mute-legend')).color,
- stripe:getComputedStyle(el.querySelector('.mx-mute-lamp')).display,
- whiteEdge:getComputedStyle(el.querySelector('.mx-mute-face'),'::after').opacity
- })""")
- assert_true(mute_on=={'pressed':'true','led':'255,78,90',
- 'caption':'rgb(242, 231, 231)',
- 'stripe':'none','whiteEdge':'1'},
- 'MUTE code-rendered ON material failed: '+str(mute_on))
- for button,color in ((solo,'255,207,68'),(cue,'101,210,236')):
- state=button.evaluate("""el=>({
- pressed:el.getAttribute('aria-pressed'),
- led:getComputedStyle(el).getPropertyValue('--mx-hw-led').trim(),
- glow:getComputedStyle(el,'::before').opacity,
- lamp:getComputedStyle(el.querySelector('.mx-hw-lamp')).opacity,
- maskTexts:el.querySelectorAll('svg.mx-hw-face mask text').length
- })""")
- assert_true(state=={'pressed':'true','led':color,'glow':'1',
- 'lamp':'1','maskTexts':1},
- 'SOLO/PFL V6 material regressed '+str(state))
- key.click()
- assert_true(key.get_attribute('aria-pressed')=='false' and
- solo.get_attribute('aria-pressed')=='true' and
- cue.get_attribute('aria-pressed')=='true',
- 'Releasing MUTE may not reset SOLO/PFL')
- solo.click();cue.click()
- key.scroll_into_view_if_needed()
- rect=key.bounding_box()
- assert_true(bool(rect),'Button missing')
- rest=key.evaluate("""el=>new DOMMatrix(
- getComputedStyle(el.querySelector('.mx-mute-face')).transform).m42""")
- page.mouse.move(rect['x']+rect['width']/2,rect['y']+rect['height']/2)
- page.mouse.down()
- pressed=key.evaluate("""el=>({
- housing:getComputedStyle(el).transform,
- capY:new DOMMatrix(getComputedStyle(el.querySelector('.mx-mute-face')).transform).m42
- })""")
- assert_true(pressed['housing']=='none' and abs((pressed['capY']-rest)-1)<.6,
- 'MUTE cap must depress 1px in fixed housing: '+str(pressed))
- page.mouse.up()
- key.click()
- page.screenshot(path=str(ROOT/'preview-v18-hardware-1680.png'))
- # V25 quick VST picker must dismiss on external click, focus or window blur.
- quick_open=page.locator('#fastPicker')
- fx_pick=page.locator('#tracks .strip[data-id="1"] .fx-pick').first
- fx_pick.click()
- assert_true(quick_open.is_visible(),'Fast VST picker should open from FX rack')
- page.locator('#tracks .strip[data-id="2"] .strip-identity-top').click()
- assert_true(quick_open.is_hidden(),'Click outside VST picker must close it')
- fx_pick.click()
- assert_true(quick_open.is_visible(),'Quick picker failed to reopen')
- page.locator('#bankSelect').focus()
- assert_true(quick_open.is_hidden(),'Changing keyboard focus must close VST picker')
- fx_pick.click()
- assert_true(quick_open.is_visible(),'Picker failed third opening')
- page.evaluate("window.dispatchEvent(new Event('blur'))")
- assert_true(quick_open.is_hidden(),'Window blur must dismiss quick VST picker')
- # Manager remains nonmodal inside, and dismisses when click leaves it.
- page.locator('#pluginsButton').click()
- assert_true(page.locator('#pluginBrowser').is_visible(),
- 'Plugin manager button did not open')
- page.locator('#pluginSearch').fill('reverb')
- assert_true(page.locator('#pluginBrowser').is_visible(),
- 'Focus inside manager must not dismiss it')
- page.locator('.mixer-title .panel-name').click()
- # The Manager is modeless and must not block mixer interactions.
- # Shared transient-utility policy now dismisses it on outside click.
- assert_true(page.locator('#pluginBrowser').is_hidden(),
- 'Outside mixer interaction must dismiss transient Plugin Manager')
- page.locator('#pluginsButton').click()
- assert_true(page.locator('#pluginBrowser').is_visible(),
- 'Plugin Manager must reopen after modeless outside dismiss')
- page.locator('#pluginClose').click()
- assert_true(page.locator('#pluginBrowser').is_hidden(),
- 'Visible Close must dismiss reopened Plugin Manager')
- # 17px utility power retains the compact Material icon, not a cramped keycap.
- svg=page.locator('#tracks .strip[data-id="1"] .fx-section .mx-util-key[data-util-kind="fx-main"] .mi-svg').first
- assert_true(svg.count()==1 and svg.locator('path').count()==1,
- 'Compact FX power must keep readable SVG icon under the V7 utility owner')
- assert_true(page.locator('#tracks .strip[data-id="1"] .fx-section .mini.power').count()==0,
- 'Old FX power style ownership must be retired')
- assert_true(page.locator('.mixer-title .panel-sub svg.mi-svg').count()==1,
- 'Mixer panel icon must be SVG not fallback text symbol')
- selected=page.locator('#tracks .strip.selected').first
- thin=selected.evaluate("el=>getComputedStyle(el,'::after').borderTopWidth")
- assert_true(thin=='1px','V25 selected channel border must be exactly 1px')
- body=page.locator('.console-body')
- assert_true(body.evaluate("el=>getComputedStyle(el).getPropertyValue('--v13-fader-h').includes('clamp')"),
- 'Adaptive fader sizing contract must exist')
# V16 owner P0 intentionally folds WIRE to a 23px disclosure by default.
# Expand the WIRE workspace explicitly before patching.
page.locator('.section-rail [data-section="send"]').click()
@@ -310,6 +141,6 @@ def center(locator):
page.screenshot(path=str(ROOT/"preview-v15-wire-bus-only-1680.png"))
assert_true(not errors,"JavaScript errors: "+str(errors))
browser.close()
- print("PASS V15 Chromium: real OUT→IN leftward pointer cable, gain, Bus Only vs Main, clean screenshots")
+ print("PASS V15 WIRE: OUT->IN leftward pointer cable, gain and BUS ONLY selection")
if __name__=="__main__":main()
diff --git a/web/approved-native-bridge.js b/web/approved-native-bridge.js
index 609089742..00c56bcd5 100644
--- a/web/approved-native-bridge.js
+++ b/web/approved-native-bridge.js
@@ -1365,6 +1365,10 @@
vendor:"ArSonMix",category:"Dynamics",format:"Native",source:"builtin"}),
Object.freeze({id:"armix.builtin.arson-harmony.v1",name:"Harmonice",
vendor:"ArSonMix",category:"Utility",format:"Native",source:"builtin"}),
+ // The picker may show this installed native guitar processor before any
+ // external VST3 scan, without introducing a second FX engine or audio graph.
+ Object.freeze({id:"armix.builtin.guitar-rig.v1",name:"Guitar FX Rig",
+ vendor:"ArSonMix",category:"Guitar",format:"Native",source:"builtin"}),
Object.freeze({id:"armix.builtin.vocal-throw.v1",name:"ArSon Vocal Throw",
vendor:"ArSonMix",category:"Utility",format:"Native",source:"builtin",showInPicker:false}),
Object.freeze({id:"armix.builtin.8d-sonku.v1",name:"8D-SonKu",