fix(audio): prime Safari mic graph; use raw PCM fallback; stabilize teardown

Route mic source through analyser into a silent sink to force processing on Safari/WebKit.

Add ScriptProcessorNode raw-PCM capture path for reliable RMS/entropy sampling.

Clamp/scale levels to avoid Infinity/opacity warnings and improve UI thresholds.

Deduplicate/guard AudioContext shutdown to prevent “Cannot close a closed AudioContext”.

Improve logging around context state, pipeline init, and capture source selection.
This commit is contained in:
LC mac
2026-02-11 00:32:42 +08:00
parent f52186f2e7
commit 20cf558e83
2 changed files with 717 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ import CameraEntropy from './components/CameraEntropy';
import DiceEntropy from './components/DiceEntropy';
import { InteractionEntropy } from './lib/interactionEntropy';
import AudioEntropy from './AudioEntropy';
console.log("OpenPGP.js version:", openpgp.config.versionString);
interface StorageItem {
@@ -736,6 +737,17 @@ function App() {
</div>
)}
{/* Audio Entropy Component */}
{entropySource === 'audio' && !generatedSeed && (
<AudioEntropy
key={`audio-${resetCounter}`}
wordCount={seedWordCount}
onEntropyGenerated={handleEntropyGenerated}
onCancel={() => setEntropySource(null)}
interactionEntropy={interactionEntropyRef.current}
/>
)}
{/* Generated Seed Display + Destination Selector */}
{generatedSeed && (
<div className="space-y-4">