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
73 changes: 64 additions & 9 deletions AR-MIX-Live-FX-Host-Standalone-v0.3.html
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,54 @@
#app #scenesList .scene-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}
#app #scenesList .scene-delete{flex:0 0 20px;height:18px;padding:0;border:1px solid #53646d;border-radius:2px;background:#26343c;color:#d0dbdf;font-size:14px;line-height:14px}
#app #scenesList .scene-delete:hover{background:#40515a}

/* The mono meter has ONE LED slot, stereo/master TWO. Keep 7px fixed LEDs. */
#app #mixer .fader-zone .vu-bank.is-mono{
flex-basis:35px;width:35px;min-width:35px;max-width:35px;
}
#app #mixer .fader-zone .vu-bank.is-mono .vu-bars{
flex-basis:14px;width:14px;min-width:14px;max-width:14px;
}
/* Same machined recessed folds as fader; no external rectangular stroke. */
#app #mixer .fader-zone .vu-bank .vu-bars{
position:relative;isolation:isolate;border:0;border-radius:5px;background:#24343c;
box-shadow:inset 0 4px 4px -3px #070e13,inset 0 -4px 4px -3px #070e13,
inset 4px 0 5px -4px #081116,inset -4px 0 5px -4px #081116;
}
#app #mixer .fader-zone .vu-bank .meter-unit .meter{
border:0;border-radius:2px;background:#080f14;
box-shadow:inset 0 1px 2px #0009,inset 1px 0 2px #000c,inset -1px 0 2px #000b;
}
#app #mixer .fader-zone .vu-bank .meter-unit .meter::after{
inset:0;background:linear-gradient(180deg,#d3eced10,transparent 35%);
}
/* LUFS / dBTP: exactly two lines in a black glass LCD. No blur/compositor. */
#app #masterLeft .master-controls-zone .master-analysis{
box-sizing:border-box;height:38px;min-height:38px;flex:0 0 38px;
display:flex;flex-direction:column;justify-content:center;gap:1px;
margin:0;padding:3px 6px;border:0;border-radius:4px;
background:linear-gradient(180deg,#0d1c1c,#030a0b 35%,#071313);
box-shadow:inset 0 3px 4px -2px #000,inset 2px 0 3px -2px #000,
inset -2px 0 3px -2px #000,inset 0 -1px 0 #40625c77;
}
#app #masterLeft .master-controls-zone .master-analysis .master-info-row{
display:flex;align-items:center;justify-content:space-between;
flex:0 0 14px;height:14px;min-height:14px;margin:0;
color:#70c2a1;font:600 9px/14px Consolas,monospace;
}
#app #masterLeft .master-controls-zone .master-analysis .master-info-row strong{
color:#58f3a0;font:700 12px/14px Consolas,monospace;
min-width:0;text-align:right;text-shadow:none;
}
#app #masterLeft .master-controls-zone .master-analysis .master-info-row strong.over-limit{
color:#ff555f;text-shadow:none;
}

/* Borderless deep LED slit keeps the approved 10px illuminated cell width. */
#app #mixer .fader-zone .meter-signal-area .meter-fill,
#app #mixer .fader-zone .meter-signal-area .meter-peak{
left:2px;right:2px;
}
</style></head>
<body>
<div id="app" class="app">
Expand Down Expand Up @@ -1616,7 +1664,7 @@
<div class="ch-id">${i+1}</div><div class="rack">${inserts.map((n,j)=>`<div class="insert-slot ${n&&bypassed[fxKey(i,j)]?'is-bypassed':''}"><button class="insert ${!n?'empty':''}" data-insert="${i}:${j}" title="${n?'Open or replace '+safeText(n):'Add VST effect'}">${n?'':'<span class="insert-add-glyph" aria-hidden="true">+</span>'}<span class="insert-name">${n? safeText(n):'ADD FX'}</span></button>${n?`<button type="button" class="fx-power ${bypassed[fxKey(i,j)]?'is-bypassed':''}" data-fxpower="${i}:${j}" aria-pressed="${!bypassed[fxKey(i,j)]}" aria-label="${bypassed[fxKey(i,j)]?'Enable':'Bypass'} ${safeText(n)}" title="${bypassed[fxKey(i,j)]?'Enable':'Bypass'} ${safeText(n)}">⏻</button>`:''}</div>`).join('')}</div>
<div class="strip-controls"><div class="trim-row"><span class="mini-label">TRIM<br>dB</span><div class="mini-lcd" data-trim-read="${i}">${fmt(ch.trim)}</div></div>${knobMarkup('trim',i,ch.trim,'Trim')}<div class="pan-control">${panMarkup(ch,i)}<div class="pan-readline"><span aria-hidden="true">L</span><strong data-pan-read="${i}">${panText(ch.pan)}</strong><span aria-hidden="true">R</span></div></div><div class="utility-row"><button data-pre="${i}" class="btn-180 ${ch.pre?'active':''}">Ø</button><button data-hpf="${i}" class="btn-180 ${ch.hpf?'active':''}">HPF</button></div></div>
<div class="channel-actions"><button class="btn-180 candy mute ${ch.mute?'active':''}" data-mute="${i}" aria-pressed="${ch.mute}">MUTE</button><button class="btn-180 candy solo ${ch.solo?'active':''}" data-solo="${i}" aria-pressed="${ch.solo}">SOLO</button></div>
<div class="db-display" data-read="${i}">${fmt(ch.fader)}</div><div class="fader-zone"><div class="vu-bank" role="group" aria-label="${safeText(ch.name)} ${ch.stereo?'stereo left and right meters':'mono meter'}"><div class="vu-bars">${ch.stereo?meterUnit(String(i)+'L','L')+meterUnit(String(i)+'R','R'):meterUnit(String(i),'')}</div>${meterScaleMarkup()}</div><div class="fader" data-fader="${i}" role="slider" tabindex="0" aria-orientation="vertical" aria-label="${ch.name} fader" aria-valuemin="-60" aria-valuemax="10" aria-valuenow="${ch.fader}"><div class="fader-travel"><div class="cap" style="--pos:${levelToTop(ch.fader)}%"></div></div></div>${faderScaleMarkup()}</div></div>
<div class="db-display" data-read="${i}">${fmt(ch.fader)}</div><div class="fader-zone"><div class="vu-bank ${ch.stereo?'is-stereo':'is-mono'}" role="group" aria-label="${safeText(ch.name)} ${ch.stereo?'stereo left and right meters':'mono meter'}"><div class="vu-bars">${ch.stereo?meterUnit(String(i)+'L','L')+meterUnit(String(i)+'R','R'):meterUnit(String(i),'')}</div>${meterScaleMarkup()}</div><div class="fader" data-fader="${i}" role="slider" tabindex="0" aria-orientation="vertical" aria-label="${ch.name} fader" aria-valuemin="-60" aria-valuemax="10" aria-valuenow="${ch.fader}"><div class="fader-travel"><div class="cap" style="--pos:${levelToTop(ch.fader)}%"></div></div></div>${faderScaleMarkup()}</div></div>
<div class="strip-name" data-editstrip="${i}" role="button" tabindex="0" aria-label="Double-click to edit ${safeText(ch.name)} name, icon and color" title="Double-click to edit channel identity"><span class="strip-caption">${safeText(ch.name)}</span><span class="track-icon">${safeText(ch.icon)}</span></div>
</article>`}
function renderMixer(){
Expand Down Expand Up @@ -1646,10 +1694,9 @@
host.innerHTML=`<div class="ch-id master-ch-id">MASTER</div>
<div class="master-fx-rack">${masterFxRows()}</div>
<div class="strip-controls master-controls-zone">
<div class="master-analysis" role="group" aria-label="Livestreaming loudness and true peak (simulated)">
<div class="master-info-kicker">STREAM LEVELS <span>SIM</span></div>
<div class="master-info-row"><span>LUFS-I</span><strong id="masterLufs" aria-label="Integrated loudness">--</strong></div>
<div class="master-info-row"><span>dBTP</span><strong id="masterDbtp" aria-label="True peak">--</strong></div>
<div class="master-analysis" role="group" aria-label="LUFS integrated loudness and dBTP true peak" title="Browser demo is simulated; actual native loudness/true peak not implemented">
<div class="master-info-row"><span>LUFS</span><strong id="masterLufs" aria-label="Integrated loudness unavailable">—</strong></div>
<div class="master-info-row"><span>dBTP</span><strong id="masterDbtp" aria-label="True peak unavailable">—</strong></div>
</div>
<div class="master-pan-wrap">
<div class="pan-control"><div class="pan-track ${masterPan===0?'is-centered':''}" data-pan="master"
Expand Down Expand Up @@ -1999,10 +2046,18 @@
const base=clamp(67+Math.sin(t*.002)*15,8,95);
const l=clamp(base+Math.sin(t*.003)*6,3,99),r=clamp(base-5+Math.sin(t*.003+1)*7,3,99);
updateMeterVisual('masterL',masterMute?2:l,t);updateMeterVisual('masterR',masterMute?2:r,t);
// UI demonstration only. These values are never from a true-peak or loudness meter.
const lufs=$('masterLufs'),tp=$('masterDbtp');
if(lufs)lufs.textContent=(-31+(l+r)/11).toFixed(1);
if(tp)tp.textContent=(-18+Math.max(l,r)/7).toFixed(1);
// UI preview only. No native BS.1770 or oversampled true peak is calculated.
updateMasterAnalysisPreview(-31+(l+r)/11,-18+Math.max(l,r)/7);
}
// Threshold color policy for browser-only preview, no additional timer.
function updateMasterAnalysisPreview(lufs,dbtp){
for(const [id,value,limit] of [['masterLufs',lufs,-12],['masterDbtp',dbtp,-1]]){
const el=$(id);if(!el)continue;
const valid=Number.isFinite(value),next=valid?value.toFixed(1):'—';
if(el.textContent!==next)el.textContent=next;
el.classList.toggle('over-limit',valid&&value>limit);
el.setAttribute('aria-label',valid?('Simulated '+id+' '+next):(id+' unavailable'));
}
}
// v0.3: demo-only FX catalog. Items represent mock plugins, not installed VST3 binaries.
const pluginCatalog=[
Expand Down
50 changes: 45 additions & 5 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ class Browser final : public juce::WebBrowserComponent
public:
explicit Browser (Options options) : WebBrowserComponent (std::move (options)) {}
bool loaded = false;
// Paint a lightweight native first-frame while WebView2 spins up. This is
// entirely static JUCE graphics, not an overlay CSS compositor or timer.
// The embedded browser owns the content as soon as its authenticated
// arMixGuiReady event arrives.
void paint (juce::Graphics& g) override
{
if (loaded) return;
g.fillAll (juce::Colour (0xff111b23));
g.setColour (juce::Colour (0xff58cdeb));
g.setFont (juce::FontOptions (22.0f, juce::Font::plain));
g.drawText ("ArSonMix", getLocalBounds().withTrimmedTop (getHeight() / 2 - 36)
.removeFromTop (30), juce::Justification::centred);
g.setColour (juce::Colour (0xff94adbb));
g.setFont (juce::FontOptions (12.0f));
g.drawText ("Loading mixer interface", getLocalBounds().withTrimmedTop (
getHeight() / 2 + 4).removeFromTop (24),
juce::Justification::centred);
}
// An Internet Explorer error page can trigger this callback too.
// Only arMixGuiReady from our final JS script authenticates readiness.
void pageFinishedLoading (const juce::String&) override {}
Expand Down Expand Up @@ -159,7 +177,12 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
presets_ (settingsDirectory().getChildFile ("presets"), settingsDirectory()),
browser_ (webViewOptions()
.withNativeIntegrationEnabled()
.withEventListener ("arMixGuiReady", [this] (juce::var) { browser_.loaded = true; })
.withEventListener ("arMixGuiReady", [this] (juce::var)
{
browser_.loaded = true;
guiReadyTick_ = juce::Time::getMillisecondCounter();
browser_.repaint();
})
.withEventListener ("arMixParameter", [this] (juce::var args) { onParameter (args); })
.withEventListener ("arMixAction", [this] (juce::var args) { onAction (args); })
.withResourceProvider (assetFor))
Expand All @@ -173,13 +196,13 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
centreWithSize (1650, 930);
setVisible (true);

auto saved = juce::XmlDocument::parse (machineSettingsDirectory().getChildFile ("audio-devices.xml"));
startupError_ = engine_.start (saved.get());
engine_.devices().addChangeListener (this);
diagnostics_.record ("STARTUP", startupError_.isEmpty() ? "Audio device initialized" : startupError_);
// Begin WebView navigation BEFORE any synchronous JUCE driver setup.
// Device startup on cold PCs otherwise blocks the very first GUI.
webViewStartupTick_ = juce::Time::getMillisecondCounter();
browser_.goToURL (juce::WebBrowserComponent::getResourceProviderRoot());
startTimerHz (12);
// The existing 12Hz message-thread tick starts the audio engine after
// an authenticated GUI handshake and initial compositor paint.
// Defer initial scan until explicitly requested in Plugin Manager.
// Startup must not spend seconds enumerating third-party VST3 modules.
}
Expand Down Expand Up @@ -215,6 +238,8 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
bool initialStateSent_ = false;
bool webViewStartupNoticeSent_ = false;
juce::uint32 webViewStartupTick_ = 0;
juce::uint32 guiReadyTick_ = 0;
bool audioEngineStarted_ = false;
bool setupLaunching_ = false;
unsigned int timerTicks_ = 0;
bool deviceSettingsDirty_ = false;
Expand Down Expand Up @@ -1436,6 +1461,21 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr
" Check the WebView2 Runtime and browser-cache folder permissions.");
return;
}
// First visible GUI frame must precede device discovery. Reuse the
// existing timer; never add a worker or poll the audio callback.
if (!audioEngineStarted_)
{
if (!browser_.loaded ||
juce::Time::getMillisecondCounter() - guiReadyTick_ < 150u)
return;
audioEngineStarted_ = true;
auto saved = juce::XmlDocument::parse (
machineSettingsDirectory().getChildFile ("audio-devices.xml"));
startupError_ = engine_.start (saved.get());
engine_.devices().addChangeListener (this);
diagnostics_.record ("STARTUP",
startupError_.isEmpty() ? "Audio device initialized" : startupError_);
}
// ONE actionable notice per unexpected DIRECT reroute. The audio
// callback has already zero-filled output atomically; status, log and
// WebView notifications belong only on this JUCE control timer.
Expand Down
22 changes: 21 additions & 1 deletion tests/main_v08_native_integration_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test('GUI v0.8 remains the canonical host, not an older v0.5 reset',()=>{
assert.match(app,/function openChannelIdentity\(/);
assert.match(app,/function masterFxRows\(/);
assert.match(app,/class="master-analysis"/);
assert.match(app,/LUFS-I/);
assert.ok(app.includes('<span>LUFS</span>'));
assert.match(app,/dBTP/);
assert.match(html,/id="channelIdentity"/);
assert.match(css,/rail-input-footer/);
Expand Down Expand Up @@ -68,3 +68,23 @@ test('native plugin state and graph preserved',()=>{
assert.match(bridge,/Master PAN DSP not yet implemented/);
assert.match(bridge,/data-fxpower/);
});

test('startup never opens an audio device before the WebView2 GUI handshake',()=>{
const constructor=main.slice(main.indexOf('ConsoleWindow()'),main.indexOf('~ConsoleWindow()'));
const ready=constructor.indexOf('browser_.goToURL');
assert.ok(ready>=0,'GUI navigation must be started from constructor');
assert.ok(!constructor.includes('engine_.start ('),'synchronous audio startup must not block the first WebView frame');
const timer=main.slice(main.indexOf('void timerCallback() override'));
const readyGate=timer.indexOf('if (!audioEngineStarted_)');
const startup=timer.indexOf('engine_.start (saved.get())');
assert.ok(readyGate>=0&&startup>readyGate);
assert.ok(timer.includes('browser_.loaded')&&timer.includes('guiReadyTick_ < 150u'));
});
test('master readout remains native-unavailable until measured BS.1770/true peak exists',()=>{
assert.match(app,/updateMasterAnalysisPreview\(-31\+/);
assert.match(app,/\['masterLufs',lufs,-12\]/);
assert.match(app,/\['masterDbtp',dbtp,-1\]/);
assert.match(bridge,/lufs\.textContent="—"/);
assert.match(bridge,/tp\.textContent="—"/);
assert.doesNotMatch(app, /STREAM LEVELS <span>SIM<\/span>/);
});
Loading
Loading