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
2 changes: 1 addition & 1 deletion .github/workflows/p1-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,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 ARMixFxOrderTests ARMixMixerRoutingTests ARMixChannelRoutingContractTests ARMixChannelSendTests ARMixPreparedMixerBlockTests ARMixLiveRoutingEpochTests ARMixJucePortMaskTests ARMixNativeMixerSessionTests ARMixNativeDrySendTests ARMixLiveChannelFxTests ARMixDedicatedAuxBusTests ARMixTenChannelLiveControlTests ARMixWorkspaceTests ARMixVaultTests ARMixBackupTests ARMixOrbitPhaseTests ARMixOrbitControlTests ARMixOrbitMotionTests ARMixOrbitDistanceTests ARMixFxBypassEnvelopeTests ARMixDearVrPolarPolicyTests ARMixRTTests ARMixPresetTests ARMixShowSchemaTests ARMixShowStoreTests 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 ARMixFxOrderTests ARMixMixerRoutingTests ARMixChannelRoutingContractTests ARMixChannelSendTests ARMixPreparedMixerBlockTests ARMixLiveRoutingEpochTests ARMixJucePortMaskTests ARMixNativeMixerSessionTests ARMixNativeDrySendTests ARMixLiveChannelFxTests ARMixDedicatedAuxBusTests ARMixTenChannelLiveControlTests ARMixWorkspaceTests ARMixVaultTests ARMixBackupTests ARMixOrbitPhaseTests ARMixOrbitControlTests ARMixOrbitMotionTests ARMixOrbitDistanceTests ARMixFxBypassEnvelopeTests ARMixDearVrPolarPolicyTests ARMixRTTests ARMixPresetTests ARMixShowSchemaTests ARMixShowStoreTests ARMixLiveShowCaptureTests 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: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ if(BUILD_TESTING)
target_link_libraries(ARMixShowSchemaTests PRIVATE juce::juce_core juce::juce_recommended_config_flags)
target_compile_features(ARMixShowSchemaTests PRIVATE cxx_std_20)
add_test(NAME P4NativeShowSnapshotV2WireRoundTrip COMMAND ARMixShowSchemaTests)
juce_add_console_app(ARMixLiveShowCaptureTests PRODUCT_NAME "ArSonMix Live Native Dry Show Capture Tests")
target_sources(ARMixLiveShowCaptureTests PRIVATE tests/native_live_show_capture_test.cpp src/NativeLiveShowCapture.h src/NativeShowStore.h)
target_link_libraries(ARMixLiveShowCaptureTests PRIVATE juce::juce_core juce::juce_cryptography juce::juce_recommended_config_flags)
target_compile_features(ARMixLiveShowCaptureTests PRIVATE cxx_std_20)
add_test(NAME P4NativeAcknowledgedDryShowCaptureAndStorage COMMAND ARMixLiveShowCaptureTests)

juce_add_console_app(ARMixShowStoreTests PRODUCT_NAME "ArSonMix Native Studio Shows Generation Tests")
target_sources(ARMixShowStoreTests PRIVATE tests/native_show_store_test.cpp src/NativeShowStore.h src/NativeShowSchema.h)
Expand Down
26 changes: 26 additions & 0 deletions docs/P4_NATIVE_DRY_SHOW_CAPTURE_STAGE3_20261029.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# P4 stage 3 — Save an acknowledged native DRY Routing Show

**Scope:** A user-triggered, usable native SAVE path for an actual ACK-verified 10 INPUT + 4 AUX route with **zero** VST3; no simulated/localStorage state. Not native live recall.

## Runtime path
1. Enable a real verified DIRECT full-duplex device and APPLY Routing LAB. The audio engine publishes a prepared graph only after native device-mask, epoch and route revision checks.
2. In Routing LAB, adjust live CH faders/PAN/MUTE/SOLO as needed, then MUTE OUTPUT before selecting **SAVE DRY SHOW**.
3. `NativeLiveShowCapture::captureDry` runs on the JUCE message thread, reading `LiveAudioEngine::status()` and only its `dryRoutingLab.acceptedRoute` and `channelControls` native ACK. No JS draft, browser localStorage, remote path or guessed VST3 state is read.
4. Capture verifies `ready/active`, current device epoch, revision, actual physical enabled input mask, zero FX, exact 10CH controls and 4 AUX. The name and timestamp are generated natively. It preserves source NONE vs BUS distinction, sparse physical indices, exact linear faders (including 0 / -infinity), PRE/POST CH and AUX sends, AUX levels/switches, master level/mute/mono. On any error the previously accepted snapshot is unchanged.
5. `NativeShowSaveWorker` receives a **private copy** of the validated snapshot and commits one new Show generation under the portable `Studio/Shows` workspace. Staging + verification + atomic HEAD policy are reused from P4 stage 2; it reads back and compares the entire saved snapshot before showing success. IO/hashing never runs on callback or WebView paint thread. Saving and USB backup are mutually excluded.
6. The GUI only reports success from the native worker ACK. It does not arm audio, auto-apply physical I/O, auto-unmute or restore a Show. A stale/unsupported request is rejected.

## Non-negotiable guardrails
- **DRY-only**. Running VST3 state capture is explicitly refused. Muted output alone is not yet proof every vendor processor is quiescent: vendor-specific `getStateInformation` affinity, safe callback handoff, state blobs, Orbit state, hardware remap, and atomic live restore/undo remain future gates.
- This save is not full production scene recall and does not qualify #15 zero-FX hardware crackle. No arbitrary physical ports or VST3 binaries are activated from a loaded Show on a different PC.
- One existing JUCE device/engine and immutable published route. No filesystem scan, device call, plugin lifecycle operation, lock, heap allocation or JSON conversion on the audio callback.
- STOP LAB remains mute-first and restores the original CH1 path. All four AUX returns stay independent from the ten INPUT strips.
- Schema V3 carries an optional `busReturn` boolean per strip, allowing new recordings to distinguish a channel-to-channel BUS return from an unassigned NONE. Older V2/V3 snapshots without the field remain safely disconnected by default.

## Automated verification
- Native `P4NativeAcknowledgedDryShowCaptureAndStorage` CTest constructs a representative acknowledged routing session with sparse hardware mask, MONO/STEREO/BUS input types, 2 concurrent AUX, live gain 0, fader/PAN/MUTE/SOLO, PRE/POST, master and subsequent on-disk readback. Reject stale revision, output not muted, VST3, and disappeared physical input without changing last-good snapshot.
- Existing 47 native CTests + new test; Windows MSVC full app, native contract tests and packaged artifact; Chromium UI smoke (new Routing LAB button/event must not regress GUI).
- Hardware FAT still required at 48 kHz with physical 1/2/10 inputs, 128/256/480 frames, sparse ASIO/WASAPI masks, save/stop/restart/disconnect/USB backup, and #15 crackle isolation. PASS in synthetic CI is not a hardware claim.

## Next engineering milestone
True vendor VST3 state capture requires a deliberate callback quiescence/epoch handshake and correct message/vendor-thread affinity without destroying FX tails. Then integrate verified states into Show commit, preflight plugin availability, prepare off RT, and do an explicit muted atomic restore with rollback and native ACK. This stage deliberately does NOT enable old UI simulated scenes as native recalls.
1 change: 1 addition & 0 deletions src/LiveAudioEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback
channelGain_.load (std::memory_order_relaxed), -60.f));
o->setProperty ("masterDb", juce::Decibels::gainToDecibels (
masterGain_.load (std::memory_order_relaxed), -60.f));
o->setProperty ("masterLinear", masterGain_.load (std::memory_order_relaxed));
o->setProperty ("dryTest", dryTest_.load());
const auto route = diagnosticRoute();
o->setProperty ("diagnosticRoute", armix::diagnostics::routeName (route));
Expand Down
1 change: 1 addition & 0 deletions src/LiveDryRoutingLab.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ class LiveDryRoutingLab final {
const auto& st=channelEdits_[i];
auto obj=std::make_unique<juce::DynamicObject>();
obj->setProperty("db",st.linear>0.f?20.f*std::log10(st.linear):-60.f);
obj->setProperty("linear",st.linear); // exact, including hard -infinity mute
obj->setProperty("pan",st.pan*100.f);
obj->setProperty("mute",st.mute);
obj->setProperty("solo",st.solo);
Expand Down
64 changes: 61 additions & 3 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "PluginCatalog.h"
#include "PortableWorkspace.h"
#include "StudioBackup.h"
#include "NativeLiveShowCapture.h"
#include "NativeShowSaveWorker.h"
#include <cstring>
#include <optional>
#include <memory>
Expand Down Expand Up @@ -230,6 +232,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
armix::storage::NativePresetArchive presets_;
Browser browser_;
armix::storage::StudioBackup::Worker studioBackupWorker_;
armix::shows::NativeShowSaveWorker nativeShowWorker_;
bool nativeShowBusy_ = false;
bool studioBackupBusy_ = false;
std::unique_ptr<juce::FileChooser> chooser_;
std::unique_ptr<PluginEditorWindow> editorWindow_;
Expand Down Expand Up @@ -758,7 +762,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
// portable folder. IO/hashing stay on StudioBackup's worker thread.
void chooseStudioBackup()
{
if (studioBackupBusy_ || catalog_.busy() || engine_.isGraphSwitchPending())
if (studioBackupBusy_ || nativeShowBusy_ || catalog_.busy() || engine_.isGraphSwitchPending())
return emitNotice ("Finish VST import or FX recall before backing up Studio.", true);
// Large USB copies cause disk contention even on an IO worker. Avoid
// starting a backup during a live performance.
Expand All @@ -775,7 +779,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
if (safe == nullptr) return;
const auto destination = picker.getResult();
if (destination == juce::File()) return;
if (safe->studioBackupBusy_ || safe->catalog_.busy() ||
if (safe->studioBackupBusy_ || safe->nativeShowBusy_ || safe->catalog_.busy() ||
safe->engine_.isGraphSwitchPending() || !safe->engine_.isOutputMuted())
return safe->emitNotice ("Plugin import/FX recall is active; backup was not started.", true);
const auto app = juce::File::getSpecialLocation (juce::File::currentExecutableFile);
Expand Down Expand Up @@ -934,7 +938,7 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
const int slot = static_cast<int> (args.getProperty ("slot", -1));
// User may adjust live levels, but cannot alter the persisted VST
// library/preset while a background snapshot is being copied.
if (studioBackupBusy_ && (action.startsWith ("preset") ||
if ((studioBackupBusy_ || nativeShowBusy_) && (action.startsWith ("preset") ||
action.startsWith ("import") || action.startsWith ("fx") ||
action == "addCatalog" || action == "addScanFolder" ||
action == "scanVst3" || action == "routingDryApply"))
Expand Down Expand Up @@ -1026,6 +1030,60 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
" independent VST3 inserts, real PRE/POST sends. "
"Use low headphone volume; STOP LAB before normal CH1 VST3.");
}
if (action == "routingDryShowSave")
{
const auto reject=[this](const juce::String& reason) {
if(browser_.loaded) {
auto ack=std::make_unique<juce::DynamicObject>();
ack->setProperty("ok",false);
ack->setProperty("error",reason);
browser_.emitEventIfBrowserIsVisible("arMixNativeShowSaveAck",
juce::var(ack.release()));
}
emitNotice("Show not saved: "+reason,true);
};
if (nativeShowBusy_ || studioBackupBusy_ || catalog_.busy() ||
engine_.isGraphSwitchPending() || engine_.hasTemporaryDiagnosticDevice())
return reject("Finish the current Studio task before capturing a native Show.");
// Never save the unacknowledged JS draft. Message-thread capture
// reads the accepted LIVE graph, updated faders and exact device epoch.
// VST3 is fail-closed until a quiescent vendor state capture gate exists.
armix::shows::SnapshotV2 captured;
const auto name=juce::String("Dry Routing ")+juce::Time::getCurrentTime().formatted("%Y%m%d %H%M%S");
const auto error=armix::shows::NativeLiveShowCapture::captureDry(
engine_.status(),name,captured);
if(error.isNotEmpty()) {
diagnostics_.record("NATIVE_SHOW_REJECTED",error);
return reject(error);
}
auto safe=juce::Component::SafePointer<ConsoleWindow>(this);
const bool started=nativeShowWorker_.launch(settingsDirectory(),
std::move(captured),[safe](armix::shows::NativeShowSaveWorker::Result result) {
if(safe==nullptr)return;
safe->nativeShowBusy_=false;
if(!result.ok()) {
safe->diagnostics_.record("NATIVE_SHOW_SAVE_FAIL",result.error);
safe->emitNotice("Native Show not saved: "+result.error,true);
}else{
safe->diagnostics_.record("NATIVE_DRY_SHOW_SAVED",
result.showId+" | "+result.snapshotId);
safe->emitNotice("Native DRY Show saved and verified in Studio/Shows: "+
result.name+". FX-equipped Show capture/recall is not available yet.");
}
if(safe->browser_.loaded) {
auto ack=std::make_unique<juce::DynamicObject>();
ack->setProperty("ok",result.ok());
ack->setProperty("error",result.error);
ack->setProperty("showId",result.ok()?result.showId:juce::String());
ack->setProperty("snapshotId",result.ok()?result.snapshotId:juce::String());
safe->browser_.emitEventIfBrowserIsVisible("arMixNativeShowSaveAck",
juce::var(ack.release()));
}
});
if(!started)return reject("Native Show worker is busy. No session was modified.");
nativeShowBusy_=true;
return emitNotice("Saving ACK-verified dry routing to Studio/Shows on the IO worker.");
}
if (action == "routingDryStop")
{
engine_.disableDryRoutingLab();
Expand Down
Loading
Loading