FIX: sửa volume main out

This commit is contained in:
2026-07-30 10:05:11 +07:00
parent e64070a83e
commit 2c55db372a
3 changed files with 87 additions and 34 deletions
+5 -5
View File
@@ -30,7 +30,7 @@
if (!_gainNode) {
_gainNode = ctx.createGain();
_gainNode.gain.value = 0.3;
_gainNode.connect(ctx.destination);
_gainNode.connect(window.masterBus ? window.masterBus.input : ctx.destination);
}
return ctx;
}
@@ -119,8 +119,8 @@
if (!_useScriptNode) {
try {
_workletNode = new AudioWorkletNode(_audioCtx, 'fluidsynth-bridge');
_workletNode.connect(_audioCtx.destination);
console.log("[SonicSF] AudioWorklet node connected");
_workletNode.connect(_gainNode);
console.log("[SonicSF] AudioWorklet node connected via gain");
_startRenderLoop();
} catch (e) {
console.warn("[SonicSF] AudioWorkletNode failed:", e);
@@ -146,9 +146,9 @@
}
} catch (er) {}
};
spn.connect(_audioCtx.destination);
spn.connect(_gainNode);
_workletNode = spn;
console.log("[SonicSF] ScriptProcessorNode fallback active (buf:", spBufSz, ")");
console.log("[SonicSF] ScriptProcessorNode connected via gain (buf:", spBufSz, ")");
}
_initialized = true;