diff --git a/web/world/js/skyfx.js b/web/world/js/skyfx.js index 2c63773..030576e 100644 --- a/web/world/js/skyfx.js +++ b/web/world/js/skyfx.js @@ -168,6 +168,19 @@ function createAudio(seed = 1) { return { get ready() { return started; }, + /** 'running' | 'suspended' | 'closed' | 'none'. `ready` only means the graph + * got built — a suspended context is still silent, so the HUD reports this. */ + get state() { return ctx ? ctx.state : 'none'; }, + /** Current layer gains — for the HUD and for asserting the bed tracks wind. */ + levels() { + if (!started) return null; + return { + wind: +windGain.gain.value.toFixed(4), + howl: +howlGain.gain.value.toFixed(4), + rain: +rainGain.gain.value.toFixed(4), + cutoff: Math.round(windFilter.frequency.value), + }; + }, /** Call from the first click/keydown. Safe to call repeatedly. */ unlock() { diff --git a/web/world/weather_demo.html b/web/world/weather_demo.html index 8a67a0e..0c5801f 100644 --- a/web/world/weather_demo.html +++ b/web/world/weather_demo.html @@ -247,7 +247,7 @@ function frame(now) {
dir ${(wind.dirAt(t)).toFixed(2)} rad
rain
worst
-
debris ${debris.pieces.length} audio ${sky.audio.ready ? 'on' : '(click)'}
+
debris ${debris.pieces.length} audio ${sky.audio.ready ? sky.audio.state : '(click)'}
flash ${sky.flash.toFixed(2)}
${tg ? `
GUST INBOUND ${tg.eta.toFixed(1)}s pow ${tg.power.toFixed(0)}
` : '
 
'} ${ticker.slice(0, 3).map((s) => `
${s}
`).join('')}