fix: bật AudioWorklet hết deprecation ScriptProcessor + signature guard applyMasteringSettings hết BiquadFilterNode state is bad

This commit is contained in:
2026-08-03 12:11:11 +07:00
parent 71278f2aba
commit 36edc9daca
5 changed files with 30 additions and 11 deletions
+8 -7
View File
@@ -86,14 +86,15 @@
console.log("[SonicSF] AudioCtx state:", _audioCtx.state, "sampleRate:", _audioCtx.sampleRate);
// ScriptProcessor is the proven-stable renderer in this app.
// The AudioWorklet path (fluidsynth-bridge) is implemented and
// mono-safe, but it caused device-specific audio failures, so
// keep it opt-in (flip to false to try it) — the deprecation
// console warning is cosmetic.
var _useScriptNode = true;
// Use the AudioWorklet (fluidsynth-bridge) — ScriptProcessor
// is deprecated and logs a console warning. The worklet is
// now mono-safe (handles 1/2/N channel outputs) and the node
// is forced stereo, and the URL is cache-busted so the fixed
// module always loads. Falls back to ScriptProcessor if the
// worklet cannot be created (older browsers).
var _useScriptNode = false;
try {
await _audioCtx.audioWorklet.addModule('/static/js/worklets/fluidsynth-bridge.js?v=202608031240');
await _audioCtx.audioWorklet.addModule('/static/js/worklets/fluidsynth-bridge.js?v=202608031315');
console.log("[SonicSF] Worklet registered OK");
} catch (e) {
console.warn("[SonicSF] Worklet reg failed:", e);