From 050c387cb0f9f95922b202e2e375dee632e9efd5 Mon Sep 17 00:00:00 2001 From: you Date: Sun, 22 Mar 2026 09:35:18 +0000 Subject: [PATCH] =?UTF-8?q?Revert=20audio=20fixes=20=E2=80=94=20restore=20?= =?UTF-8?q?to=20initial=20working=20audio=20commit=20(cf3964a)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/audio.js | 11 +++-------- public/index.html | 6 +++--- public/live.js | 1 - 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/public/audio.js b/public/audio.js index d3f0017b..74e631ab 100644 --- a/public/audio.js +++ b/public/audio.js @@ -73,10 +73,7 @@ // === Core: Initialize audio context === function initAudio() { - if (audioCtx) { - if (audioCtx.state === 'suspended') audioCtx.resume(); - return; - } + if (audioCtx) return; audioCtx = new (window.AudioContext || window.webkitAudioContext)(); masterGain = audioCtx.createGain(); masterGain.gain.value = 0.3; @@ -86,13 +83,11 @@ // === Core: Sonify a single packet === function sonifyPacket(pkt) { - console.log('[audio] sonifyPacket called, enabled:', audioEnabled, 'ctx:', audioCtx?.state, 'voices:', activeVoices); if (!audioEnabled || !audioCtx) return; - if (activeVoices >= MAX_VOICES) return; + if (activeVoices >= MAX_VOICES) return; // voice stealing: just drop const rawHex = pkt.raw || pkt.raw_hex || (pkt.packet && pkt.packet.raw_hex) || ''; - console.log('[audio] rawHex len:', rawHex.length, 'first20:', rawHex.slice(0, 20)); - if (!rawHex || rawHex.length < 6) return; + if (!rawHex || rawHex.length < 6) return; // need at least 3 bytes // Parse raw hex to byte array const allBytes = []; diff --git a/public/index.html b/public/index.html index 46a16148..5c85ad06 100644 --- a/public/index.html +++ b/public/index.html @@ -22,7 +22,7 @@ - + - - + + diff --git a/public/live.js b/public/live.js index 2da7b6d4..2d3a42c0 100644 --- a/public/live.js +++ b/public/live.js @@ -1484,7 +1484,6 @@ 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));