Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/p1-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
'tests/native_artifact_packaging_contract_test.mjs'
'tests/portable_workspace_contract_test.mjs'
'tests/plugin_vault_contract_test.mjs'
'tests/live_routing_ui_contract_test.mjs'
'tests/studio_backup_contract_test.mjs'
)
node --test $contracts
Expand All @@ -90,7 +91,7 @@ jobs:
-DBUILD_TESTING=ON
-DJUCE_WEBVIEW2_PACKAGE_LOCATION="${{ github.workspace }}/.deps"
- name: Build executable and native RT tests
run: cmake --build build --config Release --target ARMixConsole ARMixMixerRoutingTests ARMixChannelRoutingContractTests ARMixChannelSendTests ARMixPreparedMixerBlockTests ARMixWorkspaceTests ARMixVaultTests ARMixBackupTests ARMixOrbitPhaseTests ARMixOrbitControlTests ARMixOrbitMotionTests ARMixOrbitDistanceTests ARMixFxBypassEnvelopeTests ARMixDearVrPolarPolicyTests ARMixRTTests ARMixPresetTests ARMixDiagnosticTests ARMixClockBridgeTests ARMixVirtualClockSoakTests ARMixCadenceTests ARMixCrackleWindowTests ARMixHealthTests ARMixPolicyTests ARMixPeriodEvidenceTests ARMixLifecycleTests ARMixWasapiProbeTests ARMixDualJuceTests ARMixClockSizingTests ARMixIndependentFormatTests ARMixRecoveryTests ARMixStreamWatchdogTests ARMixBridgeContinuityTests ARMixEndpointPolicyTests ARMixEndpointGuardTests ARMixAsioPolicyTests ARMixAsioBackendTests ARMixAsioRegistryIdentityTests ARMixDirectFenceTests --parallel 2
run: cmake --build build --config Release --target ARMixConsole ARMixMixerRoutingTests ARMixChannelRoutingContractTests ARMixChannelSendTests ARMixPreparedMixerBlockTests ARMixLiveRoutingEpochTests ARMixWorkspaceTests ARMixVaultTests ARMixBackupTests ARMixOrbitPhaseTests ARMixOrbitControlTests ARMixOrbitMotionTests ARMixOrbitDistanceTests ARMixFxBypassEnvelopeTests ARMixDearVrPolarPolicyTests ARMixRTTests ARMixPresetTests ARMixDiagnosticTests ARMixClockBridgeTests ARMixVirtualClockSoakTests ARMixCadenceTests ARMixCrackleWindowTests ARMixHealthTests ARMixPolicyTests ARMixPeriodEvidenceTests ARMixLifecycleTests ARMixWasapiProbeTests ARMixDualJuceTests ARMixClockSizingTests ARMixIndependentFormatTests ARMixRecoveryTests ARMixStreamWatchdogTests ARMixBridgeContinuityTests ARMixEndpointPolicyTests ARMixEndpointGuardTests ARMixAsioPolicyTests ARMixAsioBackendTests ARMixAsioRegistryIdentityTests ARMixDirectFenceTests --parallel 2
- name: Test realtime control primitives
run: ctest --test-dir build -C Release --output-on-failure
- name: Package verified JUCE GUI for hardware FAT
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ juce_add_gui_app(ARMixConsole
juce_add_binary_data(ARMixAssets SOURCES
web/index.html web/styles.css web/app.js web/bridge.js web/monitor.js)

target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h src/VstOrbitController.h engine/core/MixerRoutingPlan.h engine/core/ChannelRoutingContract.h engine/core/ChannelSendPlan.h engine/core/PreparedMixerBlock.h engine/core/OrbitPhase.h engine/core/OrbitControlPolicy.h engine/core/OrbitMotion.h engine/core/OrbitDistanceMapping.h engine/core/DearVrPolarPolicy.h src/PluginCatalog.h src/PluginVault.h src/PortableWorkspace.h src/StudioBackup.h src/DiagnosticsRecorder.h src/StereoPan.h src/NativePresetArchive.h src/VstBusLayout.h src/LiveGraphHandoff.h src/DiagnosticTone.h engine/core/RealtimeHealthHistogram.h engine/core/CallbackCadenceEvidence.h engine/diagnostics/CrackleEvidenceWindow.h engine/device/AdaptiveClockBridge.h engine/device/AudioProfilePolicy.h engine/device/PeriodCapabilityEvidence.h engine/device/SessionLifecycle.h engine/device/WasapiCapabilityProbe.h engine/device/JuceIndependentClockDevice.h engine/device/ClockBridgeSizing.h engine/device/IndependentStreamFormatFence.h engine/device/DirectRestoreBackoff.h engine/device/IndependentStreamWatchdog.h engine/device/BridgeContinuityGate.h engine/device/EndpointIdentityPolicy.h engine/device/WasapiEndpointIdentityGuard.h engine/device/AsioStartupPolicy.h engine/device/AsioPriorityDeviceManager.h engine/device/AsioRegistrationPolicy.h engine/device/AsioRegistryIdentityProbe.h engine/device/DirectRouteFence.h)
target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h src/VstOrbitController.h engine/core/MixerRoutingPlan.h engine/core/ChannelRoutingContract.h engine/core/ChannelSendPlan.h engine/core/PreparedMixerBlock.h engine/core/RealtimeRoutePublisher.h engine/device/LiveInputPortRegistry.h src/LiveDryRoutingLab.h engine/core/OrbitPhase.h engine/core/OrbitControlPolicy.h engine/core/OrbitMotion.h engine/core/OrbitDistanceMapping.h engine/core/DearVrPolarPolicy.h src/PluginCatalog.h src/PluginVault.h src/PortableWorkspace.h src/StudioBackup.h src/DiagnosticsRecorder.h src/StereoPan.h src/NativePresetArchive.h src/VstBusLayout.h src/LiveGraphHandoff.h src/DiagnosticTone.h engine/core/RealtimeHealthHistogram.h engine/core/CallbackCadenceEvidence.h engine/diagnostics/CrackleEvidenceWindow.h engine/device/AdaptiveClockBridge.h engine/device/AudioProfilePolicy.h engine/device/PeriodCapabilityEvidence.h engine/device/SessionLifecycle.h engine/device/WasapiCapabilityProbe.h engine/device/JuceIndependentClockDevice.h engine/device/ClockBridgeSizing.h engine/device/IndependentStreamFormatFence.h engine/device/DirectRestoreBackoff.h engine/device/IndependentStreamWatchdog.h engine/device/BridgeContinuityGate.h engine/device/EndpointIdentityPolicy.h engine/device/WasapiEndpointIdentityGuard.h engine/device/AsioStartupPolicy.h engine/device/AsioPriorityDeviceManager.h engine/device/AsioRegistrationPolicy.h engine/device/AsioRegistryIdentityProbe.h engine/device/DirectRouteFence.h)
target_compile_definitions(ARMixConsole PRIVATE
JUCE_WEB_BROWSER=1
JUCE_USE_WIN_WEBVIEW2=1
Expand Down Expand Up @@ -59,6 +59,9 @@ if(BUILD_TESTING)
add_executable(ARMixPreparedMixerBlockTests tests/prepared_mixer_block_test.cpp)
target_compile_features(ARMixPreparedMixerBlockTests PRIVATE cxx_std_20)
add_test(NAME TenChannelEndToEndPreparedAudioRender COMMAND ARMixPreparedMixerBlockTests)
add_executable(ARMixLiveRoutingEpochTests tests/live_port_epoch_publisher_test.cpp)
target_compile_features(ARMixLiveRoutingEpochTests PRIVATE cxx_std_20)
add_test(NAME P1ELivePortGenerationRevisionAndRealtimeRetirement COMMAND ARMixLiveRoutingEpochTests)
add_executable(ARMixOrbitPhaseTests tests/orbit_phase_test.cpp)
target_compile_features(ARMixOrbitPhaseTests PRIVATE cxx_std_20)
add_test(NAME VstAzimuthOrbitRamp COMMAND ARMixOrbitPhaseTests)
Expand Down
23 changes: 23 additions & 0 deletions docs/ARD_P1E_CURRENT_MAIN_RECONCILIATION_20261028.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# P1E integration reconciliation — 2026-10-28

## Source of truth and reasons for a fresh branch
Base: `main@61b2971e2be276c7b4e7fa034b64640ae1ef848e`, including folded-metal fader #120, fast-fall/ease-out meter #106, independent MASTER L/R, latest Orbit/capture #105, de-click #107, backup #116, P1D #114, pre-fader hardening #118, lean native CI #101.

The original P1E PR #119 had Windows native CI PASS [40608546403](https://github.com/masarray/arsonmix/actions/runs/40608546403) but browser UI smoke FAIL [40608546037](https://github.com/masarray/arsonmix/actions/runs/40608546037). Its `tests/ui_smoke.py` was stale and failed at a preexisting peakHold assertion (`Boolean(peakHold.masterL) is False`); #119 has no UI smoke file diff. Its source branch was built atop earlier `main@4951f3b`, before later main fader changes.

We compared the blob SHA at that base and the newest main for **every P1E-modified existing file**: `.github/workflows/p1-windows.yml`, `CMakeLists.txt`, `src/Main.cpp`, `src/LiveAudioEngine.h`, `web/monitor.js`. All five were byte-identical on latest main and old base. Thus their exact P1E candidate blobs can be safely reused; the other six files are additive P1E-only. This integration intentionally retains **all remaining file blobs from latest main**, especially the validated `tests/ui_smoke.py`, `web/app.js`, `web/bridge.js`, `web/styles.css`, fader CSS, and Orbit assets. No merge of old PR branch history or old test baseline.

## Actual scope
The opt-in **SIGNAL CHECK → DRY ROUTING LAB** provides real physical ASIO/WASAPI enabled input-channel mapping into independent 10-strip dry DSP through the preallocated P1D `PreparedMixerBlock`. Operator mute, zero loaded VST3, DIRECT route, no independent clock, native epoch and graph revision/ACK, stale-device fail-closed behavior are required. C++ route publisher uses a single atomic writer/read reservation gate and off-RT reclamation. Native callback path remains ordinary CH1 VST3 when LAB is off, and no unsupported GUI multi-VST3 claims are added. Failure, unconnected input or stale port mapping must produce silence, not fake VU activity.

## Tests and risk gates
The exact newly integrated head must run the **same** full Chromium/Firefox/Orbit GUI smoke currently green on main, native Node route contract, Windows MSVC/CTest and real executable packaging. Verify output against latest original main tree for unrelated visual source blobs. No additional CI matrices or jobs.

Do **not** claim full production 10-channel VST3, 2-AUX runtime processing, plugin graph live swap, or #15 zero-VST crackle hardware pass. P1E is operator-controlled DRY hardware FAT only. Physical Windows ASIO/WASAPI inputs, buffer dropouts, latency, mute transition and routing status must be tested on owner's actual interface. Avoid arbitrarily modifying old PR #102 FX drag engine, source fader image or Orbit; use current main as owner.

## Postreview fail-closed audio safety (P2 fixes before merge)
Two valid review comments on the first PR head required corrections:
1. A concurrent **STOP LAB** can change `active()` after the audio callback's outer check but before entering `process()`. The caller now checks the return value and explicitly zeros *all* output buffers plus all displayed output levels on a false return. Never fall through to the CH1 production renderer. No allocation or OS call on callback.
2. With mute engaged during a topology switch, interpolating old `lastOutput` after applying `masterMuted?0` output gain could leak previously audible samples into hardware output. The lab now returns early with already-cleared outputs when muted, resets all residual fade/output history and primes a 256-sample **from-zero** transition on first unmute. It also skips muted dry DSP processing to conserve CPU.

The existing Windows CTest runs unchanged; native UI Node contract now requires explicit STOP output-clear and mute-before-DSP guards. Both fail-closed safety paths are engineering corrections, not proof of hardware crackle immunity.
36 changes: 36 additions & 0 deletions docs/P1E_NATIVE_DRY_LAB_FAT_20261028.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# P1E — REAL 10-CHANNEL DRY ASIO/WASAPI FAT LAB (2026-10-28)

**Native code, not just another offline graph.** The owner-approved ten-strip P1D `PreparedMixerBlock` is now callable from the live JUCE audio callback in a **separate, explicit, fail-closed DRY ROUTING LAB**. This milestone exists to prove **actual physical input channel separation, mono/stereo hardware patching, routing graph activation and Windows device continuity**, while preserving the current VST3 CH1 production path whenever the lab is OFF.

**The lab is not a finished performance mixer.** It deliberately has NO VST3 inserts, AUX sends, independent channel fader binding, automatic portable device map restore, multi-output patchbay, PDC or FX Tail guarantees. CH2–CH10 rack buttons remain truthful preview. Never advertise ten live VST3 chains or approved #15 zero-FX crackle status based on this PR alone.

## Open it on real Windows hardware

1. Build Windows artifact from **the passing P1E PR head**, do NOT use a stale previously downloaded build. Set headphone volume physically LOW.
2. In **AUDIO SETUP**, choose and verify the actual ASIO/WASAPI DIRECT interface and enable the needed physical input channels in its active input mask. Do not expect `initialise(1,2)` to activate all channels automatically.
3. If a VST3 was loaded in CH1, save/stop it and remove it from the chain before the dry test. Disable Smart Clock / independent capture/render, set SIGNAL CHECK to NORMAL, and leave the verified DIRECT route selected.
4. Open **SIGNAL CHECK**, click **MUTE OUTPUT**, then **ROUTING LAB · 10 CH**. Only channels reported from the **actual opened device's enabled input-channel bitmask** appear in the selectors. If the port you need does not appear, enable it in AUDIO SETUP, which may restart the device; do not lie with phantom dropdown ports.
5. Example with an active 8-input interface: set CH1 **MONO** input 3; CH2 **STEREO** input 5(L) / 6(R); CH3 **MONO** input 1. All other CH4–CH10 **NONE**. Choose a low initial per-strip level, e.g. −18 or −12 dB. Press **APPLY TO NATIVE AUDIO**; wait for explicit native ACK, never infer audio commit from UI selection alone.
6. Close the routing lab, go back to SIGNAL CHECK, and deliberately **UNMUTE OUTPUT**. Stimulate each physical input separately and confirm that only the corresponding path is heard. Then try nonadjacent L/R mappings, duplicate input fanout and a muted/None channel.
7. MUTE OUTPUT and press **STOP LAB**. STOP also forces output mute before returning to the original CH1 VST3 engine; unmute only after selecting/validating the wanted signal path.

### Safety and determinism

- The lab has a separate exact input registry: `juce::BigInteger activeInputChannels` is enumerated **off callback**, mapping actual hardware ID to JUCE's packed callback pointer index. Callback channel count is checked against the prepared map for every buffer. Max 256 enabled pins accepted; larger counts fail closed.
- A monotonic **device epoch** invalidates prepared routes on device stop/restart. An active lab with a stale device does NOT fall through to old CH1 audio; it outputs silence until the operator explicitly reapplies or stops the lab. UI shows **DRY LAB STALE — SILENT**.
- Graphs compile on the message/control thread; a single atomic pointer is published with `expectedRevision` and `deviceEpoch`. Callback obtains a no-heap lease before accessing the prepared graph. Old buffers are retired only when all callback readers leave. Excess rapid edits receive a specific retry response instead of freeing audio-owned memory.
- Channel processing is bounded, uses P1D's preallocated fixed workspace, has no VST instantiation or lock in the audio callback. Variable callback quanta are chunked into the prepared hard-frame limit. On invalid buffer or stale epoch, output must be silence.
- An initial 256-sample bounded de-click fade on a new route revision starts at the previously emitted output sample. This is a topology-switch mitigation, **not yet proof of click-free behavior at any buffer rate/driver**.
- MUTE OUTPUT is a *required precondition* of every APPLY; there is never an automatic audible route to an unknown speaker. STOP forces output mute. FX add/remove, preset recall, Smart Clock mode and other diagnostic modes are blocked while LAB is active.
- The lab sends dry output to actual render callback channels 1 and 2 (0-based indices 0/1); additional output channels are cleared. No hidden ASRC/split-clock buffering is introduced on a direct ASIO path.
- If the selected input is no longer available, no plugin can synthesize signal from a dummy channel and callback output remains silent. No route is persisted to a future machine until endpoint/physical-port identities have been verified by a portable-source migration workflow.

## Engineering validation

`ARMixLiveRoutingEpochTests` includes sparse 5/2/9 input mapping, duplicate/invalid masks, generation mismatch, revisions, ABA-safe reader-held graph lifetime, full retirement queue and explicit STOP fail-closed, 8,000 sequential publications and 1,000 concurrent read/publish cycles, with all C++ assertions enabled even in Release.

`tests/live_routing_ui_contract_test.mjs` asserts the opt-in event, status/ACK, mute requirements, user port selector and preservation of the original non-native VST3-preview strips. Existing Windows native build compiles the P1E JUCE header and all previous native realtime/Orbit/FX tests; Node checks validate monitor.js.

**Real-device acceptance checklist (NOT YET PASSED):** ASIO 2/4/8 inputs; non-contiguous enabled active mask; mono→both speakers and stereo L/R isolation; unplug/replug and driver re-selection silences until remap; rapid edits/STOP while audio runs, no heap/click, 0 VST case compared with issue #15; 48/96 kHz, short buffers and controlled low-volume headphones; compare DIRECT to independent-clock diagnostics only outside LAB. Preserve logs for genuine device/render errors.

**Merge gate:** exact-head Windows Native CTest + Chromium smoke, inspect binary artifact/provenance from Actions, reconcile all parallel PRs against latest `main` before merge. **Native GUI faders for CH2–CH10 and channel-VST3 processing are not delivered in this PR.** Follow-on P1F must implement per-strip plugin instance ownership, negotiated mono/stereo bus layouts and authentic mixer fader/FX bindings after the 0-VST3 hardware signal-path FAT is clean.
Loading
Loading