Skip to content
Closed
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
10 changes: 6 additions & 4 deletions .github/workflows/p1-windows.yml
Original file line number Diff line number Diff line change
@@ -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 ]
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 ]
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -29,7 +29,9 @@ jobs:
run: nuget install Microsoft.Web.WebView2 -Version 1.0.3485.44 -OutputDirectory .deps -NonInteractive
- name: Validate native UI JavaScript
shell: pwsh
run: node --check web/bridge.js
run: |
node --check web/bridge.js
node --check web/monitor.js
- name: Configure Windows x64
shell: pwsh
run: >
Expand All @@ -49,13 +51,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/AR-MIX-Studio-P2-DAW.exe"
Copy-Item $exe.FullName "dist/AR-MIX-Studio-P2-Output-Diagnostic.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." |
Out-File -FilePath dist/FIRST_SOUND_README.txt -Encoding utf8
- uses: actions/upload-artifact@v4
with:
name: AR-MIX-Studio-P2-DAW-Workflow-Windows-x64
name: AR-MIX-Studio-P2-Output-Diagnostic-Windows-x64
path: dist/
if-no-files-found: error
retention-days: 14
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ juce_add_gui_app(ARMixConsole
NEEDS_CURL FALSE)

juce_add_binary_data(ARMixAssets SOURCES
web/index.html web/styles.css web/app.js web/bridge.js)
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)
target_compile_definitions(ARMixConsole PRIVATE
Expand Down
47 changes: 39 additions & 8 deletions src/LiveAudioEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback

void setMonitorEnabled (bool value) noexcept { monitor_.store (value); }
bool isMonitorEnabled() const noexcept { return monitor_.load(); }
void setDryTestEnabled (bool value) noexcept { dryTest_.store (value); }
bool isDryTestEnabled() const noexcept { return dryTest_.load(); }
void setMasterGainDb (float value) noexcept
{
if (std::isfinite (value)) masterGain_.store (juce::Decibels::decibelsToGain (juce::jlimit (-60.f, 10.f, value)));
Expand Down Expand Up @@ -191,7 +193,19 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback
o->setProperty ("buffer", d ? d->getCurrentBufferSizeSamples() : 0);
o->setProperty ("monitor", monitor_.load());
o->setProperty ("masterMute", masterMute_.load());
o->setProperty ("channelMute", channelMute_.load());
o->setProperty ("dryTest", dryTest_.load());
juce::AudioDeviceManager::AudioDeviceSetup setup;
deviceManager_.getAudioDeviceSetup (setup);
o->setProperty ("inputDevice", setup.inputDeviceName);
o->setProperty ("outputDevice", setup.outputDeviceName);
o->setProperty ("deviceInputChannels", d ? d->getActiveInputChannels().countNumberOfSetBits() : 0);
o->setProperty ("deviceOutputChannels", d ? d->getActiveOutputChannels().countNumberOfSetBits() : 0);
o->setProperty ("callbackInputChannels", callbackInputs_.load());
o->setProperty ("callbackOutputChannels", callbackOutputs_.load());
o->setProperty ("callbackCount", static_cast<double> (callbackCount_.load()));
o->setProperty ("inputPeak", inputPeak_.load());
o->setProperty ("postFxPeak", postFxPeak_.load());
o->setProperty ("peak", outputPeak_.load());
o->setProperty ("latencySamples", totalLatency_.load());
o->setProperty ("chainCount", count_);
Expand All @@ -208,9 +222,11 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback
juce::AudioBuffer<float> scratch_;
// Indexed atomic bypass flags: instant RT-safe toggles, no graph detachment.
std::array<std::atomic<bool>, maxFx> bypassFlags_ {};
std::atomic<bool> monitor_ { false }, channelMute_ { false }, masterMute_ { false };
std::atomic<bool> monitor_ { false }, channelMute_ { false }, masterMute_ { false }, dryTest_ { false };
std::atomic<float> masterGain_ { 1.f }, channelGain_ { 1.f };
std::atomic<float> inputPeak_ { 0.f }, outputPeak_ { 0.f };
std::atomic<float> inputPeak_ { 0.f }, postFxPeak_ { 0.f }, outputPeak_ { 0.f };
std::atomic<int> callbackInputs_ { 0 }, callbackOutputs_ { 0 };
std::atomic<unsigned long long> callbackCount_ { 0 };
std::atomic<int> totalLatency_ { 0 };

void detach()
Expand Down Expand Up @@ -247,6 +263,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback
}
totalLatency_.store (latency);
inputPeak_.store (0.f);
postFxPeak_.store (0.f);
outputPeak_.store (0.f);
}

Expand All @@ -260,12 +277,16 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback
const float* const* inputs, int inputChannels, float* const* outputs,
int outputChannels, int samples, const juce::AudioIODeviceCallbackContext&) override
{
callbackInputs_.store (inputChannels, std::memory_order_relaxed);
callbackOutputs_.store (outputChannels, std::memory_order_relaxed);
callbackCount_.fetch_add (1, std::memory_order_relaxed);
const bool enabled = monitor_.load (std::memory_order_relaxed);
const bool dry = dryTest_.load (std::memory_order_relaxed);
const bool muted = channelMute_.load (std::memory_order_relaxed)
|| masterMute_.load (std::memory_order_relaxed);
const float gain = masterGain_.load (std::memory_order_relaxed)
* channelGain_.load (std::memory_order_relaxed);
float inPeak = 0.f, outPeak = 0.f;
float inPeak = 0.f, postFxPeak = 0.f, outPeak = 0.f;
for (int offset = 0; offset < samples; offset += maxFrames)
{
const int frames = juce::jmin (maxFrames, samples - offset);
Expand All @@ -284,12 +305,21 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback
}
// MIDI capacity is empty unless the plugin itself changes it.
juce::MidiBuffer midi;
for (int fx = 0; fx < count_; ++fx)
if (!dry)
{
auto& slot = slots_[fx];
if (slot.processor && ! bypassFlags_[fx].load (std::memory_order_relaxed))
slot.processor->processBlock (scratch_, midi);
midi.clear();
for (int fx = 0; fx < count_; ++fx)
{
auto& slot = slots_[fx];
if (slot.processor && ! bypassFlags_[fx].load (std::memory_order_relaxed))
slot.processor->processBlock (scratch_, midi);
midi.clear();
}
}
for (int ch = 0; ch < 2; ++ch)
{
const float* processed = scratch_.getReadPointer (ch);
for (int i = 0; i < frames; ++i)
postFxPeak = juce::jmax (postFxPeak, std::abs (processed[i]));
}
for (int c = 0; c < outputChannels; ++c)
{
Expand All @@ -305,6 +335,7 @@ class LiveAudioEngine final : private juce::AudioIODeviceCallback
}
}
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);
}
};
2 changes: 2 additions & 0 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ std::optional<juce::WebBrowserComponent::Resource> assetFor (const juce::String&
{ data = BinaryData::app_js; size = BinaryData::app_jsSize; mime = "text/javascript"; }
else if (path == "/bridge.js")
{ data = BinaryData::bridge_js; size = BinaryData::bridge_jsSize; mime = "text/javascript"; }
else if (path == "/monitor.js")
{ data = BinaryData::monitor_js; size = BinaryData::monitor_jsSize; mime = "text/javascript"; }
else return std::nullopt;

juce::WebBrowserComponent::Resource resource;
Expand Down
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
<footer class="status"><span><i class="live-dot"></i><b>UI STUDY</b> <span class="dim-text">· <span id="audioStatus">Audio engine disconnected · Simulated meters</span></span></span><span class="status-help">Drag faders & knobs • Click FX insert to open plugin browser • Ctrl+S saves session</span><span>AR MIX v0.3 | FX HOST UI PROTOTYPE</span></footer>
<div class="toast" id="toast" role="status"></div><div class="modal hidden" id="pluginModal" role="dialog" aria-modal="true" aria-label="Choose VST plugin"><div class="modal-panel"><div class="modal-head"><div><span class="eyebrow">VST3 FX BROWSER</span><h2>Choose an effect</h2><p id="pluginTarget">Select a processor to insert in the chain</p></div><button id="closeBrowser" class="chrome-icon" aria-label="Close plugin browser">×</button></div><input id="pluginSearch" class="plugin-search" placeholder="Search by effect, category, plugin name..." autocomplete="off"><div class="plugin-categories"><button class="active" data-category="All">All</button><button data-category="Dynamics">Dynamics</button><button data-category="EQ">EQ</button><button data-category="Space">Space</button><button data-category="Creative">Creative</button></div><div id="pluginResults" class="plugin-results"></div><div class="modal-footer">Demo catalog only · Native VST3 scanning and loading not yet connected</div></div></div>
</div>
<script src="app.js"></script><script src="bridge.js"></script>
<script src="app.js"></script><script src="bridge.js"></script><script src="monitor.js"></script>
</body></html>
97 changes: 97 additions & 0 deletions web/monitor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Native output diagnostics: JS control only, never audio callback work.
(() => {
const api = window.__JUCE__?.backend;
if (!api?.emitEvent || !api?.addEventListener) return;
let state = {};
const css = document.createElement("style");
css.textContent = "#arSignalOverlay{display:none;position:fixed;inset:0;z-index:990;background:#020a10d9;align-items:center;justify-content:center}" +
"#arSignalOverlay.open{display:flex}.arSignalPanel{width:min(710px,93vw);padding:16px;background:linear-gradient(#263d4b,#10212c 80%);border:1px solid #6a92a5;border-radius:9px;color:#d9eaf3;box-shadow:0 15px 55px #000c}" +
".arSignalHeader{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.arSignalHeader h2{font-size:18px;font-weight:500;margin:0}" +
".arSignalGrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.arSignalStage{padding:10px;background:#0d202b;border:1px solid #365565;border-radius:6px;min-width:0}" +
".arSignalStage small{display:block;color:#80d4e8;font-size:10px}.arSignalStage b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;font-size:11px;margin:10px 0}" +
".arSignalMeter{background:#041019;height:9px;border:1px solid #37576a;border-radius:4px;overflow:hidden}.arSignalMeter i{display:block;width:1%;height:100%;background:linear-gradient(90deg,#14bbaa,#b6d851,#edac38)}" +
"#arSignalReason{font-size:12px;line-height:1.6;padding:12px;background:#1c3645;border:1px solid #4d7284;border-radius:5px;margin:13px 0}" +
".arSignalActions{display:flex;flex-wrap:wrap;gap:8px}.arSignalActions button,.arSignalHeader button{color:#e0f5ff;padding:8px 12px;border:1px solid #57849a;border-radius:4px;background:linear-gradient(#395b70,#143447);cursor:pointer}" +
"#arSignalFooter{margin-top:12px;font-size:11px;color:#9bbbbf;line-height:1.6}#arSignalBadge{color:#edbf7d;font-size:10px;margin-left:6px;white-space:nowrap}" +
"#arSignalOpen{padding:4px 7px;font-size:10px}";
document.head.appendChild(css);
const footer = document.querySelector("#nativeP2");
if (footer) footer.insertAdjacentHTML("beforeend",
'<button class="native-btn" id="arSignalOpen">SIGNAL CHECK</button><span id="arSignalBadge">OUTPUT DISARMED</span>');
const overlay = document.createElement("div");
overlay.id = "arSignalOverlay";
overlay.innerHTML = '<section class="arSignalPanel" role="dialog" aria-modal="true">' +
'<div class="arSignalHeader"><h2>Live Signal Check · Channel 1 → Master</h2><button id="arSignalClose">CLOSE ×</button></div>' +
'<div class="arSignalGrid">' +
'<div class="arSignalStage"><small>01 · INPUT</small><b id="arInputName">Mic</b><div class="arSignalMeter"><i id="arInputBar"></i></div></div>' +
'<div class="arSignalStage"><small>02 · POST FX</small><b id="arFxName">VST3</b><div class="arSignalMeter"><i id="arFxBar"></i></div></div>' +
'<div class="arSignalStage"><small>03 · HARDWARE OUTPUT</small><b id="arOutputName">Headphone</b><div class="arSignalMeter"><i id="arOutputBar"></i></div></div>' +
'</div><div id="arSignalReason">Reading native audio state...</div>' +
'<div class="arSignalActions"><button id="arSignalMonitor">ENABLE OUTPUT</button>' +
'<button id="arSignalDry">DRY TEST OFF</button><button id="arSignalSetup">AUDIO SETUP</button></div>' +
'<div id="arSignalFooter">The legacy Main L/R, Record and Streaming buttons are UI previews, not hardware routing. Select output using AUDIO SETUP. Use headphones at low volume.</div>' +
'</section>';
document.body.appendChild(overlay);
const el = id => document.getElementById(id);
const percent = v => Math.max(1,Math.min(100,(20*Math.log10(Math.max(1e-6,Number(v)||0))+60)*100/60));
function diagnosis(d) {
if (d.error) return "Audio driver error: "+d.error;
if (!d.connected) return "No audio device connected. Open AUDIO SETUP.";
if (!d.deviceOutputChannels) return "No active output channels. Select a headphone/speaker output in AUDIO SETUP.";
if (!d.monitor) return "OUTPUT DISARMED: the engine intentionally writes silence until ENABLE OUTPUT is clicked. This prevents microphone feedback.";
if (d.masterMute) return "MASTER MUTED: switch off the master MUTE button.";
if (d.channelMute) return "CHANNEL 1 MUTED: switch off Lead Vocal MUTE.";
if ((d.inputPeak||0)>.006 && (d.postFxPeak||0)<.0002) return "Mic input is detected but VST3 output is silent. Enable DRY TEST to bypass all plugins.";
if ((d.postFxPeak||0)>.003 && (d.peak||0)<.0002) return "Post-FX audio exists, but hardware output is silent. Check faders, mutes and output settings.";
if ((d.peak||0)>.003) return "Samples reach the output buffer. If you cannot hear them, check your interface mixer, physical output selection and headphone volume.";
if ((d.inputPeak||0)<.0005) return "Microphone signal is low/absent. Check the selected ASIO/WASAPI input and gain.";
return "Output armed. Speak into the microphone and inspect all three meters.";
}
function repaint(d) {
el("arSignalBadge").textContent = !d.monitor ? "OUTPUT MUTED" : d.masterMute ? "MASTER MUTED" : d.channelMute ? "CH1 MUTED" : "OUTPUT ARMED";
el("arSignalBadge").style.color = d.monitor && !d.masterMute && !d.channelMute ? "#71e9cc" : "#e9be7c";
const monitorButton=document.querySelector('[data-native-action="monitor"]');
if (monitorButton) monitorButton.textContent=d.monitor?"DISARM OUTPUT":"ENABLE OUTPUT";
// The original UI shell had fixed 48 kHz / 64-sample demo badges. Show
// the REAL negotiated driver parameters instead of misleading the user.
const rateLabel=document.querySelector('.spec:not(.spec-device):not(.bpm) strong');
if(rateLabel)rateLabel.textContent=d.rate?String(Math.round(d.rate/1000)):"—";
const bufferLabel=document.querySelector('.spec.bpm strong');
if(bufferLabel)bufferLabel.textContent=d.buffer?String(d.buffer):"—";
const driverLabel=document.querySelector('.spec-device strong');
if(driverLabel)driverLabel.textContent=d.driver||"NO DRIVER";
const liveLabel=document.querySelector('.status > span:first-child > b');
if(liveLabel)liveLabel.textContent="NATIVE CH1";
const edition=document.querySelector('.status > span:last-child');
if(edition)edition.textContent="AR MIX P2 · CH1 NATIVE + UI PREVIEW";
if (!overlay.classList.contains("open")) return;
el("arInputName").textContent=d.inputDevice||"Input device";
el("arFxName").textContent=d.dryTest?"DRY BYPASS":"VST3 Chain";
el("arOutputName").textContent=d.outputDevice||"Output device";
el("arInputBar").style.width=percent(d.inputPeak)+"%";
el("arFxBar").style.width=percent(d.postFxPeak)+"%";
el("arOutputBar").style.width=percent(d.peak)+"%";
el("arSignalReason").textContent=diagnosis(d);
el("arSignalMonitor").textContent=d.monitor?"DISARM OUTPUT":"ENABLE OUTPUT";
el("arSignalDry").textContent=d.dryTest?"DRY TEST ON":"DRY TEST OFF";
el("arSignalFooter").textContent=(d.driver||"Audio")+" · "+(d.rate||0)+" Hz / "+(d.buffer||0)+
" samples · "+(d.deviceInputChannels||0)+" active input / "+(d.deviceOutputChannels||0)+" active output channels · "+
(d.latencySamples||0)+" samples plugin latency. Choose hardware output using AUDIO SETUP; Main L/R and Streaming are UI previews.";
}
api.addEventListener("arMixStatus",d=>{state=d;repaint(d);});
el("arSignalOpen")?.addEventListener("click",()=>{overlay.classList.add("open");repaint(state);});
el("arSignalClose").addEventListener("click",()=>overlay.classList.remove("open"));
el("arSignalMonitor").addEventListener("click",()=>api.emitEvent("arMixAction",{action:"monitor",value:!state.monitor}));
el("arSignalDry").addEventListener("click",()=>api.emitEvent("arMixAction",{action:"dryTest",value:!state.dryTest}));
el("arSignalSetup").addEventListener("click",()=>{
overlay.classList.remove("open");
document.querySelector('[data-native-action="audioSetup"]')?.click();
});
overlay.addEventListener("click",e=>{if(e.target===overlay)overlay.classList.remove("open");});
document.addEventListener("click",e=>{
if(!e.target.closest("[data-output],#monitorSource"))return;
e.preventDefault();e.stopImmediatePropagation();
overlay.classList.add("open");repaint(state);
},true);
})();
Loading