fix(fxrt): bo pace setTimeout input, gui ngay theo dong ho audio worklet (het crackle sau 3-4s khi chain rong)
This commit is contained in:
@@ -1827,6 +1827,8 @@ async function fxRtStart() {
|
||||
};
|
||||
const fxRtInPump = () => {
|
||||
if (!fxRt.inQueue.length) return;
|
||||
// Không còn dùng (gửi ngay theo đồng hồ audio — xem onmessage 'in').
|
||||
// Giữ tham chiếu phòng khi track path còn dùng pattern cũ.
|
||||
const now = Date.now();
|
||||
while (fxRt.inQueue.length && now - fxRt.lastInSent >= FXRT_BURST_MS) {
|
||||
fxRt.lastInSent = now;
|
||||
@@ -1868,8 +1870,12 @@ async function fxRtStart() {
|
||||
return;
|
||||
}
|
||||
if (d.type !== 'in') return;
|
||||
fxRt.inQueue.push(d);
|
||||
fxRtInPump();
|
||||
// Gửi NGAY, không pace setTimeout: input pacing = đồng hồ audio worklet
|
||||
// (1 frame/21.33ms), không phải timer main-thread. Timer bận/trễ → input
|
||||
// gửi trễ → engine/bridge chỉ sản xuất output khi có input → cushion cạn
|
||||
// dần → crackle sau 3-4s (đã xác nhận với chain RỖNG). Burst sau stall:
|
||||
// engine hấp thụ (in ring 4 slot, bridge drain ~1ms, drop-oldest an toàn).
|
||||
fxRtSendFrames(d);
|
||||
};
|
||||
// Pace input: tối đa 1 block/kỳ (~5.8ms). Gửi dồn theo burst (main thread bị
|
||||
// rAF renderFrame block khi mở MASTERING PANEL) → SHM ring 4-slot tràn → mất
|
||||
|
||||
@@ -318,7 +318,7 @@ const fxRtSendFrames=d=>{if(!fxRt.ws||fxRt.ws.readyState!==1)return;try{const f=
|
||||
// chong race: neu stop/restart xay ra trong luc cho, bo qua.
|
||||
if(fxRt.fadedIn)return;setTimeout(()=>{if(token!==fxRt.startToken)return;fxRt.fadedIn=true;fxRtCrossfade(true,token);// Dry gan silent (tc 0.025) roi moi tre pdcDelay — tranh gap khi delay
|
||||
// dang lon dan.
|
||||
setTimeout(()=>fxRtApplyPdc(),250);},30);return;}if(d.type==='set_param'){try{fxRt.ws.send(JSON.stringify({cmd:'set_param',slot:d.slot,key:d.key,value:d.value}));}catch(e){}return;}if(d.type==='stats'){fxRt.stats=d;console.debug('[FX RT stats]',d);return;}if(d.type!=='in')return;fxRt.inQueue.push(d);fxRtInPump();};// Pace input: tối đa 1 block/kỳ (~5.8ms). Gửi dồn theo burst (main thread bị
|
||||
setTimeout(()=>fxRtApplyPdc(),250);},30);return;}if(d.type==='set_param'){try{fxRt.ws.send(JSON.stringify({cmd:'set_param',slot:d.slot,key:d.key,value:d.value}));}catch(e){}return;}if(d.type==='stats'){fxRt.stats=d;console.debug('[FX RT stats]',d);return;}if(d.type!=='in')return;fxRtSendFrames(d);};// Pace input: tối đa 1 block/kỳ (~5.8ms). Gửi dồn theo burst (main thread bị
|
||||
// rAF renderFrame block khi mở MASTERING PANEL) → SHM ring 4-slot tràn → mất
|
||||
// block → ngắt quãng.
|
||||
// Phase 4.2: fader SAU worklet — worklet chèn giữa outputAnalyser (chain
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<script src="/static/js/services/promptTemplateManager.js?v=202607281039"></script>
|
||||
<script src="/static/js/services/undoRedoEngine.js?v=202607290941"></script>
|
||||
<script src="/static/js/services/chordTheory.js?v=202608211300"></script>
|
||||
<script src="/static/js/app.precompiled.js?v=202608241203" defer></script>
|
||||
<script src="/static/js/app.precompiled.js?v=202608242100" defer></script>
|
||||
<link rel="stylesheet" href="/static/css/styles.css?v=202607271016">
|
||||
<style>
|
||||
:root {
|
||||
|
||||
Reference in New Issue
Block a user