From 6862bfe8206ff6a9fb2179bb293264ad3967cdbe Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 09:00:06 +0700 Subject: [PATCH 01/10] feat(dsp): real low-overhead stereo channel PAN applied after VST3 before master output --- src/LiveAudioEngine.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index b05c2ca6a..feb78d6ea 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -76,6 +76,14 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback { if (std::isfinite (value)) channelGain_.store (juce::Decibels::decibelsToGain (juce::jlimit (-60.f, 10.f, value))); } + // True stereo-to-stereo pan: centre preserves stereo; extremes fold + // both stereo input channels to the chosen side at unity for dual-mono. + // Parameter is normalized on the UI thread; callback only loads atomic. + void setChannelPan (float value) noexcept + { + if (std::isfinite (value)) + channelPan_.store (juce::jlimit (-1.f, 1.f, value), std::memory_order_relaxed); + } void setChannelMuted (bool value) noexcept { channelMute_.store (value); } void setMasterMuted (bool value) noexcept { masterMute_.store (value); } @@ -202,6 +210,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback o->setProperty ("monitor", monitor_.load()); o->setProperty ("masterMute", masterMute_.load()); o->setProperty ("channelMute", channelMute_.load()); + o->setProperty ("channelPan", channelPan_.load()); o->setProperty ("dryTest", dryTest_.load()); juce::AudioDeviceManager::AudioDeviceSetup setup; deviceManager_.getAudioDeviceSetup (setup); @@ -255,7 +264,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback // Indexed atomic bypass flags: instant RT-safe toggles, no graph detachment. std::array, maxFx> bypassFlags_ {}; std::atomic monitor_ { false }, channelMute_ { false }, masterMute_ { false }, dryTest_ { false }; - std::atomic masterGain_ { 1.f }, channelGain_ { 1.f }; + std::atomic masterGain_ { 1.f }, channelGain_ { 1.f }, channelPan_ { 0.f }; std::atomic inputPeak_ { 0.f }, postFxPeak_ { 0.f }, outputPeak_ { 0.f }; std::atomic callbackInputs_ { 0 }, callbackOutputs_ { 0 }; std::atomic callbackCount_ { 0 }; @@ -364,6 +373,13 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback || masterMute_.load (std::memory_order_relaxed); const float gain = masterGain_.load (std::memory_order_relaxed) * channelGain_.load (std::memory_order_relaxed); + const float pan = channelPan_.load (std::memory_order_relaxed); + // Precomputed stereo pan matrix; no trigonometry, locks or allocations + // in the realtime sample loop. 0 = transparent identity matrix. + const float ll = pan > 0.f ? 1.f - pan : 1.f + pan * .5f; + const float lr = pan < 0.f ? -pan * .5f : 0.f; + const float rl = pan > 0.f ? pan * .5f : 0.f; + const float rr = pan < 0.f ? 1.f + pan : 1.f - pan * .5f; float inPeak = 0.f, postFxPeak = 0.f, outPeak = 0.f; for (int offset = 0; offset < samples; offset += maxFrames) { @@ -411,11 +427,14 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback for (int c = 0; c < outputChannels; ++c) { if (!outputs[c]) continue; - const float* src = scratch_.getReadPointer (juce::jmin (c, 1)); + const float* left = scratch_.getReadPointer (0); + const float* right = scratch_.getReadPointer (1); float* dst = outputs[c] + offset; for (int i = 0; i < frames; ++i) { - const float value = (enabled && !muted) ? src[i] * gain : 0.f; + const float mapped = c == 0 ? ll * left[i] + lr * right[i] + : rl * left[i] + rr * right[i]; + const float value = (enabled && !muted) ? mapped * gain : 0.f; dst[i] = value; outPeak = juce::jmax (outPeak, std::abs (value)); } From 7cb12faef9cf7ea0add67eebbaa6fc1e46485e23 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 09:00:19 +0700 Subject: [PATCH 02/10] feat(bridge): route Channel 1 PAN control to native stereo panning DSP --- src/Main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Main.cpp b/src/Main.cpp index 5e36d768c..68ce697d4 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -183,6 +183,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr // The app.js bridge converts strip index 0 to channel ID 1. else if (name == "faderDb" && channel == 1 && (value.isDouble() || value.isInt())) engine_.setChannelGainDb (valueNumber); + else if (name == "pan" && channel == 1 && (value.isDouble() || value.isInt())) + engine_.setChannelPan (valueNumber * 0.01f); else if (name == "mute" && channel == 1 && value.isBool()) engine_.setChannelMuted (bool (value)); else if (name == "masterMute" && value.isBool()) From 1dda8f6b7a626176a8ae304d3f067c6fbf4de905 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 09:00:53 +0700 Subject: [PATCH 03/10] fix(vu): disable all fake sinusoidal meter oscillators in native Windows host --- web/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/app.js b/web/app.js index 971e150e6..a89f5b09d 100644 --- a/web/app.js +++ b/web/app.js @@ -150,7 +150,12 @@ document.addEventListener('keydown',e=>{const pan=e.target.closest('[data-pan]') updateFader(idx,e.key==='Home'?-60:e.key==='End'?10:db+steps[e.key]); }); document.addEventListener('keydown',e=>{if(e.ctrlKey&&e.key.toLowerCase()==='s'){e.preventDefault();if(persistSession())flash('UI state saved locally');else flash('Browser storage unavailable')}}); -let lastMeterFrame=0;function meters(t){requestAnimationFrame(meters);if(t-lastMeterFrame<33||document.hidden)return;lastMeterFrame=t;channels.forEach((c,i)=>{const element=document.querySelector(`[data-meter="${i}"]`);if(!element)return;const wave=(Math.sin(t*.0022+i*1.92)+Math.sin(t*.0043+i*.6))*.5;let base=clamp(45+wave*24 +c.fader*.48,4,98);if(c.mute)base=2;element.style.setProperty('--level',base.toFixed(1)+'%')});let m=clamp(67+Math.sin(t*.002)*15,8,92);['masterMeterL','masterMeterR','masterMeterAux'].forEach((id,i)=>{let x=$(id);if(x)x.style.setProperty('--level',clamp(m-i*7+Math.sin(t*.003+i)*8,4,99).toFixed(1)+'%')})} +let lastMeterFrame=0;function meters(t){ + // Demo oscillators are exclusive to browser-only visual preview. + // Native JUCE owns ALL meter readings in the Windows desktop host. + if(window.__JUCE__?.backend?.emitEvent)return; + requestAnimationFrame(meters); + if(t-lastMeterFrame<33||document.hidden)return;lastMeterFrame=t;channels.forEach((c,i)=>{const element=document.querySelector(`[data-meter="${i}"]`);if(!element)return;const wave=(Math.sin(t*.0022+i*1.92)+Math.sin(t*.0043+i*.6))*.5;let base=clamp(45+wave*24 +c.fader*.48,4,98);if(c.mute)base=2;element.style.setProperty('--level',base.toFixed(1)+'%')});let m=clamp(67+Math.sin(t*.002)*15,8,92);['masterMeterL','masterMeterR','masterMeterAux'].forEach((id,i)=>{let x=$(id);if(x)x.style.setProperty('--level',clamp(m-i*7+Math.sin(t*.003+i)*8,4,99).toFixed(1)+'%')})} // v0.3: demo-only FX catalog. Items represent mock plugins, not installed VST3 binaries. const pluginCatalog=[ {name:'Studio EQ',type:'EQ',badge:'EQ',hint:'Four-band tonal shaping'}, From cbf1939ddee0b2a67487e975ca9e6ec297eb1207 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 09:01:35 +0700 Subject: [PATCH 04/10] fix(gui): real-only VU levels and fast per-insert FX bypass in mixer and rack --- web/bridge.js | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/web/bridge.js b/web/bridge.js index 6db1fed37..d5a2dfcba 100644 --- a/web/bridge.js +++ b/web/bridge.js @@ -4,6 +4,10 @@ (() => { const backend = window.__JUCE__?.backend; if (!backend?.emitEvent || !backend?.addEventListener) return; + document.documentElement.classList.add("native-engine"); + // Clear preview levels before first device callback/status reaches WebView. + document.querySelectorAll("[data-meter],#masterMeterL,#masterMeterR,#masterMeterAux") + .forEach(el=>el.style.setProperty("--level","0%")); const send = (action, more = {}) => backend.emitEvent("arMixAction", {action, ...more}); const state = {catalog: [], chain: [], scanning: false, message: "Connecting to native host...", @@ -65,6 +69,7 @@ @media(max-width:1150px){.native-grid{grid-template-columns:1fr}.native-hdr{flex-direction:column}} `; css.textContent += "\n .native-modal{position:fixed;inset:0;z-index:700;display:flex;align-items:center;justify-content:center;\n background:rgba(3,11,18,.78);backdrop-filter:blur(5px);padding:22px;box-sizing:border-box}\n .native-modal[hidden]{display:none}\n .native-dialog{width:min(860px,96vw);max-height:min(840px,92vh);overflow:hidden;\n display:flex;flex-direction:column;background:linear-gradient(145deg,#243945 0%,#101e29 62%,#0c1821);\n border:1px solid #638293;border-radius:11px;box-shadow:0 18px 80px #000c,inset 0 1px #b2d9e449}\n .native-dialog-header{display:flex;align-items:center;justify-content:space-between;gap:15px;\n border-bottom:1px solid #3c5360;padding:14px 17px}\n .native-dialog-header h2{font-size:18px;font-weight:500;color:#e4f4f9;margin:4px 0}\n .native-dialog-body{padding:14px 17px;overflow:auto;min-height:60px}\n .native-dialog-footer{border-top:1px solid #334b58;padding:9px 17px;color:#91abb8;font-size:11px}\n .native-dialog.small{max-width:520px}\n .native-bar{height:12px;border:1px solid #527282;background:#0a1621;border-radius:7px;overflow:hidden;position:relative;\n box-shadow:inset 0 2px 5px #000c}\n .native-bar-fill{height:100%;width:0%;background:linear-gradient(180deg,#8ef6ff,#17a8da 43%,#08688e);\n box-shadow:0 0 8px #1ed5fcbb;border-right:1px solid #ddffff}\n .native-bar.unknown .native-bar-fill{width:34%;position:absolute;animation:native-indeterminate 1.65s ease-in-out infinite}\n @keyframes native-indeterminate{0%{left:-36%}50%{left:58%}100%{left:105%}}\n .native-progress-info{font:11px monospace;color:#a5d5e2;margin:8px 0;display:flex;justify-content:space-between;gap:9px}\n .native-progress-info strong{font-weight:500;color:#d8f9ff}\n #nativeScanHud{position:fixed;left:50%;transform:translateX(-50%);bottom:37px;z-index:550;\n background:#152c3b;border:1px solid #537588;border-radius:8px;box-shadow:0 6px 20px #000a;\n padding:9px 13px;width:min(470px,90vw)}\n #nativeScanHud[hidden]{display:none}\n .native-result{display:flex;align-items:center;gap:7px;background:#10222c;border:1px solid #314d5c;\n border-radius:6px;padding:9px 11px;margin:5px 0}\n .native-result span{flex:1;min-width:0}\n .native-result b{display:block;font-weight:500;color:#d6edf7;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n .native-result small{display:block;color:#88aaba;font-size:10px;margin-top:4px}\n .native-search{font-family:inherit!important}\n"; + css.textContent += "\n .native-insert-row{display:flex;align-items:center;gap:2px;width:100%;min-width:0}\n .native-insert-row>.insert{flex:1;min-width:0;text-align:left;overflow:hidden;\n text-overflow:ellipsis;white-space:nowrap;padding-left:4px;padding-right:1px}\n .native-insert-row>.native-power{flex:0 0 21px;width:21px;height:21px;\n font-size:14px;line-height:18px;text-align:center;border-radius:3px;\n border:1px solid #3b6973;color:#8becb3;cursor:pointer;padding:0;\n background:linear-gradient(#385e65,#102c30);box-shadow:inset 0 1px #91e8bd44}\n .native-insert-row>.native-power.is-off{color:#8b9ca5;border-color:#53616a;\n background:linear-gradient(#39414a,#171e27);box-shadow:none}\n .native-insert-row>.native-power:focus-visible{outline:2px solid #4dd7ff}\n .native-insert-row.is-bypassed>.insert{opacity:.54;filter:saturate(.55)}\n .native-engine .strip[data-preview=\"1\"] .meter-fill{opacity:0!important}\n .native-engine .strip[data-preview=\"1\"] .meter{opacity:.36}\n .native-engine .meter-fill{transition:height 90ms linear}\n "; document.head.appendChild(css); const footer = document.querySelector(".status-help"); if(footer) footer.innerHTML = `
@@ -107,7 +112,7 @@ ${String(i+1).padStart(2,"0")} ${escapeHtml(p.name)}${p.latency||0} samples processing latency - + @@ -250,15 +255,23 @@ if(!rack)return; if(i!==0){ rack.dataset.preview="1"; - track.title=`${track.querySelector(".channel-name")?.textContent||"Channel"} — visual preview only; native I/O not wired`; + track.dataset.preview="1"; + track.title=`${track.querySelector(".strip-name")?.textContent?.trim()||"Channel"} — visual preview only; native I/O not wired`; return; } const signature=state.chain.map(p=>p.id+"|"+p.bypass).join(","); if(rack.dataset.nativeSig===signature)return; rack.dataset.nativeSig=signature; rack.innerHTML=state.chain.slice(0,4).map((p,i)=> - ``).join("")+ + `
+ + +
`).join("")+ ``; }); @@ -383,6 +396,7 @@ } if(data.error){state.adding=false;console.warn("AR MIX native:",text);} }); + let liveInputLevel=0, liveOutputLevel=0; let lastSetupSignature=""; backend.addEventListener("arMixStatus",d=>{ state.device=d; @@ -394,12 +408,16 @@ :"NO AUDIO DEVICE · SELECT AUDIO SETUP"; toStatus(text); // Only CH1 and master are sourced from a real native audio callback. - const src=percent(d.inputPeak), out=percent(d.peak); - document.querySelectorAll("[data-meter]").forEach(x=> - x.style.setProperty("--level",x.dataset.meter==="0"?src+"%":"1%")); + const inputLevel=percent(d.inputPeak), outputLevel=percent(d.peak); + // PPM-like UI release; incoming peaks rise immediately. No fake activity, + // no visual state for the 11 channels that are still mock previews. + liveInputLevel=Math.max(inputLevel,liveInputLevel-5); + liveOutputLevel=Math.max(outputLevel,liveOutputLevel-5); + const meter=document.querySelector('[data-meter="0"]'); + if(meter)meter.style.setProperty("--level",liveInputLevel+"%"); ["masterMeterL","masterMeterR","masterMeterAux"].forEach(id=>{ const x=document.getElementById(id); - if(x)x.style.setProperty("--level",out+"%"); + if(x)x.style.setProperty("--level",liveOutputLevel+"%"); }); const cpu=document.querySelector(".cpu strong"); if(cpu)cpu.textContent="NATIVE"; From da2d55ded23ae7de2f40be1158fe861edc88fa54 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 09:01:58 +0700 Subject: [PATCH 05/10] fix(log): avoid silent 511-byte truncation of realtime health JSON snapshots --- src/DiagnosticsRecorder.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/DiagnosticsRecorder.h b/src/DiagnosticsRecorder.h index 89772415b..f7973a5a0 100644 --- a/src/DiagnosticsRecorder.h +++ b/src/DiagnosticsRecorder.h @@ -43,8 +43,11 @@ class DiagnosticsRecorder final : private juce::Thread details.replaceCharacters ("\r\n", " "); const auto utf8 = message.toRawUTF8(); auto& slot = queue_[head]; + const auto inputLength = std::strlen (utf8); const auto count = juce::jmin (static_cast (sizeof (slot.data) - 1), - std::strlen (utf8)); + inputLength); + if (inputLength > count) + truncated_.fetch_add (1, std::memory_order_relaxed); std::memcpy (slot.data, utf8, count); slot.data[count] = 0; producer_.store (next, std::memory_order_release); @@ -53,13 +56,14 @@ class DiagnosticsRecorder final : private juce::Thread juce::File getLogFile() const { return logfile_; } std::uint64_t lostRecords() const noexcept { return lost_.load(); } + std::uint64_t truncatedRecords() const noexcept { return truncated_.load(); } private: static constexpr unsigned capacity = 128; - struct Record { char data[512] {}; }; + struct Record { char data[4096] {}; }; std::array queue_ {}; std::atomic producer_ { 0 }, consumer_ { 0 }; - std::atomic lost_ { 0 }; + std::atomic lost_ { 0 }, truncated_ { 0 }; juce::File folder_, logfile_; void run() override From 776b2545bb357bb7cc9fb307effbde04b9284fad Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 09:02:13 +0700 Subject: [PATCH 06/10] feat(diag): expose log truncation metric in native engine status --- src/Main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Main.cpp b/src/Main.cpp index 68ce697d4..10e5f4bd9 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -395,6 +395,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr auto state = engine_.status(); state.getDynamicObject()->setProperty ("diagnosticsDropped", static_cast (diagnostics_.lostRecords())); + state.getDynamicObject()->setProperty ("diagnosticsTruncated", + static_cast (diagnostics_.truncatedRecords())); if (startupError_.isNotEmpty() && !bool (state.getProperty ("connected", false))) state.getDynamicObject()->setProperty ("error", startupError_); browser_.emitEventIfBrowserIsVisible ("arMixStatus", state); From 92f9d7ba201bfb13fa3fc35dfa99b9ce3cd14299 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 09:05:12 +0700 Subject: [PATCH 07/10] test+fix: native-only VU, DSP stereo PAN, one-click FX bypass, complete diagnostic logs and latest GUI --- .github/workflows/p1-windows.yml | 10 +- CMakeLists.txt | 2 +- README.md | 8 + docs/P2_LIVE_METER_PAN_FX_BYPASS.md | 22 +++ src/LiveAudioEngine.h | 10 +- src/StereoPan.h | 28 +++ tests/native_ui_contract_test.mjs | 37 ++++ tests/realtime_control_test.cpp | 21 +++ web/styles.css | 266 +++++++++++++++++----------- 9 files changed, 287 insertions(+), 117 deletions(-) create mode 100644 docs/P2_LIVE_METER_PAN_FX_BYPASS.md create mode 100644 src/StereoPan.h create mode 100644 tests/native_ui_contract_test.mjs diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 71670bec5..6aa9fd2e2 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -1,7 +1,7 @@ name: Windows Native VST3 Host on: push: - branches: [ main, feature/p1-first-sound-windows, feature/p2-native-vst-catalog-fx-rack, feature/p2-daw-workflow-progress, fix/p2-native-output-monitor-diagnostics, fix/p2-realtime-glitch-telemetry-latest-gui ] + branches: [ main, feature/p1-first-sound-windows, feature/p2-native-vst-catalog-fx-rack, feature/p2-daw-workflow-progress, fix/p2-native-output-monitor-diagnostics, fix/p2-realtime-glitch-telemetry-latest-gui, fix/p2-truthful-meter-pan-fx-toggle ] pull_request: workflow_dispatch: @@ -32,6 +32,8 @@ jobs: run: | node --check web/bridge.js node --check web/monitor.js + node --check web/app.js + node --test tests/native_ui_contract_test.mjs - name: Configure Windows x64 shell: pwsh run: > @@ -51,13 +53,13 @@ jobs: Where-Object { $_.Name -like "*AR*Mix*" -and $_.FullName -match 'Release' } | Select-Object -First 1 if (-not $exe) { throw "ARMixConsole EXE not found" } - Copy-Item $exe.FullName "dist/ArSonMix-Realtime-Diagnostics.exe" + Copy-Item $exe.FullName "dist/ArSonMix-P2-LiveMeter-Pan-FXToggle.exe" Copy-Item README.md "dist/README.md" - "P2 experimental: output muted until MONITOR ON; do not use during a public livestream without hardware tests." | + "P2 experimental: audio routes automatically; use headphones at low level. Only Channel 1 is native. Other strips are inactive previews." | Out-File -FilePath dist/FIRST_SOUND_README.txt -Encoding utf8 - uses: actions/upload-artifact@v4 with: - name: ArSonMix-RealTime-Diagnostics-Windows-x64 + name: ArSonMix-P2-LiveMeter-Pan-FXToggle-Windows-x64 path: dist/ if-no-files-found: error retention-days: 14 diff --git a/CMakeLists.txt b/CMakeLists.txt index 293176966..537820cca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ juce_add_gui_app(ARMixConsole juce_add_binary_data(ARMixAssets SOURCES web/index.html web/styles.css web/app.js web/bridge.js web/monitor.js) -target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h src/PluginCatalog.h src/DiagnosticsRecorder.h) +target_sources(ARMixConsole PRIVATE src/Main.cpp src/LiveAudioEngine.h src/PluginCatalog.h src/DiagnosticsRecorder.h src/StereoPan.h) target_compile_definitions(ARMixConsole PRIVATE JUCE_WEB_BROWSER=1 JUCE_USE_WIN_WEBVIEW2=1 diff --git a/README.md b/README.md index 631d4fe89..b8db110ba 100644 --- a/README.md +++ b/README.md @@ -72,3 +72,11 @@ Use MIX → Channel 1 ADD FX to select a real indexed VST3; PLUGINS opens Plugin - Uses current `fix/fader-thumb-symmetry-polish` GUI (ArSonMix, metal controls, horizontal PAN sliders). Audio host code stays isolated. - Press SIGNAL CHECK → OPEN DIAGNOSTIC LOG to inspect or share diagnostic evidence after reproducing audio stutter. - Read [P2.2 reliability guide](docs/P2_REALTIME_RELIABILITY.md). + +## P2.3 — Real Live VU + PAN + Instant FX Bypass + +- In the native JUCE host, v0.3 sine-wave demonstration meter generator is completely disabled. Only real Channel 1 input and real master output move; other preview channels have no fake audio activity. +- Channel 1 horizontal PAN is connected to the actual stereo output matrix after VST3, with a transparent centre and correlated-stereo-safe extremes. +- Each VST3 insert in the MIX view has a small ⏻ toggle with clear ON/OFF state. Bypass updates the atomic realtime control without rebuilding the plugin graph or leaving the MIX screen. +- Diagnostic health JSON no longer truncates every record at 511 characters; the bounded queue slot is now 4096 bytes, with a truncation counter. +- Windows CI validates the native UI contract and real DSP pan coefficient tests. Hardware verification remains necessary. diff --git a/docs/P2_LIVE_METER_PAN_FX_BYPASS.md b/docs/P2_LIVE_METER_PAN_FX_BYPASS.md new file mode 100644 index 000000000..d2819d1e0 --- /dev/null +++ b/docs/P2_LIVE_METER_PAN_FX_BYPASS.md @@ -0,0 +1,22 @@ +# P2.3 — True VU meters, real PAN and fast VST3 bypass + +## Changes +- **Native VU meters**: removed the conflicting sine-wave demo meter requestAnimationFrame path in the native WebView. Only Channel 1 input and real master output are driven from JUCE status samples. Other 11 channels remain explicitly inactive visual previews, with meter lamps disabled. +- **Meter appearance**: UI-only peak attack with a small falling-ballistic smoothing on incoming native input and master peak readings (12 Hz status cadence). No fabricated noise or sine animation. +- **Native PAN**: Channel 1 pan slider -100..100 now controls an atomic normalized stereo pan matrix applied *after* actual VST3 processing, before master gain. At centre, stereo passes unchanged. At a hard side, both stereo channels fold into the target channel at 0.5 each; dual-mono does not double its amplitude. Stereo balance is not a full multichannel spatial panner. +- **Fast Studio One-style insert enable**: Every native FX insert on the MIX channel strip now includes a dedicated ON/OFF power toggle. Clicking the plugin body still opens the VST3 editor. Power updates the existing atomic bypass flag, without callback detachment or FX Rack navigation. The FX Rack includes the same on/off state. +- **Logger repaired**: Uploaded 08:48–08:54 diagnostic log contained 364 AUDIO_HEALTH lines with exactly 511 bytes of text each, so time counters and VST slot details were truncated. Queue slot increased from 512 to 4096 bytes and truncation counts are exposed for verification. This does *not* retroactively recover the missing metrics. +- **Latest GUI**: adopted the current style sheet from the metallic PAN/fader GUI branch. No redesign of accepted user artwork. + +## Acceptance tests +1. Run the new native EXE and confirm only Channel 1 input and master output react to actual input. All other strip meters remain dormant, even after changing tabs and moving faders. +2. Move Channel 1 PAN to hard left, centre and hard right with stereo headphones. A dual-mono vocal should move to the chosen ear and return to both at centre. +3. Add ArSonKuPik to MIX Channel 1, click the small ⏻ button on its insert (not the editor name). Sound must alternate FX processed/bypassed without an audio device restart. Watch ON/OFF immediately reflect native chain state. +4. Click the plugin name to open the native VST3 editor. +5. Open SIGNAL CHECK and OPEN DIAGNOSTIC LOG, reproduce for 1–2 minutes, confirm AUDIO_HEALTH JSON records are no longer clipped at 511 characters and the callback/plugin timings can be parsed. +6. Verify monitoring still flows automatically and no sonic dropout is introduced. + +## Boundaries +- Only Channel 1 is native. The other channels and their mock inserts are visual previews. +- A successful CI build does not prove audio quality or round-trip stability on specific Windows hardware. +- Real ASIO/WASAPI channel assignment for 12 native channels, presets and streaming output is still out of scope. diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index feb78d6ea..99ac91e6b 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -2,6 +2,7 @@ #pragma once #include #include +#include "StereoPan.h" #include #include #include @@ -376,10 +377,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback const float pan = channelPan_.load (std::memory_order_relaxed); // Precomputed stereo pan matrix; no trigonometry, locks or allocations // in the realtime sample loop. 0 = transparent identity matrix. - const float ll = pan > 0.f ? 1.f - pan : 1.f + pan * .5f; - const float lr = pan < 0.f ? -pan * .5f : 0.f; - const float rl = pan > 0.f ? pan * .5f : 0.f; - const float rr = pan < 0.f ? 1.f + pan : 1.f - pan * .5f; + const auto matrix = armix::dsp::StereoPanMatrix::fromNormalized (pan); float inPeak = 0.f, postFxPeak = 0.f, outPeak = 0.f; for (int offset = 0; offset < samples; offset += maxFrames) { @@ -432,8 +430,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback float* dst = outputs[c] + offset; for (int i = 0; i < frames; ++i) { - const float mapped = c == 0 ? ll * left[i] + lr * right[i] - : rl * left[i] + rr * right[i]; + const float mapped = c == 0 ? matrix.ll * left[i] + matrix.lr * right[i] + : matrix.rl * left[i] + matrix.rr * right[i]; const float value = (enabled && !muted) ? mapped * gain : 0.f; dst[i] = value; outPeak = juce::jmax (outPeak, std::abs (value)); diff --git a/src/StereoPan.h b/src/StereoPan.h new file mode 100644 index 000000000..4d205a88f --- /dev/null +++ b/src/StereoPan.h @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include + +namespace armix::dsp +{ +// Branch selection occurs once per buffer, not inside the sample loop. +// Center: transparent stereo identity. +// Extremes: both channels fold into the selected output with 0.5 weights, +// so dual-mono input stays at unity instead of gaining +6 dB. +struct StereoPanMatrix final +{ + float ll = 1.f, lr = 0.f, rl = 0.f, rr = 1.f; + + static StereoPanMatrix fromNormalized (float p) noexcept + { + if (!std::isfinite (p)) p = 0.f; + p = std::clamp (p, -1.f, 1.f); + return { + p > 0.f ? 1.f - p : 1.f + .5f * p, + p < 0.f ? -.5f * p : 0.f, + p > 0.f ? .5f * p : 0.f, + p < 0.f ? 1.f + p : 1.f - .5f * p + }; + } +}; +} // namespace armix::dsp diff --git a/tests/native_ui_contract_test.mjs b/tests/native_ui_contract_test.mjs new file mode 100644 index 000000000..6d6ce9675 --- /dev/null +++ b/tests/native_ui_contract_test.mjs @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// No dependencies; catches regressions between the legacy v0.3 GUI and native host. +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +const app=readFileSync('web/app.js','utf8'); +const bridge=readFileSync('web/bridge.js','utf8'); +const engine=readFileSync('src/LiveAudioEngine.h','utf8'); +const main=readFileSync('src/Main.cpp','utf8'); +const recorder=readFileSync('src/DiagnosticsRecorder.h','utf8'); +test('native app never runs demo sine meters',()=>{ + const fn=app.indexOf('function meters(t)'); + const nativeExit=app.indexOf('if(window.__JUCE__?.backend?.emitEvent)return;',fn); + const demoLoop=app.indexOf('requestAnimationFrame(meters)',fn); + assert.ok(fn>=0 && nativeExit>fn && nativeExit{ + assert.match(bridge,/inputLevel=percent\(d\.inputPeak\)/); + assert.match(bridge,/outputLevel=percent\(d\.peak\)/); + assert.match(bridge,/track\.dataset\.preview="1"/); + assert.match(bridge,/\.strip\[data-preview="1"\] \.meter-fill/); +}); +test('quick FX bypass is wired to native slot instead of demo mock',()=>{ + assert.match(bridge,/data-native-fx="bypass" data-slot="\$\{i\}"/); + assert.match(bridge,/aria-pressed="\$\{!p\.bypass\}"/); + assert.match(bridge,/send\("fxBypass",\{slot,value:!state\.chain\[slot\]\?\.bypass\}\)/); + assert.match(engine,/bypassFlags_\[index\]\.store/); +}); +test('GUI pan event reaches actual callback pan matrix',()=>{ + assert.match(app,/send\('pan',c\.pan,idx\)/); + assert.match(main,/name == "pan" && channel == 1/); + assert.match(engine,/StereoPanMatrix::fromNormalized/); +}); +test('health logger has room for complete JSON snapshots',()=>{ + assert.match(recorder,/char data\[4096\]/); + assert.match(recorder,/truncatedRecords\(\)/); +}); diff --git a/tests/realtime_control_test.cpp b/tests/realtime_control_test.cpp index 8d18885e2..e90023bdd 100644 --- a/tests/realtime_control_test.cpp +++ b/tests/realtime_control_test.cpp @@ -1,7 +1,11 @@ // SPDX-License-Identifier: AGPL-3.0-only #include "../engine/core/RealtimeControl.h" #include +#ifdef NDEBUG + #undef NDEBUG +#endif #include +#include "../src/StereoPan.h" #include #include #include @@ -29,5 +33,22 @@ int main(){ std::thread producer([&]{for(std::uint32_t i=0;i Date: Sun, 25 Oct 2026 09:06:56 +0700 Subject: [PATCH 08/10] fix(vu): publish independent native left/right master peak meters for PAN visualization --- src/LiveAudioEngine.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/LiveAudioEngine.h b/src/LiveAudioEngine.h index 99ac91e6b..c717c31b8 100644 --- a/src/LiveAudioEngine.h +++ b/src/LiveAudioEngine.h @@ -249,6 +249,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback o->setProperty ("inputPeak", inputPeak_.load()); o->setProperty ("postFxPeak", postFxPeak_.load()); o->setProperty ("peak", outputPeak_.load()); + o->setProperty ("peakLeft", outputPeakL_.load()); + o->setProperty ("peakRight", outputPeakR_.load()); o->setProperty ("latencySamples", totalLatency_.load()); o->setProperty ("chainCount", count_); return juce::var (o.release()); @@ -267,6 +269,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback std::atomic monitor_ { false }, channelMute_ { false }, masterMute_ { false }, dryTest_ { false }; std::atomic masterGain_ { 1.f }, channelGain_ { 1.f }, channelPan_ { 0.f }; std::atomic inputPeak_ { 0.f }, postFxPeak_ { 0.f }, outputPeak_ { 0.f }; + std::atomic outputPeakL_ { 0.f }, outputPeakR_ { 0.f }; std::atomic callbackInputs_ { 0 }, callbackOutputs_ { 0 }; std::atomic callbackCount_ { 0 }; // Audio-thread-only timestamp and cheap atomically published counters. @@ -379,6 +382,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback // in the realtime sample loop. 0 = transparent identity matrix. const auto matrix = armix::dsp::StereoPanMatrix::fromNormalized (pan); float inPeak = 0.f, postFxPeak = 0.f, outPeak = 0.f; + float outPeakL = 0.f, outPeakR = 0.f; for (int offset = 0; offset < samples; offset += maxFrames) { const int frames = juce::jmin (maxFrames, samples - offset); @@ -428,19 +432,25 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback const float* left = scratch_.getReadPointer (0); const float* right = scratch_.getReadPointer (1); float* dst = outputs[c] + offset; + float channelPeak = 0.f; for (int i = 0; i < frames; ++i) { const float mapped = c == 0 ? matrix.ll * left[i] + matrix.lr * right[i] : matrix.rl * left[i] + matrix.rr * right[i]; const float value = (enabled && !muted) ? mapped * gain : 0.f; dst[i] = value; - outPeak = juce::jmax (outPeak, std::abs (value)); + channelPeak = juce::jmax (channelPeak, std::abs (value)); } + outPeak = juce::jmax (outPeak, channelPeak); + if (c == 0) outPeakL = juce::jmax (outPeakL, channelPeak); + if (c == 1) outPeakR = juce::jmax (outPeakR, channelPeak); } } inputPeak_.store (juce::jmin (1.f, inPeak), std::memory_order_relaxed); postFxPeak_.store (juce::jmin (1.f, postFxPeak), std::memory_order_relaxed); outputPeak_.store (juce::jmin (1.f, outPeak), std::memory_order_relaxed); + outputPeakL_.store (juce::jmin (1.f, outPeakL), std::memory_order_relaxed); + outputPeakR_.store (juce::jmin (1.f, outPeakR), std::memory_order_relaxed); const auto elapsedUs = clockMicros() - beginUs; lastCallbackUs_.store (elapsedUs, std::memory_order_relaxed); publishMax (worstCallbackUs_, elapsedUs); From 631ba0f05d4503342de43830f0f20f0e21f953e0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 09:07:17 +0700 Subject: [PATCH 09/10] fix(gui): display independent real master L/R VU levels driven by native PAN --- web/bridge.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/web/bridge.js b/web/bridge.js index d5a2dfcba..33fd2388f 100644 --- a/web/bridge.js +++ b/web/bridge.js @@ -396,7 +396,7 @@ } if(data.error){state.adding=false;console.warn("AR MIX native:",text);} }); - let liveInputLevel=0, liveOutputLevel=0; + let liveInputLevel=0, liveOutputLevel=0, liveOutputLeft=0, liveOutputRight=0; let lastSetupSignature=""; backend.addEventListener("arMixStatus",d=>{ state.device=d; @@ -409,16 +409,22 @@ toStatus(text); // Only CH1 and master are sourced from a real native audio callback. const inputLevel=percent(d.inputPeak), outputLevel=percent(d.peak); - // PPM-like UI release; incoming peaks rise immediately. No fake activity, - // no visual state for the 11 channels that are still mock previews. + // Real left/right peaks reflect PAN. Fast attack, capped 12-Hz UI release. liveInputLevel=Math.max(inputLevel,liveInputLevel-5); liveOutputLevel=Math.max(outputLevel,liveOutputLevel-5); + liveOutputLeft=Math.max(percent(d.peakLeft),liveOutputLeft-5); + liveOutputRight=Math.max(percent(d.peakRight),liveOutputRight-5); const meter=document.querySelector('[data-meter="0"]'); if(meter)meter.style.setProperty("--level",liveInputLevel+"%"); - ["masterMeterL","masterMeterR","masterMeterAux"].forEach(id=>{ + const nativeMasterLevels={ + masterMeterL:liveOutputLeft, + masterMeterR:liveOutputRight, + masterMeterAux:liveOutputLevel + }; + for(const [id,level] of Object.entries(nativeMasterLevels)){ const x=document.getElementById(id); - if(x)x.style.setProperty("--level",liveOutputLevel+"%"); - }); + if(x)x.style.setProperty("--level",level+"%"); + } const cpu=document.querySelector(".cpu strong"); if(cpu)cpu.textContent="NATIVE"; const statusSetup=document.querySelector("[data-native-setup]"); From c973a9c27b91894c41f0edf2a87650b6494075a8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 25 Oct 2026 09:08:12 +0700 Subject: [PATCH 10/10] test(ui): match escaped CSS source robustly and verify independent L/R native meters --- tests/native_ui_contract_test.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/native_ui_contract_test.mjs b/tests/native_ui_contract_test.mjs index 6d6ce9675..671917ebf 100644 --- a/tests/native_ui_contract_test.mjs +++ b/tests/native_ui_contract_test.mjs @@ -17,8 +17,10 @@ test('native app never runs demo sine meters',()=>{ test('native meter reads DSP and hides all 11 visual-only channels',()=>{ assert.match(bridge,/inputLevel=percent\(d\.inputPeak\)/); assert.match(bridge,/outputLevel=percent\(d\.peak\)/); + assert.ok(bridge.includes("masterMeterL:liveOutputLeft")); + assert.ok(bridge.includes("masterMeterR:liveOutputRight")); assert.match(bridge,/track\.dataset\.preview="1"/); - assert.match(bridge,/\.strip\[data-preview="1"\] \.meter-fill/); + assert.ok(bridge.includes("meter-fill{opacity:0!important}")); }); test('quick FX bypass is wired to native slot instead of demo mock',()=>{ assert.match(bridge,/data-native-fx="bypass" data-slot="\$\{i\}"/);