diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 15054d67d..15b89f70c 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -660,7 +660,7 @@ jobs: sonku-p90-source: # Runs only on the P9 research PR, even while its production jobs skip. name: SonKu P9 exact-source C++ PCM preflight - if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || startsWith(github.event.pull_request.head.ref, 'research/sonku-p91-p92-')) }} + if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || (startsWith(github.event.pull_request.head.ref, 'research/sonku-p91-p92-') || startsWith(github.event.pull_request.head.ref, 'feat/sonku-p93-'))) }} runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -674,6 +674,7 @@ jobs: set -euo pipefail node --check site/preview-v2/assets/mixer-native-sonku.js node tests/sonku_p90_dropdown_stability_test.cjs + node tests/sonku_p93_circular_gui_contract_test.cjs FLAGS="-std=c++20 -O2 -Wall -Wextra -Werror -pedantic -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 -DSONKU_P72_NATIVE_XYZ_RT=1 -DSONKU_P75_MUSIC_SAFE_RESEARCH=1 -DSONKU_P80_TRANSPARENT_BASS_RESEARCH=1 -DSONKU_P82_MULTIBAND_ROOM_RESEARCH=1 -DSONKU_P83_PHYSICAL_SPEAKER_RESEARCH=1 -DSONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1 -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 -DSONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 -DSONKU_P87_MUSIC_BODY_RESEARCH=1 -DSONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH=1 -DSONKU_P89_DEPTH_COHERENCE_RESEARCH=1 -DSONKU_P90_TRUE_EXTERNAL_RESEARCH=1" g++ $FLAGS tests/sonku_p90_true_external_source_test.cpp -o /tmp/sonku-p90 /tmp/sonku-p90 @@ -686,7 +687,7 @@ jobs: sonku-p90-windows-fat: name: SonKu P9 actual JUCE / GUI portable x64 needs: sonku-p90-source - if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || startsWith(github.event.pull_request.head.ref, 'research/sonku-p91-p92-')) }} + if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || (startsWith(github.event.pull_request.head.ref, 'research/sonku-p91-p92-') || startsWith(github.event.pull_request.head.ref, 'feat/sonku-p93-'))) }} runs-on: windows-2022 timeout-minutes: 55 steps: diff --git a/site/preview-v2/assets/mixer-fx-rack.css b/site/preview-v2/assets/mixer-fx-rack.css index 4e4829591..fc2e693db 100644 --- a/site/preview-v2/assets/mixer-fx-rack.css +++ b/site/preview-v2/assets/mixer-fx-rack.css @@ -1160,19 +1160,19 @@ /* 8D-SonKu editor: inherits the existing approved FX Rack CSS owner. */ .mx-sonku[hidden]{display:none!important} -.mx-sonku{position:fixed;z-index:1300;left:50%;transform:translateX(-50%);max-height:88vh;overflow:auto; +.mx-sonku{position:fixed;z-index:1300;left:50%;transform:translateX(-50%);max-height:calc(100vh - 16px);overflow:auto; color:#dcecf3;border-radius:12px;font:400 12px/1.45 inherit} .mx-sonku button,.mx-sonku input{font:inherit} .mx-sonku button{cursor:pointer;color:inherit} -.mx-sonku .sk-head{display:flex;align-items:center;gap:12px;} +.mx-sonku .sk-head{display:flex;align-items:center;gap:9px;cursor:move;user-select:none;touch-action:none} .mx-sonku .sk-brand{color:#f3f9ff} .mx-sonku .sk-brand span{color:#56c3d7} -.mx-sonku .sk-headnote{} -.mx-sonku .sk-channel{margin-left:auto;font-size:11px;color:#b1cad8;white-space:nowrap} +.mx-sonku .sk-headnote{white-space:nowrap} +.mx-sonku .sk-channel{margin-left:auto;font-size:10px;color:#b1cad8;white-space:nowrap;max-width:105px;overflow:hidden;text-overflow:ellipsis;flex:0 1 105px} .mx-sonku .sk-close{border:1px solid #526878;background:#233849;border-radius:6px;width:25px;height:25px;font-size:20px;line-height:1} .mx-sonku .sk-content{display:grid;} .mx-sonku .sk-stage{min-width:0} -.mx-sonku .sk-stage svg{display:block;width:100%;height:auto;} +.mx-sonku .sk-stage svg{display:block;width:100%;height:auto;flex:0 0 auto;} .mx-sonku .sk-stage text{font-family:inherit;font-size:10px;fill:#90adbb;letter-spacing:1px} .mx-sonku .sk-stage .sk-source-label{} .mx-sonku .sk-stage .sk-right .sk-source-label{} @@ -1224,19 +1224,19 @@ /* 8D-SonKu P1 studio hardware skin; component scoped, 18 CSS owners intact. FRONT/far upper rail sits behind PNG; REAR/near lower rail overlays back. Source monitor separation is render-only; never changes native HRIR angles. */ -.mx-sonku{width:min(758px,calc(100vw - 28px));top:8%;background:#0f1d29; +.mx-sonku{width:min(790px,calc(100vw - 24px));top:clamp(8px,6vh,64px);background:#0f1d29; border:1px solid #435b68;border-top-color:#708997;border-bottom-color:#253a45; box-shadow:0 23px 54px rgba(0,0,0,.74),inset 0 1px rgba(233,251,255,.11); font-family:Inter,"Segoe UI",Arial,sans-serif;font-size:11px;letter-spacing:.04px} .mx-sonku .sk-head{background:linear-gradient(180deg,#2c4150,#152833); border-bottom:1px solid #071721;box-shadow:inset 0 1px rgba(231,248,255,.15); - min-height:40px;padding:8px 14px} + min-height:37px;padding:6px 11px} .mx-sonku .sk-brand{font-weight:650;letter-spacing:.1px;font-size:15px; text-shadow:0 1px 1px #000} -.mx-sonku .sk-headnote{letter-spacing:1.3px;color:#93b6c6;font-size:9px} -.mx-sonku .sk-content{grid-template-columns:minmax(0,1.48fr) minmax(220px,1fr); +.mx-sonku .sk-headnote{letter-spacing:.9px;color:#93b6c6;font-size:8px} +.mx-sonku .sk-content{grid-template-columns:minmax(0,1.42fr) minmax(270px,1fr); gap:0;padding:0;align-items:stretch} -.mx-sonku .sk-stage{padding:11px 10px 6px 12px; +.mx-sonku .sk-stage{display:flex;flex-direction:column;gap:5px;padding:8px 10px 10px; background:linear-gradient(155deg,#162936,#0c1b28); border-right:1px solid #395565} .mx-sonku .sk-stage svg{border:1px solid #3f5f70;border-top-color:#233f4f; @@ -1268,8 +1268,8 @@ .mx-sonku .sk-right .sk-speaker-label{fill:#ffe7f8} .mx-sonku .sk-src:focus-visible .sk-speaker-shell{stroke-width:2.8} .mx-sonku .sk-tether{pointer-events:none} -.mx-sonku .sk-stage-caption{font-size:8px;letter-spacing:.9px;margin:5px 0 1px;color:#86aebc} -.mx-sonku .sk-controls{padding:13px 14px 9px;gap:9px; +.mx-sonku .sk-stage-caption{font-size:8px;letter-spacing:.55px;line-height:1.3;margin:0;color:#86aebc} +.mx-sonku .sk-controls{padding:11px 12px 8px;gap:10px; background:linear-gradient(135deg,#233542 0,#182b38 22%,#142430 85%,#10212d 100%); box-shadow:inset 1px 0 rgba(255,255,255,.07)} .mx-sonku .sk-control-title{display:flex;align-items:center;justify-content:space-between; @@ -1279,7 +1279,7 @@ .mx-sonku .sk-engine-led::before{content:"";width:5px;height:5px;border-radius:50%; background:#72d6ce;box-shadow:0 0 6px #65ceb8} .mx-sonku .sk-buttons{gap:7px} -.mx-sonku .sk-buttons button{min-height:31px;padding:6px 4px;font-weight:600; +.mx-sonku .sk-buttons button{min-height:29px;padding:6px 4px;font-weight:600; letter-spacing:.75px;font-size:9px;color:#b6d1dd; border:1px solid #425e6f;border-top-color:#6d8b98;border-bottom-color:#223c4b; background:linear-gradient(#304a59,#1d3342); @@ -1288,15 +1288,15 @@ background:linear-gradient(#2c6a7b,#19485b);border-color:#73baca; color:#e5fbff;box-shadow:inset 0 1px rgba(255,255,255,.2),0 0 6px rgba(75,193,219,.17)} .mx-sonku .sk-rotary-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr)); - row-gap:9px;column-gap:9px;align-items:center;justify-items:center; - flex:1;min-height:240px} + row-gap:4px;column-gap:8px;align-items:center;justify-items:center; + flex:0 0 auto;min-height:190px} .mx-sonku .sk-rotary{display:flex!important;flex-direction:column;align-items:center; - justify-content:center;gap:4px;min-width:0;width:100%; - padding:5px 1px!important;border:0;letter-spacing:.7px} -.mx-sonku .sk-param-name{font-size:9px;color:#b9d3df; + justify-content:center;gap:2px;min-width:0;width:100%; + padding:3px 1px!important;border:0;letter-spacing:.7px} +.mx-sonku .sk-param-name{font-size:8px;color:#b9d3df; letter-spacing:.8px;font-weight:600;white-space:nowrap;text-align:center} .mx-sonku .sk-dial{--sk-sweep:135deg;--sk-needle:0deg; - display:block;position:relative;width:62px;height:62px;flex:none; + display:block;position:relative;width:57px;height:57px;flex:none; cursor:ns-resize;touch-action:none;user-select:none;outline:none} .mx-sonku .sk-dial-track{position:absolute;inset:0;border-radius:50%; background:conic-gradient(from 225deg,#65cadd 0deg,#65cadd var(--sk-sweep), @@ -1320,7 +1320,7 @@ .mx-sonku .sk-rotary output{font-size:11px;font-weight:600;letter-spacing:.2px; font-variant-numeric:tabular-nums;color:#dcf3f7} .mx-sonku .sk-guide{font-size:9px;line-height:1.42;color:#91b2c2; - border-top:1px solid rgba(113,157,173,.24);padding-top:9px;letter-spacing:.1px} + border-top:1px solid rgba(113,157,173,.24);padding-top:7px;letter-spacing:.1px} .mx-sonku .sk-status{background:linear-gradient(#142836,#0c1a27); border-top:1px solid #415d6d;padding:7px 13px;letter-spacing:.55px; color:#99bac8} @@ -1388,3 +1388,37 @@ .mx-sonku #skRenderMode{width:100%;background:#132732;color:#e0eff5; border:1px solid #577888;border-radius:4px;padding:4px 6px;font:inherit;font-size:10px} .mx-sonku .sk-yaw{margin-top:2px} + +/* P9.3: new selectors only; existing SonKu selectors were edited in-place. */ +.mx-sonku .sk-head :is(button,select){cursor:pointer;touch-action:auto} +.mx-sonku .sk-preset{flex:0 1 163px;min-width:105px;max-width:163px;height:25px;padding:2px 4px;background:#162d3b;border:1px solid #537182;border-radius:4px;color:#d9f0f6;font:500 9px/1.2 Inter,"Segoe UI",Arial,sans-serif} +.mx-sonku .sk-preset:disabled{opacity:.52;cursor:not-allowed} +.mx-sonku .sk-preset:focus-visible{outline:2px solid #9bdae8} +.mx-sonku #skPower{margin-inline-start:0!important} +/* SPACE is below the graphic, retaining single native parameter controls. */ +.mx-sonku .sk-stage .sk-space-panel{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 11px;padding:8px 10px 7px;border:1px solid #355361;border-radius:5px;background:#0c202d6e} +.mx-sonku .sk-stage :is(.sk-space-head,.sk-space-options,.sk-space-hint){grid-column:1/-1} +.mx-sonku .sk-stage .sk-space-head{display:flex;justify-content:space-between;align-items:center;font-size:9px;color:#bdd7e1} +.mx-sonku .sk-stage .sk-space-head output{font-size:9px;color:#87dce8} +.mx-sonku .sk-stage .sk-space-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px} +.mx-sonku .sk-stage .sk-space-options button{min-height:24px;padding:3px;border:1px solid #496577;border-radius:4px;background:#223b49;font-size:9px;color:#c6dce4} +.mx-sonku .sk-stage .sk-space-options button[aria-pressed="true"]{background:#21576b;border-color:#75d0db;color:#effdff} +.mx-sonku .sk-stage .sk-space-slider{display:grid;grid-template-columns:1fr auto;gap:1px 3px;min-width:0;margin:0;color:#aac7d3;font-size:8px;align-items:center} +.mx-sonku .sk-stage .sk-space-slider[hidden]{display:none!important} +.mx-sonku .sk-stage .sk-space-slider output{color:#e2f5f8;font-size:9px;font-variant-numeric:tabular-nums} +.mx-sonku .sk-stage .sk-space-slider input{grid-column:1/-1;width:100%;margin:0!important;height:12px;accent-color:#66c5d8} +.mx-sonku .sk-stage .sk-space-slider input:disabled{opacity:.4} +.mx-sonku .sk-stage .sk-space-hint{font-size:8px;color:#87afbd;line-height:1.3} +.mx-sonku[data-fx-state="off"] .sk-engine-led,.mx-sonku[data-fx-state="rack-off"] .sk-engine-led{color:#a5a4a1} +.mx-sonku[data-fx-state="off"] .sk-engine-led::before,.mx-sonku[data-fx-state="rack-off"] .sk-engine-led::before{background:#b98578;box-shadow:none} +@media(max-width:680px){ + .mx-sonku .sk-preset{flex-basis:136px;max-width:136px} + .mx-sonku .sk-channel{max-width:80px} + .mx-sonku .sk-stage .sk-space-panel{gap:5px 9px} +} +@media(max-width:415px){ + .mx-sonku .sk-preset{max-width:115px;flex-basis:115px;font-size:8px} + .mx-sonku .sk-channel{display:none} + .mx-sonku .sk-stage .sk-space-panel{grid-template-columns:1fr} + .mx-sonku .sk-stage :is(.sk-space-head,.sk-space-options,.sk-space-hint){grid-column:1} +} diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index c093df5b5..1b5ada41b 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -34,6 +34,28 @@ const toDb=g=>g>0?Math.max(-24,20*Math.log10(g)):-24; const fromDb=db=>Number(Math.pow(10,Number(db)/20).toFixed(6)); const dbLabel=db=>(db>0?"+":"")+db.toFixed(1)+" dB"; const roomMaxDistance=[10,3.1,6.7,10]; +// Factory presets are explicit native scene values, never browser audio DSP. +// A preset applies the COMPLETE documented scene in one ACK-verified command. +// Preserve custom .smix settings until the operator actually selects a preset. +const factoryPresets=Object.freeze({ + music:Object.freeze({moving:false,clockwise:true,startAzimuthDegrees:0, + revolutionSeconds:12,stereoSpreadDegrees:82,spatialMix:1,outputTrim:1, + spacePreset:3,sourceDistanceMeters:1.6,roomAmount:.78,ambience:.33}), + studio:Object.freeze({moving:false,clockwise:true,startAzimuthDegrees:0, + revolutionSeconds:12,stereoSpreadDegrees:68,spatialMix:1,outputTrim:1, + spacePreset:1,sourceDistanceMeters:1.6,roomAmount:.42,ambience:.18}), + wide:Object.freeze({moving:false,clockwise:true,startAzimuthDegrees:0, + revolutionSeconds:12,stereoSpreadDegrees:118,spatialMix:1,outputTrim:1, + spacePreset:2,sourceDistanceMeters:3.2,roomAmount:.68,ambience:.32}), + deep:Object.freeze({moving:false,clockwise:true,startAzimuthDegrees:0, + revolutionSeconds:12,stereoSpreadDegrees:104,spatialMix:1,outputTrim:1, + spacePreset:3,sourceDistanceMeters:4.5,roomAmount:.82,ambience:.42}), + orbit:Object.freeze({moving:true,clockwise:true,startAzimuthDegrees:0, + revolutionSeconds:8.5,stereoSpreadDegrees:100,spatialMix:1,outputTrim:1, + spacePreset:3,sourceDistanceMeters:2.5,roomAmount:.72,ambience:.38}) +}); +const matchFactoryPreset=s=>Object.entries(factoryPresets).find(([id,p])=> + s.renderMode===9 && Object.keys(p).every(k=>Math.abs(Number(s[k])-Number(p[k]))<.00002))?.[0]||"CUSTOM"; const valid=s=>s && Number.isFinite(s.startAzimuthDegrees) && Math.abs(s.startAzimuthDegrees)<=360 && Number.isFinite(s.revolutionSeconds)&&s.revolutionSeconds>=.5&&s.revolutionSeconds<=120 && @@ -101,9 +123,17 @@ root.setAttribute("role","dialog");root.setAttribute("aria-modal","false"); root.setAttribute("aria-label","8D-SonKu binaural spatial audio"); root.innerHTML=[ '
8D·SonKu', - 'BINAURAL SPATIAL MOTION', + 'SPATIAL AUDIO', + '', '', - '
', + '', + '', '
', '', '', @@ -187,6 +217,10 @@ root.innerHTML=[ '
', '' ].join(""); +// Move the complete existing SPACE controls below the orbit, retaining the +// SAME native slider IDs, ACK, gesture ownership, and room-validation logic. +// This is a DOM layout move, never a duplicated render/control authority. +root.querySelector(".sk-stage").appendChild(root.querySelector(".sk-space-panel")); const $=id=>root.querySelector("#"+id); // Cache fixed SVG node references; only their transforms change at 60fps. const speakerNodes=[...root.querySelectorAll("#skMap .sk-src")]; @@ -199,6 +233,36 @@ let current=null,accepted=defaults(),draft=defaults(),pending=null,latest=null, readId="",readSentAt=0,seq=1,clock=null,frame=null,observed=0,observedAt=0, drag=null,dialDrag=null,rangeEdits=new Set(),gestureStart=new Map(), visualPhase=0,visualAt=0,liveTimer=null,lastLiveAt=0; +function syncPower(){ + const p=$("skPower"); + if(!current){ + p.dataset.fxState="unknown";p.disabled=true; + root.querySelector(".sk-engine-led").textContent="HRTF WAIT"; + return; + } + const n=snapshot(),id=window.__ARMIX_NATIVE_M2__?.nativeIdFor?.(current.track); + const lane=n?.graph?.channels?.find(x=>x.id===id); + const insert=lane?.inserts?.[current.slot]; + const globalOff=document.querySelector(".console-body")?.classList.contains("global-fx-bypassed")===true; + const state=!native()? + (current.track?.slotBypass?.[current.slot]?"off":"on"): + (!lane||typeof lane.fxRackBypassed!=="boolean"|| + !insert||insert.catalogId!==ID||typeof insert.bypassed!=="boolean"?"unknown": + (lane.fxRackBypassed||globalOff)?"rack-off":insert.bypassed?"off":"on"); + p.dataset.fxState=state; + p.disabled=state==="unknown"||state==="rack-off"; + p.setAttribute("aria-pressed",String(state==="on")); + p.title=state==="on"?"SONKU ON · click to bypass this insert": + state==="off"?"SONKU BYPASSED · click to enable": + state==="rack-off"?"FX RACK DISABLED · enable rack first": + "SONKU STATE UNAVAILABLE · waiting for native readback"; + p.setAttribute("aria-label",p.title); + root.dataset.fxState=state; + root.querySelector(".sk-engine-led").textContent= + state==="on"?"HRTF ACTIVE": + state==="off"?"FX BYPASSED": + state==="rack-off"?"RACK OFF":"HRTF WAIT"; +} const context=()=>{ if(!current||!native())return null; const s=snapshot(),id=window.__ARMIX_NATIVE_M2__?.nativeIdFor?.(current.track); @@ -212,9 +276,16 @@ const context=()=>{ }; function render(){ const s=draft; + // Header identity is always authoritative, including v2 native, reconnect + // and logical sessions. A missing capability must never unlock presets. + syncPower(); + const presetPicker=$("skPreset"); + presetPicker.disabled=!p91p92Capable || s.renderMode!==9 || !current || Boolean(pending); + const factoryName=p91p92Capable?matchFactoryPreset(s):"CUSTOM"; + if(presetPicker.value!==factoryName)presetPicker.value=factoryName; const row=$("skRenderRow");row.hidden=!(p83Capable||p84Capable); if(p83Capable||p84Capable){ - const picker=$("skRenderMode"); + const picker=$("skRenderMode"); if(p90Capable && picker.dataset.nativeModeSet!==(p91p92Capable?"p91p92":"p90")){ picker.innerHTML=''+ ''+ @@ -614,9 +685,64 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ } render(); }); +let windowGesture=null; +const clamp=(v,min,max)=>Math.max(min,Math.min(max,v)); +function constrainWindow(){ + if(root.hidden)return; + const r=root.getBoundingClientRect(); + if(!r.width||!r.height)return; + const x=clamp(r.left,0,Math.max(0,innerWidth-r.width)); + const y=clamp(r.top,0,Math.max(0,innerHeight-r.height)); + if(x===r.left && y===r.top)return; + root.style.left=x+"px";root.style.top=y+"px";root.style.transform="none"; +} +const head=root.querySelector(".sk-head"); +head.addEventListener("pointerdown",e=>{ + if(e.button!==0||e.target.closest("button,select,input,a"))return; + const r=root.getBoundingClientRect(); + windowGesture={id:e.pointerId,dx:e.clientX-r.left,dy:e.clientY-r.top}; + head.setPointerCapture(e.pointerId);e.preventDefault(); +}); +head.addEventListener("pointermove",e=>{ + if(!windowGesture||windowGesture.id!==e.pointerId)return; + const r=root.getBoundingClientRect(); + root.style.left=clamp(e.clientX-windowGesture.dx,0,Math.max(0,innerWidth-r.width))+"px"; + root.style.top=clamp(e.clientY-windowGesture.dy,0,Math.max(0,innerHeight-r.height))+"px"; + root.style.transform="none"; + e.preventDefault(); +}); +const stopWindowDrag=e=>{ + if(!windowGesture||e.pointerId!==windowGesture.id)return; + windowGesture=null; + if(head.hasPointerCapture?.(e.pointerId))head.releasePointerCapture(e.pointerId); +}; +head.addEventListener("pointerup",stopWindowDrag); +head.addEventListener("pointercancel",stopWindowDrag); +window.addEventListener("resize",constrainWindow); +$("skPower").addEventListener("click",()=>{ + if(!current || $("skPower").disabled)return; + if(native()){ + window.__ARMIX_NATIVE_M2__?.consumeAction?.( + current.track,"slotPower",{dataset:{slot:String(current.slot)}}); + }else{ + current.track.slotBypass??=[]; + current.track.slotBypass[current.slot]=!current.track.slotBypass[current.slot]; + syncPower(); + } +}); +$("skPreset").addEventListener("change",()=>{ + const picker=$("skPreset"); + const preset=factoryPresets[picker.value]; + if(!p91p92Capable||draft.renderMode!==9||!preset||pending){ + render();return; + } + const scene=fitElevation({...draft,...preset,renderMode:9, + musicCompatibleLowFrequency:false}); + if(!send(scene))render(); +}); $("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapable=false;p85Capable=false;p86Capable=false;p87Capable=false;p88Capable=false;p89Capable=false;p90Capable=false;p91p92Capable=false;musicSafeStereo=false;p8TransparentBass=false;p82MultibandRoom=false; cancelLiveTimer();pending=null;latest=null;readId="";readSentAt=0;dialDrag=null; - drag=null;rangeEdits.clear();gestureStart.clear();lastLiveAt=0; + drag=null;windowGesture=null;rangeEdits.clear();gestureStart.clear();lastLiveAt=0; if(clock!==null){clearInterval(clock);clock=null;} if(frame!==null){cancelAnimationFrame(frame);frame=null;}}); $("skRenderMode").addEventListener("change",()=>{ @@ -811,18 +937,22 @@ const api={ cancelLiveTimer();pending=null;latest=null;readId="";readSentAt=0;dialDrag=null; observedAt=0;visualAt=0;visualPhase=0;lastLiveAt=0; drag=null;rangeEdits.clear();gestureStart.clear(); - accepted=defaults();draft=defaults();xyzCapable=false;p83Capable=false;p84Capable=false,p85Capable=false;musicSafeStereo=false;p8TransparentBass=false; + accepted=defaults();draft=defaults();xyzCapable=false; + p83Capable=p84Capable=p85Capable=p86Capable=p87Capable=p88Capable= + p89Capable=p90Capable=p91p92Capable=false; + musicSafeStereo=p8TransparentBass=p82MultibandRoom=false; current={track,slot,instanceId:null}; const s=snapshot(),id=window.__ARMIX_NATIVE_M2__?.nativeIdFor?.(track); const fx=s?.graph?.channels?.find(x=>x.id===id)?.inserts?.[slot]; if(native()&&(s?.admitted||s?.logical)&&fx?.catalogId===ID)current.instanceId=fx.id; $("skChannel").textContent=String(track.name)+" · FX "+(slot+1); root.hidden=false; + constrainWindow();syncPower(); hint(native()?"READING ACCEPTED DSP":"BROWSER VISUAL ONLY · NO AUDIO"); if(native())requestSnapshot(); if(clock!==null)clearInterval(clock); clock=setInterval(()=>{if(root.hidden)return; - if(native()&&!pending&&context())requestSnapshot();},250); + syncPower();if(native()&&!pending&&context())requestSnapshot();},250); render(); if(frame!==null)cancelAnimationFrame(frame); frame=requestAnimationFrame(animate); diff --git a/tests/approved_native_sonku_smoke.py b/tests/approved_native_sonku_smoke.py index 84c4c8ed3..49df8af59 100644 --- a/tests/approved_native_sonku_smoke.py +++ b/tests/approved_native_sonku_smoke.py @@ -33,16 +33,21 @@ def last_action(page,name): assert actions, "Expected actual native action "+name return actions[-1] -def accepted_snapshot(page,state,settings,applied=None): +def accepted_snapshot(page,state,settings,applied=None,schema=2): read=last_action(page,"nativeSonKuSnapshot") payload={ - "requestId":read["requestId"],"status":"ACCEPTED","schemaVersion":2, + "requestId":read["requestId"],"status":"ACCEPTED","schemaVersion":schema, "channelId":SOURCE,"slot":0,"instanceId":INSTANCE, "deviceEpoch":state["device"]["epoch"], "graphRevision":state["graph"]["revision"], "observedAzimuthDegrees":settings["startAzimuthDegrees"], "settings":copy.deepcopy(settings), } + if schema==11: + payload.update(p84MusicFusion=True,p85AcousticCoherence=True, + p86HorizontalFocus=True,p87MusicalAirBody=True, + p88PerceptualAlignment=True,p89StereoRoomDepth=True, + p90TrueExternalSpeaker=True,p91p92MusicBassFoundation=True) if applied:payload["appliedRequestId"]=applied emit(page,"arMixBuiltinSonKuSnapshot",payload) @@ -113,6 +118,32 @@ def exercise(browser,out,width,height): editor=page.locator("#mxNativeSonKu") editor.wait_for(state="visible",timeout=5000) assert editor.locator("#skMap .sk-src").count()==2 + # Modeless native editor must be movable just like EQ and Compressor. + # Drag only the non-interactive brand area; never start drags on Power + # or Presets, and clamp movement to the current viewport. + head=editor.locator(".sk-head") + before_box=editor.bounding_box() + assert before_box + header_box=head.bounding_box() + assert header_box + drag_x=header_box["x"]+29 + drag_y=header_box["y"]+header_box["height"]*.5 + page.mouse.move(drag_x,drag_y) + page.mouse.down() + page.mouse.move(drag_x+40,drag_y+26,steps=5) + page.mouse.up() + moved_box=editor.bounding_box() + assert moved_box + assert moved_box["x"]>=-1 and moved_box["y"]>=-1,moved_box + assert moved_box["x"]+moved_box["width"]<=width+2,moved_box + if width-before_box["width"]>70: + assert moved_box["x"]>before_box["x"]+4,( + "Movable SonKu header failed to drag",before_box,moved_box) + assert editor.locator("#skPower").count()==1 + assert editor.locator("#skPower").get_attribute("data-fx-state")=="unknown",( + "Missing native FX rack bypass readback must NOT fake power ON") + assert editor.locator("#skPreset").is_disabled(),( + "Old schema v2 must NOT offer P9.1+P9.2 factory scenes") assert editor.locator("#skMap .sk-speaker-shell").count()==2 assert editor.locator("#skMap #skFarArc").count()==1 assert editor.locator("#skMap #skNearArc").count()==1 @@ -124,8 +155,8 @@ def exercise(browser,out,width,height): const near=map.querySelector('#skNearArc'); return Boolean((far.compareDocumentPosition(art) & Node.DOCUMENT_POSITION_FOLLOWING) && (art.compareDocumentPosition(near) & Node.DOCUMENT_POSITION_FOLLOWING) && - far.getAttribute('d').startsWith('M348 174') && - near.getAttribute('d').startsWith('M52 174')); + far.getAttribute('d').startsWith('M348 174 A148 83') && + near.getAttribute('d').startsWith('M52 174 A148 83')); }"""), "Front/back ring painter layering incorrect" # Each moving speaker is depth-sorted against the listener alpha silhouette. assert page.evaluate("""() => { @@ -239,6 +270,14 @@ def pose(degrees): x,y,rear=pose(180);assert abs(x-200)<1 and y>245,("REAR",x,y) editor.locator("#skMap").screenshot(path=f"arsonmix-sonku-editor-rear-depth-{width}.png") x,y,left=pose(-90);assert x<60 and abs(y-174)<1,("LEFT",x,y) + # Approved top-rear oblique perspective: full 360° azimuth with an SVG + # ellipse, not a flattened physical/acoustic source orbit. + for x,y in ((200,91),(348,174),(200,257),(52,174)): + assert abs(((x-200)/148)**2+((y-174)/83)**2-1)<.001 + assert editor.locator(".sk-stage > .sk-space-panel").count()==1,( + "SPACE controls must be below the motion field, not inside rotary column") + assert editor.locator("#skPreset").count()==1 + assert editor.locator("#skPower.armix-builtin-fx-power").count()==1 assert front["depth"]=="far" and rear["depth"]=="near" assert front["scale"]=.39,(front,rear) @@ -500,6 +539,48 @@ def apply_slider(selector,value,field): editor.locator("#"+control).evaluate( "n=>n.dispatchEvent(new Event('change',{bubbles:true}))") assert command_count()==before+1,(control,"duplicate final edit") + # A genuine schema-v11 native capability unlocks the five ready-to-use + # scenes. This is a REAL DOM event and nativeSonKuSet/ACK/readback, not + # a fixture directly mutating the editor's internal draft. + room11={**sceneState,"renderMode":9,"musicCompatibleLowFrequency":False, + "headYawDegrees":0.0,"directElevationDegrees":0.0, + "hrtfElevationTrimDegrees":0.0} + page.wait_for_timeout(300) + accepted_snapshot(page,state,room11,schema=11) + factory=editor.locator("#skPreset") + assert factory.is_enabled(),"Valid P9.1+P9.2 native capability must unlock presets" + assert factory.input_value()=="CUSTOM","Saved non-factory scene was overwritten" + before=command_count() + factory.select_option("music") + assert command_count()==before+1,"Factory scene did not issue one native transaction" + applied=last_action(page,"nativeSonKuSet") + proposed=applied["settings"] + assert proposed["renderMode"]==9 and proposed["moving"] is False,proposed + assert proposed["stereoSpreadDegrees"]==82 and proposed["outputTrim"]==1,proposed + assert proposed["spacePreset"]==3 and proposed["sourceDistanceMeters"]==1.6,proposed + assert abs(proposed["roomAmount"]-.78)<.001 and abs(proposed["ambience"]-.33)<.001 + emit(page,"arMixBuiltinSonKuAck",{ + "requestId":applied["requestId"],"status":"APPLIED"}) + accepted_snapshot(page,state,proposed,applied=applied["requestId"],schema=11) + assert factory.input_value()=="music","Native-accepted preset did not stay selected" + # Actual accepted mixer graph is the SINGLE authority for FX Power, + # including individual insert bypass vs whole rack disabled. + state["graph"]["channels"][0]["fxRackBypassed"]=False + state["graph"]["channels"][0]["inserts"][0]["bypassed"]=False + emit(page,"arMixConsoleSnapshot",state) + page.wait_for_function("""()=> + document.getElementById('skPower')?.dataset.fxState==='on'""") + assert editor.locator("#skPower").is_enabled() + state["graph"]["channels"][0]["inserts"][0]["bypassed"]=True + emit(page,"arMixConsoleSnapshot",state) + page.wait_for_function("""()=> + document.getElementById('skPower')?.dataset.fxState==='off'""") + assert editor.locator("#skPower").is_enabled() + state["graph"]["channels"][0]["fxRackBypassed"]=True + emit(page,"arMixConsoleSnapshot",state) + page.wait_for_function("""()=> + document.getElementById('skPower')?.dataset.fxState==='rack-off'""") + assert editor.locator("#skPower").is_disabled() bounds=editor.bounding_box() assert bounds and bounds["width"]>260 and bounds["width"]{ + const i=source.indexOf(a),j=source.indexOf(b,i+a.length); + assert(i>=0&&j>i,"Production SonKu code boundary missing: "+a); + return source.slice(i,j); +}; +const geometry=between("const STAGE=Object.freeze","const root=document.createElement"); +const g=vm.runInNewContext("(function(){const angle=(v)=>((v%360)+360)%360;"+ + geometry+"return {STAGE,stagePoint,stageAzimuth,displayPair};})()",{}); +// The ellipse is the APPROVED oblique 3D visualization of a circular world +// orbit. A 360° spatial acoustic scene must not be confused with SVG shape. +assert.equal(g.STAGE.rx,148); +assert.equal(g.STAGE.ry,83); +for(const azimuth of [0,22.5,45,90,135,180,225,270,315,359.9,-90,-179.9]){ + const p=g.stagePoint(azimuth); + assert(Math.abs(((p.x-200)/148)**2+((p.y-174)/83)**2-1)<1.e-8); + const recovered=g.stageAzimuth(p.x,p.y); + assert(Math.abs((((recovered-azimuth+540)%360)+360)%360-180)<1.e-7); +} +const same=g.displayPair([0,0]); +assert(Math.abs(same[0].anchor.x-same[1].anchor.x)<1.e-9); +assert(Math.hypot(same[0].visible.x-same[1].visible.x, + same[0].visible.y-same[1].visible.y)>=45); +assert.match(source,/M348 174 A148 83 0 0 0 52 174/); +assert.match(source,/M52 174 A148 83 0 0 0 348 174/); +const f=between("const factoryPresets=Object.freeze","const valid=s=>"); +const p=vm.runInNewContext("(function(){"+f+ + "return {factoryPresets,matchFactoryPreset};})()",{}); +assert.equal(Object.keys(p.factoryPresets).length,5); +for(const [id,scene] of Object.entries(p.factoryPresets)){ + assert.equal(scene.spatialMix,1); + assert.equal(scene.outputTrim,1); // Never multiply factory output by +7dB. + assert(scene.sourceDistanceMeters>=1.6); + const max=[10,3.1,6.7,10][scene.spacePreset]; + assert(scene.sourceDistanceMeters<=max); + assert(scene.stereoSpreadDegrees>=0&&scene.stereoSpreadDegrees<=180); + assert(scene.roomAmount>=0&&scene.roomAmount<=1); + assert(scene.ambience>=0&&scene.ambience<=1); + assert.equal(p.matchFactoryPreset({...scene,renderMode:9}),id); + assert.equal(p.matchFactoryPreset({...scene,renderMode:8}),"CUSTOM"); +} +const modified={...p.factoryPresets.music,renderMode:9,outputTrim:2.238721}; +assert.equal(p.matchFactoryPreset(modified),"CUSTOM"); +const sync=between("function syncPower(){","const context=()=>{"); +const state={graph:{channels:[{id:"ch-1",fxRackBypassed:false, + inserts:[{id:"insert",catalogId:"armix.builtin.8d-sonku.v1",bypassed:false}]}]}}; +const element={dataset:{},disabled:true, + setAttribute(k,v){this[k]=v}}; +const root={dataset:{},querySelector(){return {textContent:""};}},current={track:{},slot:0}; +const power=vm.runInNewContext("(function(){let current=__current;"+ + "let root=__root;const ID=\"armix.builtin.8d-sonku.v1\";let $=()=>__element;let snapshot=()=>__state;"+ + "let native=()=>true;"+sync+"return syncPower;})()",{ + __current:current,__root:root,__element:element,__state:state, + window:{__ARMIX_NATIVE_M2__:{nativeIdFor(){return "ch-1";}}}, + document:{querySelector(){return {classList:{contains(){return false}}};}} +}); +power();assert.equal(element.dataset.fxState,"on");assert.equal(element.disabled,false); +state.graph.channels[0].inserts[0].bypassed=true;power(); +assert.equal(element.dataset.fxState,"off");assert.equal(element.disabled,false); +state.graph.channels[0].fxRackBypassed=true;power(); +assert.equal(element.dataset.fxState,"rack-off");assert.equal(element.disabled,true); +state.graph.channels[0].fxRackBypassed=false; +state.graph.channels[0].inserts[0].catalogId="unrelated-fx";power(); +assert.equal(element.dataset.fxState,"unknown");assert.equal(element.disabled,true); +assert.match(source,/consumeAction\?\.\(\s*current\.track,"slotPower"/); +assert.match(source,/root\.querySelector\("\.sk-stage"\)\.appendChild\(root\.querySelector\("\.sk-space-panel"\)\)/); +assert.match(source,/head\.setPointerCapture\(e\.pointerId\)/); +assert.match(source,/window\.addEventListener\("resize",constrainWindow\)/); +assert.match(source,/if\(!p91p92Capable\|\|draft\.renderMode!==9\|\|!preset\|\|pending\)/); +assert.match(css,/\.mx-sonku \.sk-stage \.sk-space-panel\{display:grid/); +assert.match(source,/current\.track\.slotBypass\[current\.slot\]/); +console.log("PASS SonKu P9.3: approved perspective orbit, inverse drag, native power readback, draggable window, five full-scene presets, compact SPACE placement");