diff --git a/app/static/js/app.jsx b/app/static/js/app.jsx
index 011d2d8..15b64f1 100644
--- a/app/static/js/app.jsx
+++ b/app/static/js/app.jsx
@@ -20867,7 +20867,11 @@ const App = () => {
const ensureMasteringRouting = () => {
try {
const _s = window.currentMasteringSettings;
- if (!_s || !masterBus || !audioCtx) return;
+ if (!_s) return;
+ // Đảm bảo audioCtx + masterBus đã tồn tại trước khi sync (lần preview
+ // đầu tiên audio chưa init → getAudioContext tạo ngay)
+ getAudioContext();
+ if (!masterBus || !audioCtx) return;
toggleMasteringOnMaster(!!_s.masterConnected, !!_s.isBypassed);
applyMasteringSettings(_s);
updateSfRouting();
diff --git a/app/static/js/app.precompiled.js b/app/static/js/app.precompiled.js
index 2962a84..889012e 100644
--- a/app/static/js/app.precompiled.js
+++ b/app/static/js/app.precompiled.js
@@ -1290,7 +1290,9 @@ const _b=effMidiBypass(t);node.sfRouteGain.gain.value=_b?0:1;node.sfDryGain.gain
// chạy khi bắt đầu preview. Hàm này ép đồng bộ 3 lớp (graph theo trạng thái
// hiện tại — early-return nếu đã đúng; tham số module; route SF + route
// gains) — gọi tại mọi điểm preview → âm preview LUÔN qua mastering khi bật.
-const ensureMasteringRouting=()=>{try{const _s=window.currentMasteringSettings;if(!_s||!masterBus||!audioCtx)return;toggleMasteringOnMaster(!!_s.masterConnected,!!_s.isBypassed);applyMasteringSettings(_s);updateSfRouting();}catch(e){console.warn('ensureMasteringRouting error:',e);}};const ensureMasteringRoutingRef=useRef(null);ensureMasteringRoutingRef.current=ensureMasteringRouting;window.__ensureMasteringRouting=ensureMasteringRouting;// ── MIDI preview cache (bounce nhanh offline) ──
+const ensureMasteringRouting=()=>{try{const _s=window.currentMasteringSettings;if(!_s)return;// Đảm bảo audioCtx + masterBus đã tồn tại trước khi sync (lần preview
+// đầu tiên audio chưa init → getAudioContext tạo ngay)
+getAudioContext();if(!masterBus||!audioCtx)return;toggleMasteringOnMaster(!!_s.masterConnected,!!_s.isBypassed);applyMasteringSettings(_s);updateSfRouting();}catch(e){console.warn('ensureMasteringRouting error:',e);}};const ensureMasteringRoutingRef=useRef(null);ensureMasteringRoutingRef.current=ensureMasteringRouting;window.__ensureMasteringRouting=ensureMasteringRouting;// ── MIDI preview cache (bounce nhanh offline) ──
// Khi preview: capture tiếng đàn (SF output — pre track-FX) vào cache theo
// track. Khi export: nếu cache đủ độ dài → render OFFLINE NHANH bằng cache
// (qua FX Rack + Mastering như playback) — không cần chờ bounce realtime.
diff --git a/app/templates/index.html b/app/templates/index.html
index 9b218c6..dc32e5a 100644
--- a/app/templates/index.html
+++ b/app/templates/index.html
@@ -31,12 +31,12 @@
-
-
+
+
-
+
@@ -44,7 +44,7 @@
-
+