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:
2026-08-24 15:28:41 +07:00
parent 5c7fc2c779
commit 559d52e3c5
3 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -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