diff --git a/app/static/js/services/soundfontPlayer.js b/app/static/js/services/soundfontPlayer.js index bb0a556..e85c936 100644 --- a/app/static/js/services/soundfontPlayer.js +++ b/app/static/js/services/soundfontPlayer.js @@ -130,6 +130,7 @@ if (_useScriptNode) { var spBufSz = 2048; var spn = _audioCtx.createScriptProcessor(spBufSz, 0, 2); + getCtx(); var lp = _fluidModule._malloc(spBufSz * 4); var rp = _fluidModule._malloc(spBufSz * 4); spn.onaudioprocess = function (e) { @@ -151,6 +152,11 @@ console.log("[SonicSF] ScriptProcessorNode fallback active (buf:", spBufSz, ")"); } + // Re-route through mixer graph if it exists (created before SonicSF was ready) + if (window.__mixerGraphManager && typeof SonicSF.setOutputNode === 'function') { + SonicSF.setOutputNode(window.__mixerGraphManager.masterGain); + } + _initialized = true; console.log("[SonicSF] FluidSynth WASM Engine initialized."); } catch (e) {