From a7e8a70c2f41c09d4efa35032b7ff521f36d64d6 Mon Sep 17 00:00:00 2001 From: you Date: Sun, 22 Mar 2026 09:29:54 +0000 Subject: [PATCH] Audio: resume suspended AudioContext + sonify realistic propagation path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AudioContext starts suspended until user gesture — now resumes on setEnabled(). Also added sonifyPacket to animateRealisticPropagation which is the main code path when Realistic mode is on. --- public/audio.js | 5 ++++- public/index.html | 4 ++-- public/live.js | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/public/audio.js b/public/audio.js index 74e631ab..a044e16e 100644 --- a/public/audio.js +++ b/public/audio.js @@ -73,7 +73,10 @@ // === Core: Initialize audio context === function initAudio() { - if (audioCtx) return; + if (audioCtx) { + if (audioCtx.state === 'suspended') audioCtx.resume(); + return; + } audioCtx = new (window.AudioContext || window.webkitAudioContext)(); masterGain = audioCtx.createGain(); masterGain.gain.value = 0.3; diff --git a/public/index.html b/public/index.html index 96e58eab..89764e28 100644 --- a/public/index.html +++ b/public/index.html @@ -90,8 +90,8 @@ - - + + diff --git a/public/live.js b/public/live.js index 2d3a42c0..2da7b6d4 100644 --- a/public/live.js +++ b/public/live.js @@ -1484,6 +1484,7 @@ if (showOnlyFavorites && !packets.some(p => packetInvolvesFavorite(p))) return; playSound(typeName); + if (window.MeshAudio) MeshAudio.sonifyPacket(first); // Rain drop per observation in the group packets.forEach((p, i) => setTimeout(() => addRainDrop(p), i * 150));