improve audio support

This commit is contained in:
Brian Beck 2026-03-04 12:15:24 -08:00
parent d1acb6a5ce
commit cb28b66dad
5587 changed files with 4538 additions and 2846 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -6,7 +6,7 @@
.CopyCoordinatesButton-module__BxovtG__Root{}.CopyCoordinatesButton-module__BxovtG__Root[data-copied=true]{background:#0075d5e6;border-color:#fff6}.CopyCoordinatesButton-module__BxovtG__ClipboardCheck{opacity:1;display:none}.CopyCoordinatesButton-module__BxovtG__Root[data-copied=true] .CopyCoordinatesButton-module__BxovtG__ClipboardCheck{animation:.22s linear infinite CopyCoordinatesButton-module__BxovtG__showClipboardCheck;display:block}.CopyCoordinatesButton-module__BxovtG__Root[data-copied=true] .CopyCoordinatesButton-module__BxovtG__MapPin{display:none}.CopyCoordinatesButton-module__BxovtG__ButtonLabel{}@keyframes CopyCoordinatesButton-module__BxovtG__showClipboardCheck{0%{opacity:1}to{opacity:.2}}
.LoadDemoButton-module__kGZaoW__Root{}.LoadDemoButton-module__kGZaoW__ButtonLabel{}.LoadDemoButton-module__kGZaoW__DemoIcon{font-size:19px}
.PlayerNameplate-module__zYDm0a__Root{pointer-events:none;white-space:nowrap;flex-direction:column;align-items:center;display:inline-flex}.PlayerNameplate-module__zYDm0a__Top{padding-bottom:20px;}.PlayerNameplate-module__zYDm0a__Bottom{padding-top:20px;}.PlayerNameplate-module__zYDm0a__IffArrow{width:12px;height:12px;image-rendering:pixelated;filter:drop-shadow(0 1px 2px #000000b3)}.PlayerNameplate-module__zYDm0a__Name{color:#fff;text-shadow:0 1px 3px #000000e6,0 0 1px #000000b3;font-size:11px}.PlayerNameplate-module__zYDm0a__HealthBar{background:#00000080;border:1px solid #fff3;width:60px;height:4px;margin:2px auto 0;overflow:hidden}.PlayerNameplate-module__zYDm0a__HealthFill{background:#2ecc40;height:100%}
.DemoControls-module__PjV4fq__Root{color:#fff;z-index:2;background:#000000b3;align-items:center;gap:10px;padding:8px 12px;font-size:13px;display:flex;position:fixed;bottom:0;left:0;right:0}.DemoControls-module__PjV4fq__PlayPause{color:#fff;cursor:pointer;background:#03529399;border:1px solid #ffffff4d;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;padding:0;font-size:14px;display:flex}@media (hover:hover){.DemoControls-module__PjV4fq__PlayPause:hover{background:#0062b3cc}}.DemoControls-module__PjV4fq__Time{font-variant-numeric:tabular-nums;white-space:nowrap;flex-shrink:0}.DemoControls-module__PjV4fq__Seek[type=range]{flex:1 1 0;min-width:0;max-width:none}.DemoControls-module__PjV4fq__Speed{color:#fff;background:#0009;border:1px solid #ffffff4d;border-radius:3px;flex-shrink:0;padding:2px 4px;font-size:12px}.DemoControls-module__PjV4fq__DiagnosticsPanel{background:#0000008c;border:1px solid #fff3;border-radius:4px;flex-direction:column;gap:3px;min-width:320px;margin-left:8px;padding:4px 8px;display:flex}.DemoControls-module__PjV4fq__DiagnosticsPanel[data-context-lost=true]{background:#46000073;border-color:#ff5a5acc}.DemoControls-module__PjV4fq__DiagnosticsStatus{letter-spacing:.02em;font-size:11px;font-weight:700}.DemoControls-module__PjV4fq__DiagnosticsMetrics{opacity:.92;flex-wrap:wrap;gap:4px 10px;font-size:11px;display:flex}.DemoControls-module__PjV4fq__DiagnosticsFooter{flex-wrap:wrap;align-items:center;gap:4px 8px;font-size:11px;display:flex}.DemoControls-module__PjV4fq__DiagnosticsFooter button{color:#fff;cursor:pointer;background:#03529399;border:1px solid #ffffff4d;border-radius:3px;padding:1px 6px;font-size:11px}.DemoControls-module__PjV4fq__DiagnosticsFooter button:hover{background:#0062b3cc}
.PlayerHUD-module__-E1Scq__PlayerHUD{z-index:1;pointer-events:none;padding-bottom:48px;position:absolute;inset:0}.PlayerHUD-module__-E1Scq__ChatWindow{position:absolute;top:60px;left:4px}.PlayerHUD-module__-E1Scq__Bar{background:#00000080;border:1px solid #fff3;width:160px;height:14px;position:absolute;overflow:hidden}.PlayerHUD-module__-E1Scq__HealthBar{top:60px;right:32px;}.PlayerHUD-module__-E1Scq__EnergyBar{top:80px;right:32px;}.PlayerHUD-module__-E1Scq__BarFill{height:100%;transition:width .15s ease-out;position:absolute;top:0;left:0}.PlayerHUD-module__-E1Scq__HealthBar .PlayerHUD-module__-E1Scq__BarFill{background:#2ecc40}.PlayerHUD-module__-E1Scq__EnergyBar .PlayerHUD-module__-E1Scq__BarFill{background:#0af}
.DemoControls-module__PjV4fq__Root{color:#fff;z-index:2;background:#000000b3;align-items:center;gap:10px;padding:8px 12px;font-size:13px;display:flex;position:fixed;bottom:0;left:0;right:0}.DemoControls-module__PjV4fq__PlayPause{color:#fff;cursor:pointer;background:#03529399;border:1px solid #ffffff4d;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;padding:0;font-size:14px;display:flex}@media (hover:hover){.DemoControls-module__PjV4fq__PlayPause:hover{background:#0062b3cc}}.DemoControls-module__PjV4fq__Time{font-variant-numeric:tabular-nums;white-space:nowrap;flex-shrink:0}.DemoControls-module__PjV4fq__Seek[type=range]{flex:1 1 0;min-width:0;max-width:none}.DemoControls-module__PjV4fq__Speed{color:#fff;background:#0009;border:1px solid #ffffff4d;border-radius:3px;flex-shrink:0;padding:2px 4px;font-size:12px}
.PlayerHUD-module__-E1Scq__PlayerHUD{z-index:1;pointer-events:none;position:absolute;inset:0}.PlayerHUD-module__-E1Scq__TopRight{align-items:flex-start;gap:6px;display:flex;position:absolute;top:56px;right:8px}.PlayerHUD-module__-E1Scq__Compass{flex-shrink:0;width:64px;height:64px;position:relative}.PlayerHUD-module__-E1Scq__CompassRing{image-rendering:auto;width:100%;height:100%;position:absolute;top:0;left:0}.PlayerHUD-module__-E1Scq__CompassNSEW{width:100%;height:100%;image-rendering:pixelated;position:absolute;top:0;left:0}.PlayerHUD-module__-E1Scq__Bars{flex-direction:column;gap:3px;padding-top:10px;display:flex}.PlayerHUD-module__-E1Scq__BarTrack{background:#00000080;border:1px solid #ffffff26;width:120px;height:10px;overflow:hidden}.PlayerHUD-module__-E1Scq__BarFillHealth{background:#2ecc40;height:100%;transition:width .15s ease-out}.PlayerHUD-module__-E1Scq__BarFillEnergy{background:#0af;height:100%;transition:width .15s ease-out}.PlayerHUD-module__-E1Scq__WeaponHUD{flex-direction:column;gap:2px;display:flex;position:absolute;top:50%;right:8px;transform:translateY(-50%)}.PlayerHUD-module__-E1Scq__WeaponSeparator{height:6px}.PlayerHUD-module__-E1Scq__ChatWindow{background:#00323ca6;max-width:420px;padding:4px 8px;font-size:12px;line-height:1.3;position:absolute;top:56px;left:0}.PlayerHUD-module__-E1Scq__ChatMessage{color:#2cacb5;padding:1px 0;transition:opacity .3s ease-out}.PlayerHUD-module__-E1Scq__ChatColor0{color:#2cacb5}.PlayerHUD-module__-E1Scq__ChatColor1{color:#04eb69}.PlayerHUD-module__-E1Scq__ChatColor2{color:#dbc880}.PlayerHUD-module__-E1Scq__ChatColor3{color:#4dfd5f}.PlayerHUD-module__-E1Scq__ChatColor4{color:#28e7f0}.PlayerHUD-module__-E1Scq__ChatColor5{color:#c8c832}.PlayerHUD-module__-E1Scq__ChatColor6{color:#c8c8c8}.PlayerHUD-module__-E1Scq__ChatColor7{color:#dcdc14}.PlayerHUD-module__-E1Scq__ChatColor8{color:#9696fa}.PlayerHUD-module__-E1Scq__ChatColor9{color:#3cdc96}.PlayerHUD-module__-E1Scq__TeamScores{font-family:monospace;font-size:12px;position:absolute;bottom:130px;left:0}.PlayerHUD-module__-E1Scq__TeamRow{background:#00323ca6;gap:6px;padding:2px 8px;display:flex}.PlayerHUD-module__-E1Scq__TeamRow+.PlayerHUD-module__-E1Scq__TeamRow{border-top:1px solid #80ffc826}.PlayerHUD-module__-E1Scq__TeamNameFriendly{color:#2ecc40;min-width:60px}.PlayerHUD-module__-E1Scq__TeamNameEnemy{color:#e44;min-width:60px}.PlayerHUD-module__-E1Scq__TeamScore{color:#fff;text-align:right;min-width:24px;font-weight:700}.PlayerHUD-module__-E1Scq__TeamCount{color:#9ba;text-align:right;min-width:24px}.PlayerHUD-module__-E1Scq__PackInventoryHUD{align-items:center;gap:4px;display:flex;position:absolute;bottom:100px;right:8px}.PlayerHUD-module__-E1Scq__PackInvItem{background:#00323ca6;border:1px solid #80ffc826;flex-direction:column;justify-content:center;align-items:center;gap:1px;padding:4px;display:flex}.PlayerHUD-module__-E1Scq__PackInvItemActive{border-color:#80ffc880;box-shadow:0 0 6px #80ffc84d}.PlayerHUD-module__-E1Scq__PackInvItemDim{opacity:.5}.PlayerHUD-module__-E1Scq__PackInvIcon{image-rendering:pixelated;display:block}.PlayerHUD-module__-E1Scq__PackInvCount{color:#bfe;text-align:center;min-width:12px;font-family:monospace;font-size:11px}.PlayerHUD-module__-E1Scq__PackInvInfinity{image-rendering:pixelated;opacity:.8;display:block}.PlayerHUD-module__-E1Scq__Reticle{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.PlayerHUD-module__-E1Scq__ReticleImage{opacity:.85;width:64px;height:64px;image-rendering:pixelated}.PlayerHUD-module__-E1Scq__ReticleDot{background:#2ecc40b3;border-radius:50%;width:4px;height:4px;box-shadow:0 0 4px #2ecc4080}
.page-module__E0kJGG__CanvasContainer{z-index:0;position:absolute;inset:0}.page-module__E0kJGG__LoadingIndicator{pointer-events:none;z-index:1;opacity:.8;flex-direction:column;align-items:center;gap:16px;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.page-module__E0kJGG__LoadingIndicator[data-complete=true]{animation:.3s ease-out forwards page-module__E0kJGG__loadingComplete}.page-module__E0kJGG__Spinner{border:4px solid #fff3;border-top-color:#fff;border-radius:50%;width:48px;height:48px;animation:1s linear infinite page-module__E0kJGG__spin}.page-module__E0kJGG__Progress{background:#fff3;border-radius:2px;width:200px;height:4px;overflow:hidden}.page-module__E0kJGG__ProgressBar{background:#fff;border-radius:2px;height:100%;transition:width .1s ease-out}.page-module__E0kJGG__ProgressText{color:#ffffffb3;font-variant-numeric:tabular-nums;font-size:14px}@keyframes page-module__E0kJGG__spin{to{transform:rotate(360deg)}}@keyframes page-module__E0kJGG__loadingComplete{0%{opacity:1}to{opacity:0}}
.page-module__v6zvCa__CanvasContainer{z-index:0;position:absolute;inset:0}.page-module__v6zvCa__LoadingIndicator{pointer-events:none;z-index:1;opacity:.8;flex-direction:column;align-items:center;gap:16px;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.page-module__v6zvCa__LoadingIndicator[data-complete=true]{animation:.3s ease-out forwards page-module__v6zvCa__loadingComplete}.page-module__v6zvCa__Spinner{border:4px solid #fff3;border-top-color:#fff;border-radius:50%;width:48px;height:48px;animation:1s linear infinite page-module__v6zvCa__spin}@keyframes page-module__v6zvCa__spin{to{transform:rotate(360deg)}}@keyframes page-module__v6zvCa__loadingComplete{0%{opacity:1}to{opacity:0}}.page-module__v6zvCa__Sidebar{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);color:#fff;z-index:2;background:#000000b3;flex-direction:column;width:260px;font-size:13px;display:flex;position:fixed;top:0;bottom:0;left:0;overflow:hidden}.page-module__v6zvCa__SidebarSection{border-bottom:1px solid #ffffff1a;padding:10px 12px}.page-module__v6zvCa__SidebarSection:last-child{border-bottom:none}.page-module__v6zvCa__SectionLabel{text-transform:uppercase;letter-spacing:.05em;color:#fff6;margin-bottom:6px;font-size:10px}.page-module__v6zvCa__AnimationList{flex:1;padding:0 12px 12px;overflow-y:auto}.page-module__v6zvCa__AnimationItem{cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:4px;align-items:center;gap:6px;padding:4px 6px;display:flex}.page-module__v6zvCa__AnimationItem:hover{background:#ffffff14}.page-module__v6zvCa__AnimationItem[data-active=true]{background:#ffffff26}.page-module__v6zvCa__PlayButton{color:#fff9;cursor:pointer;background:#ffffff1a;border:none;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:22px;height:22px;padding:0;font-size:11px;display:flex}.page-module__v6zvCa__PlayButton:hover{color:#fff;background:#fff3}.page-module__v6zvCa__AnimationItem[data-active=true] .page-module__v6zvCa__PlayButton{color:#fff;background:#64b4ff4d}.page-module__v6zvCa__AnimationName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.page-module__v6zvCa__ClipName{color:#ffffff4d;white-space:nowrap;flex-shrink:0;font-size:10px}.page-module__v6zvCa__CyclicIcon{color:#ffffff4d;title:"Cyclic (looping)";flex-shrink:0;font-size:13px}.page-module__v6zvCa__CheckboxField{align-items:center;gap:6px;display:flex}

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29055,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(15080),o=e.i(71753),n=e.i(90072),u=e.i(62395),c=e.i(12979),s=e.i(51434),a=e.i(79123),l=e.i(89887);let f=new Map,m=(0,r.memo)(function({object:e}){let{debugMode:m}=(0,a.useDebug)(),p=(0,u.getProperty)(e,"fileName")??"",d=(0,u.getFloat)(e,"volume")??1,h=(0,u.getFloat)(e,"minDistance")??1,g=(0,u.getFloat)(e,"maxDistance")??1,y=(0,u.getFloat)(e,"minLoopGap")??0,T=(0,u.getFloat)(e,"maxLoopGap")??0,x=(0,u.getInt)(e,"is3D")??0,[D,M,R]=(0,u.getPosition)(e),{scene:A,camera:F}=(0,i.useThree)(),{audioLoader:P,audioListener:b}=(0,s.useAudio)(),{audioEnabled:v}=(0,a.useSettings)(),j=(0,r.useRef)(null),w=(0,r.useRef)(null),B=(0,r.useRef)(null),E=(0,r.useRef)(!1),L=(0,r.useRef)(!1),_=(0,r.useRef)(new n.Vector3(D,M,R));(0,r.useEffect)(()=>{if(!P||!b)return;let e=new n.PositionalAudio(b);return e.position.copy(_.current),x?(e.setDistanceModel("exponential"),e.setRefDistance(h/20),e.setMaxDistance(g/25),e.setVolume(d)):(e.setDistanceModel("linear"),e.setRefDistance(1),e.setMaxDistance(2e6),e.setVolume(d/15)),j.current=e,A.add(e),()=>{w.current&&clearTimeout(w.current),B.current&&clearTimeout(B.current);try{e.stop()}catch(e){}e.disconnect(),A.remove(e),E.current=!1,L.current=!1}},[P,b,x,h,g,d,A]);let G=e=>{if(y>0||T>0){let t=Math.max(0,y),r=Math.max(t,T),i=t===r?t:Math.random()*(r-t)+t;e.loop=!1;let o=()=>{!1===e.isPlaying?w.current=setTimeout(()=>{try{e.play(),G(e)}catch(e){}},i):B.current=setTimeout(o,100)};B.current=setTimeout(o,100)}else e.setLoop(!0)};return(0,o.useFrame)(()=>{let e=j.current;if(!e||!v||!p)return;let t=F.position,r=_.current,i=t.distanceTo(r),o=L.current,n=i<=g;if(n&&!o)if(L.current=!0,E.current)try{e.isPlaying||(e.play(),G(e))}catch(e){}else{var u,s;u=(0,c.audioToUrl)(p),s=t=>{if(!e.buffer){e.setBuffer(t),E.current=!0;try{e.play(),G(e)}catch(e){}}},f.has(u)?s(f.get(u)):P.load(u,e=>{f.set(u,e),s(e)},void 0,e=>{console.error("AudioEmitter: Audio load error",u,e)})}else if(!n&&o){L.current=!1,w.current&&clearTimeout(w.current),B.current&&clearTimeout(B.current);try{e.stop()}catch(e){}}}),(0,r.useEffect)(()=>{let e=j.current;if(e&&!v){w.current&&clearTimeout(w.current),B.current&&clearTimeout(B.current);try{e.stop()}catch(e){}}},[v]),m?(0,t.jsxs)("mesh",{position:_.current,children:[(0,t.jsx)("sphereGeometry",{args:[h,12,12]}),(0,t.jsx)("meshBasicMaterial",{color:"#00ff00",wireframe:!0,opacity:.05,transparent:!0,toneMapped:!1}),(0,t.jsx)(l.FloatingLabel,{color:"#00ff00",position:[0,h+1,0],children:p})]}):null});e.s(["AudioEmitter",0,m])}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long