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
67 changes: 7 additions & 60 deletions scripts/build_approved_native_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Calls scripts/build_pages.py to generate the *same* published index.html and
assets. There is no second HTML/CSS assembler, cloned GUI, or alternate skin.
A nonvisual bridge JS is the only native-specific addition.
A nonvisual bridge JS and fail-closed native intent hooks are the only additions.
"""
from __future__ import annotations

Expand All @@ -23,21 +23,7 @@
NATIVE_ADAPTER = ROOT / "web" / "approved-native-bridge.js"
ADAPTER_MARKER = ('<script defer src="assets/approved-native-contract.js"></script>\n'
'<script defer src="assets/approved-native-bridge.js"></script>\n'
'<script defer src="assets/approved-native-context-menu.js"></script>\n'
'<style data-armix-o1="physical-output">\n'
'.armix-native-desktop .console-body{--route-h:94px}\n'
'.armix-native-desktop .console-body[data-density="standard"]{--route-h:91px}\n'
'.armix-native-desktop .console-body[data-density="compact"]{--route-h:81px}\n'
'.armix-native-desktop .external-out-field .route-caption{color:#a8d0dd}\n'
'.armix-native-desktop .external-out-field .route-select{border-color:#547685;background:#192a32}\n'
'.armix-native-desktop .external-out-field .route-select[aria-busy="true"]{border-color:#ddb576}\n'
'.armix-native-desktop .external-out-field .route-select[data-status="NEEDS_REMAP"]{color:#d5aa8b}\n'
'.armix-native-desktop .external-out-state{font:500 9px/1.2 system-ui,sans-serif;letter-spacing:.025em;color:#aabdc3}\n'
'.armix-native-desktop .external-out-state[data-status="LIVE"]{color:#9bd3b8}\n'
'.armix-native-desktop .external-out-state[data-status="PENDING"]{color:#e7c081}\n'
'.armix-native-desktop .external-out-state[data-status="MUTED"]{color:#abbcc2}\n'
'.armix-native-desktop .external-out-state[data-status="NEEDS_REMAP"]{color:#e0a18b}\n'
'</style>')
'<script defer src="assets/approved-native-context-menu.js"></script>\n')
SCHEMA = "arsonmix.approved-native-pages-bundle.v2"


Expand Down Expand Up @@ -70,48 +56,18 @@ def accepted_pages_html() -> str:
return (build_public_pages(Path(tmp) / "public") / "index.html").read_text("utf-8")


# Native-only event seam: the original PUBLIC Pages HTML is byte-for-byte
# unchanged. Insert five small control hooks ONLY into the generated WebView2
# HTML at native build time. Every anchor must occur exactly once: no silent
# breakage if Pages GUI source evolves. No extra layout or simulated PCM.
# Native-only event seam: preserve the public visual hierarchy and DOM while
# injecting verified JUCE controls. Every anchor is fail-closed and reversible;
# no divergent layout, fake PCM, or duplicate HTML skin.
NATIVE_EVENT_HOOKS = (
# The mixer shell must remain visible even with zero audio endpoints or
# before the first accepted roster. Native control intents are still
# fenced by the bridge's authoritative ACK/readback; no mock PCM runs.
("Mixer · Reference Session", "Mixer · Native Session"),
("Interactive visual reference. Changes are local to this mockup.", "Preparing native mixer…"),
("SIMULATED METERS · NO REAL AUDIO", "NATIVE AUDIO"),
# The published /preview/ HTML and its V28 checkpoint are immutable.
# Change ONLY the compiled native WebView's operator fader travel law.
# The DSP gain remains exact dB -> 10^(dB/20), and the mapping is
# invertible at every tick; no new JS audio engine or controller.
("function faderPercent(value,isSend){return rangePct(value,-60,isSend?6:10);}\n",
"const FADER_TAPER=Object.freeze([[-60,0],[-48,15],[-36,27],[-24,39],[-12,54],[-6,65],[0,77],[6,92],[10,100]]);\n"
"function faderPercent(value,isSend){\n"
" if(isSend)return rangePct(value,-60,6);\n"
" const db=Math.max(-60,Math.min(10,Number(value)));\n"
" for(let i=1;i<FADER_TAPER.length;i++){\n"
" const [hiDb,hiPct]=FADER_TAPER[i],[loDb,loPct]=FADER_TAPER[i-1];\n"
" if(db<=hiDb)return loPct+(db-loDb)*(hiPct-loPct)/(hiDb-loDb);\n"
" }return 100;\n"
"}\n"
"function faderDbFromTravelPercent(percent,isSend){\n"
" const p=Math.max(0,Math.min(100,Number(percent)));\n"
" if(isSend)return -60+66*p/100;\n"
" for(let i=1;i<FADER_TAPER.length;i++){\n"
" const [hiDb,hiPct]=FADER_TAPER[i],[loDb,loPct]=FADER_TAPER[i-1];\n"
" if(p<=hiPct)return loDb+(p-loPct)*(hiDb-loDb)/(hiPct-loPct);\n"
" }return 10;\n"
"}\n"),
("scaleTopPct(v,-60,gainMax)",
"(100.0-faderPercent(v,isSend))"),
(" let gain=Math.round((max-(max-min)*frac)*10)/10;\n",
" let gain=Math.round(faderDbFromTravelPercent(100*(1-frac),max===6)*10)/10;\n"),
# The native fader has a calibrated logarithmic travel (unity is 77%),
# while the public reference uses a linear dB scale. The detent MUST
# snap at the visual/PCM unity position of the native tapered curve.
(" const unityY=travel.top+travel.height*(max/(max-min));\n",
" const unityY=travel.top+travel.height*(1-faderPercent(0,max===6)/100);\n"),
# Shared UI fader law, tick calibration and detent live in approved Pages;
# native keeps EXACTLY the same visual/interaction geometry.
# Only the compiled Windows WebView gets verified native driver inputs.
# Public /preview/ continues to show its labeled simulated reference.
("const channelOptions=(t,type)=>{\n",
Expand All @@ -122,15 +78,6 @@ def accepted_pages_html() -> str:
" return window.__ARMIX_NATIVE_M2__?.inputChoices?.(t)||['None'];\n"
" if(type==='output'&&window.__JUCE__?.backend)\n"
" return window.__ARMIX_NATIVE_M2__?.outputChoices?.(t)||[t.output];\n"),
(" code+=sectionFx(t)+sectionSend(t);\n",
" if(t.kind!=='master'){\n"
" if(!code.endsWith('</div></div>'))throw Error('Native O1 route anchor drift');\n"
" const extRow='<div class=\"route-field external-out-field\"><span class=\"route-caption\">EXT</span>'+\n"
" '<select class=\"route-select\" data-field=\"external\" title=\"Separate post-FX physical ASIO output, internal WIRE unchanged\" aria-label=\"'+escapeHtml(t.name)+' external output\">'+\n"
" option(channelOptions(t,'external'),t.externalOutput||'None')+'</select><span class=\"external-out-state\" aria-label=\"External output status\"></span></div>';\n"
" code=code.slice(0,-6)+extRow+'</div>';\n"
" }\n"
" code+=sectionFx(t)+sectionSend(t);\n"),
("function wireGraphCommit(ops,{record=true}={}){\n",
"function wireGraphCommit(ops,{record=true}={}){\n"
" if(window.__JUCE__?.backend){window.__ARMIX_NATIVE_M2__?.consumeWire?.(ops);return false;}\n"),
Expand Down
68 changes: 58 additions & 10 deletions site/preview-v2/assets/mixer-section-controls.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
.console-body .strip .fx-section.is-gain-view,
.console-body .strip .fx-section.is-sof-view{
display:flex;flex-direction:column;min-height:0;overflow:hidden;
background:linear-gradient(180deg,#21343d,#172832);
background:linear-gradient(180deg,#1a2b35,#142630);
}
/* GAIN is one compact hardware control cluster, not a full-width FX surface.
Only these visual tokens vary with viewport height; neither the dial's
Expand Down Expand Up @@ -149,12 +149,12 @@
content:"";position:absolute;inset:0;border-radius:50%;
}
.console-body .strip .gain-dial-arc::before{
background:repeating-conic-gradient(from 225deg,#20372f 0deg 6deg,transparent 6deg 9deg);
background:repeating-conic-gradient(from 225deg,#2b4148 0deg 6deg,transparent 6deg 9deg);
-webkit-mask:conic-gradient(from 225deg,#000 0deg 270deg,transparent 270deg 360deg);
mask:conic-gradient(from 225deg,#000 0deg 270deg,transparent 270deg 360deg);
}
.console-body .strip .gain-dial-arc::after{
background:repeating-conic-gradient(from 225deg,#51f4a0 0deg 6deg,transparent 6deg 9deg);
background:repeating-conic-gradient(from 225deg,#81b8c6 0deg 6deg,transparent 6deg 9deg);
-webkit-mask:conic-gradient(from 225deg,#000 0deg calc(135deg + var(--gain-rotation,0deg)),transparent 0deg 360deg);
mask:conic-gradient(from 225deg,#000 0deg calc(135deg + var(--gain-rotation,0deg)),transparent 0deg 360deg);
}
Expand All @@ -165,21 +165,21 @@
.console-body .strip .gain-dial-pointer::before{
content:"";position:absolute;top:8%;left:50%;width:3px;height:23%;
transform:translateX(-50%);border-radius:3px;
background:linear-gradient(90deg,#137a47,#deffe5 47%,#4dffa0);
box-shadow:0 0 2px #9cffc8,0 0 6px #15ef85,0 0 9px #20d77c8c;
background:linear-gradient(90deg,#50727e,#e2f1f5 47%,#8ebdcb);
box-shadow:0 0 2px #c2dbe1,0 0 4px #6ca7b76b;
}
.console-body .strip .gain-dial-pointer::after{
content:"";position:absolute;top:7%;left:50%;
width:4px;height:4px;transform:translateX(-50%);border-radius:50%;
background:#eaffed;box-shadow:0 0 4px 1px #42f9a8;
background:#edf6f8;box-shadow:0 0 3px 1px #8ebdcb88;
}
.console-body .strip .gain-dial input{
position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;
/* Keyboard-accessible range, but never browser click-to-seek. */
cursor:ns-resize;writing-mode:vertical-lr;direction:rtl;pointer-events:none;
}
.console-body .strip .gain-dial:focus-within{
outline:8px solid #7ce7ba14;outline-offset:-2px;
outline:8px solid #8ebdcb18;outline-offset:-2px;
}
.console-body .strip .gain-dial:has(input:disabled){opacity:.55;cursor:not-allowed}
.console-body .strip .gain-dial input:disabled{cursor:not-allowed}
Expand All @@ -189,10 +189,10 @@
min-height:var(--gain-lcd-height);
padding:2px 4px;overflow:hidden;border:0;border-radius:5px;
/* An actual recessed black display: no outlined textbox or luminous rim. */
background:#020503;
background:#050d12;
box-shadow:inset 0 3px 5px #000f,inset 2px 0 3px #000b,
inset -2px 0 3px #000b,0 1px 0 #93bba51a;
color:#74fda0;text-shadow:0 0 5px #43f78b88;
color:#a5dae4;text-shadow:0 0 4px #6bafc047;
font:600 12px/17px Consolas,'Lucida Console',monospace;
font-variant-numeric:tabular-nums;letter-spacing:.01em;white-space:nowrap;
}
Expand All @@ -209,7 +209,7 @@
.console-body.gain-view-active .section-rail .rail-cell.fx .rail-gain-caption{
display:block;writing-mode:vertical-rl;transform:rotate(180deg);
font:600 11px/1 'Segoe UI',Arial,sans-serif;letter-spacing:.16em;
color:#b7f2d1;text-shadow:0 0 4px #38ca8a33;
color:#afd6df;text-shadow:0 0 3px #6bafc033;
}
@media(max-height:680px){
.console-body .strip .gain-view-body{
Expand Down Expand Up @@ -261,3 +261,51 @@
@media(max-height:610px){
.console-body .strip .sof-info small{display:none}
}

/* Console Visual Harmony: ONE geometry contract for /preview/ and JUCE.
The native ASIO EXT field is visible but disabled in the browser reference.
Preserve collapsed route precedence and the identical rail/master heights. */
.console-body:not(.collapsed-route){--route-h:94px!important}
.console-body[data-density="standard"]:not(.collapsed-route){--route-h:91px!important}
.console-body[data-density="compact"]:not(.collapsed-route){--route-h:81px!important}
.console-body .external-out-field .route-caption{color:#8baebc}
.console-body .external-out-field .route-select{border-color:#3f5966;background:#142731}
.console-body .external-out-field .route-select:disabled{color:#8398a3;opacity:.72;cursor:not-allowed}
.console-body .external-out-field .route-select[aria-busy="true"]{border-color:#ddb576}
.console-body .external-out-field .route-select[data-status="NEEDS_REMAP"]{color:#d5aa8b}
.console-body .external-out-state{font:500 9px/1.2 system-ui,sans-serif;letter-spacing:.025em;color:#aabdc3}
.console-body .external-out-state:empty{display:none}
.console-body .external-out-state[data-status="LIVE"]{color:#9bd3b8}
.console-body .external-out-state[data-status="PENDING"]{color:#e7c081}
.console-body .external-out-state[data-status="MUTED"]{color:#abbcc2}
.console-body .external-out-state[data-status="NEEDS_REMAP"]{color:#e0a18b}

/* Shared physical-taper micro-ruler legibility. Owner-frozen fader/PNG asset
remains byte-identical; this narrowly scoped type correction prevents
-24/-36/-48 dB ink collisions on 1366x768 without moving hardware ticks. */
.console-body .strip .fader-section .gain-tick span{
top:-4.5px!important;
line-height:9px!important;
}

/* Route has four rows in the shared Pages/EXE renderer (title + IN/OUT/EXT).
Compact internal spacing rather than clipping the live EXT control or
inflating the panel: rail and strip retain their shared 94/91/81px heights. */
.console-body:not(.collapsed-route) .strip .route-section{
padding:2px 6px 2px;gap:1px;
}
.console-body[data-density="standard"]:not(.collapsed-route) .strip .route-select{
height:21px;
}
.console-body[data-density="compact"]:not(.collapsed-route) .strip .route-section{
padding:1px 3px;gap:1px;
}
.console-body[data-density="compact"]:not(.collapsed-route) .strip .route-top{
height:15px;min-height:15px;flex-basis:15px;
}
.console-body[data-density="compact"]:not(.collapsed-route) .strip .route-field{
min-height:18px;
}
.console-body[data-density="compact"]:not(.collapsed-route) .strip .route-select{
height:18px;
}
43 changes: 36 additions & 7 deletions site/preview-v2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -695,12 +695,31 @@
function formatDb(n){return n<=-60?'-∞':(n>0?'+':'')+Number(n).toFixed(1);}
function panLabel(n){return Number(n)===0?'C':n<0?'L'+Math.abs(n):'R'+n;}
function panStyle(n){const left=Math.min(50,50+n/2),right=Math.max(50,50+n/2);return '--pan-start:'+left+'%;--pan-end:'+right+'%';}
/* M1: one calibrated linear-dB position model for gain, ruler ticks and
UI-only dBFS preview. Physical fader travel and actual DSP are untouched. */
/* One shared visual travel contract for fader, ticks, pointer and detent.
dBFS meter calibration is separate; neither GUI is an audio DSP authority. */
const METER_DBFS_MIN=-60, METER_DBFS_MAX=0;
function rangePct(v,min,max){return Math.max(0,Math.min(100,100*(Number(v)-min)/(max-min)));}
function scaleTopPct(db,min,max){return 100-rangePct(db,min,max);}
function faderPercent(value,isSend){return rangePct(value,-60,isSend?6:10);}
/* Shared console fader travel law for Pages and JUCE WebView2.
Preview and native must display the SAME physical position at equal dB.
SEND faders retain their independent -60..+6 linear send law. */
const FADER_TAPER=Object.freeze([[-60,0],[-48,15],[-36,27],[-24,39],[-12,54],[-6,65],[0,77],[6,92],[10,100]]);
function faderPercent(value,isSend){
if(isSend)return rangePct(value,-60,6);
const db=Math.max(-60,Math.min(10,Number(value)));
for(let i=1;i<FADER_TAPER.length;i++){
const [hiDb,hiPct]=FADER_TAPER[i],[loDb,loPct]=FADER_TAPER[i-1];
if(db<=hiDb)return loPct+(db-loDb)*(hiPct-loPct)/(hiDb-loDb);
}return 100;
}
function faderDbFromTravelPercent(percent,isSend){
const p=Math.max(0,Math.min(100,Number(percent)));
if(isSend)return -60+66*p/100;
for(let i=1;i<FADER_TAPER.length;i++){
const [hiDb,hiPct]=FADER_TAPER[i],[loDb,loPct]=FADER_TAPER[i-1];
if(p<=hiPct)return loDb+(p-loPct)*(hiDb-loDb)/(hiPct-loPct);
}return 10;
}
function meterDbfsPercent(dbfs){return rangePct(dbfs,METER_DBFS_MIN,METER_DBFS_MAX);}
function demoMeterDbfs(faderDb,modulation){
// Simulated acoustic envelope in dBFS, NOT the signal-processing engine.
Expand Down Expand Up @@ -772,7 +791,7 @@
}).join('');
const gainScale=gainTicks.map(v=>{
const major=v!==-6;
return '<span class="gain-tick '+(major?'major':'minor')+(v===0?' unity':'')+'" style="top:'+scaleTopPct(v,-60,gainMax)+'%"><span>'+(major?(v>0?'+'+v:v):'')+'</span></span>';
return '<span class="gain-tick '+(major?'major':'minor')+(v===0?' unity':'')+'" style="top:'+(100.0-faderPercent(v,isSend))+'%"><span>'+(major?(v>0?'+'+v:v):'')+'</span></span>';
}).join('');
return '<div class="fader-section"><div class="fader-head"><output class="fader-readout" aria-label="'+escapeHtml(t.name)+' level">'+(isSend?'SEND ':'')+formatDb(value)+' dB</output><button type="button" class="clip-indicator '+(t.clip?'clipping':'')+'" data-action="resetClip" aria-label="Reset '+escapeHtml(t.name)+' clip latch" title="Reset latched peak indication (demo)">CLIP</button></div>'
+'<div class="fader-workspace">'
Expand All @@ -787,7 +806,17 @@
if(t.kind==='audio')code+='<div class="route-field"><span class="route-caption">IN</span><select class="route-select" data-field="input" title="Input source (demo choices)" aria-label="'+escapeHtml(t.name)+' input">'+option(channelOptions(t,'input'),t.input)+'</select></div>';
else if(t.kind==='bus'||t.kind==='fx')code+='<div class="route-field"><span class="route-caption">IN</span><span class="route-identity">'+(t.kind==='bus'?'GROUP':'FX RETURN')+'</span></div>';
else code+='<div class="route-field"><span class="route-caption">IN</span><span class="route-identity">SUM BUS</span></div>';
code+='<div class="route-field"><span class="route-caption">OUT</span><select class="route-select" data-field="output" title="Primary output" aria-label="'+escapeHtml(t.name)+' output">'+option(channelOptions(t,'output'),t.output)+'</select></div></div>';
code+='<div class="route-field"><span class="route-caption">OUT</span><select class="route-select" data-field="output" title="Primary output" aria-label="'+escapeHtml(t.name)+' output">'+option(channelOptions(t,'output'),t.output)+'</select></div>';
// Same external-output field and channel geometry in Preview and native.
// Browser preview is a non-audio reference: leave hardware controls disabled.
if(t.kind!=='master'){
const hasNativeOutputs=!!window.__JUCE__?.backend;
code+='<div class="route-field external-out-field"><span class="route-caption">EXT</span>'+
'<select class="route-select" data-field="external" title="'+(hasNativeOutputs?'Separate post-FX physical ASIO output; internal WIRE unchanged':'Physical ASIO output is unavailable in preview')+'" aria-label="'+escapeHtml(t.name)+' external output"'+(hasNativeOutputs?'':' disabled')+'>'+
option(hasNativeOutputs?channelOptions(t,'external'):['None'],t.externalOutput||'None')+'</select>'+
'<span class="external-out-state" aria-label="External output status"></span></div>';
}
code+='</div>';
code+=sectionFx(t)+sectionSend(t);
code+='<div class="section pan-section"><span class="pan-icon" title="Pan / Balance">PAN</span><span class="pan-control '+(t.pan===0?'is-centered':'')+'" style="'+panStyle(t.pan)+'"><input class="center-pan" type="range" min="-100" max="100" step="1" value="'+t.pan+'" data-field="pan" title="PAN center detent: capture ±7, hold ±12; release snaps center; double-click resets" aria-label="Channel pan; center detent" aria-valuetext="'+(t.pan===0?'Center':t.pan<0?'Left '+Math.abs(t.pan):'Right '+t.pan)+'"></span><output>'+panLabel(t.pan)+'</output></div>';

Expand Down Expand Up @@ -2141,8 +2170,8 @@
if(!travel||travel.height<=0)return;
const max=Number(input.max)||10,min=Number(input.min)||-60;
const frac=Math.max(0,Math.min(1,(ev.clientY-travel.top)/travel.height));
let gain=Math.round((max-(max-min)*frac)*10)/10;
const unityY=travel.top+travel.height*(max/(max-min));
let gain=Math.round(faderDbFromTravelPercent(100*(1-frac),max===6)*10)/10;
const unityY=travel.top+travel.height*(1-faderPercent(0,max===6)/100);
const tolerance=gesture.unityLatched?FADER_UNITY_RELEASE_PX:FADER_UNITY_CAPTURE_PX;
if(!ev.altKey&&Math.abs(ev.clientY-unityY)<=tolerance){
gain=0;gesture.unityLatched=true;
Expand Down
Loading
Loading