V44: fix crackle - uu tien audio thread bridge (HIGHEST) + FILL 24 (cushion ~90ms) PDC 7936
This commit is contained in:
@@ -2165,7 +2165,7 @@ function fxRtStop(silent) {
|
|||||||
// ≈ 1792) + FILL buffer 16 block (4096) = 23 block ≈ 5888 (~123ms @48k). Giữ
|
// ≈ 1792) + FILL buffer 16 block (4096) = 23 block ≈ 5888 (~123ms @48k). Giữ
|
||||||
// đồng bộ với sf-fx-realtime.js. FX_RT_START_EST_MS: ước lượng khởi đầu khi
|
// đồng bộ với sf-fx-realtime.js. FX_RT_START_EST_MS: ước lượng khởi đầu khi
|
||||||
// chưa có phép đo (fx_play_first) — dùng cho freeze playhead thay V39 0.31s.
|
// chưa có phép đo (fx_play_first) — dùng cho freeze playhead thay V39 0.31s.
|
||||||
const FX_RT_ROUNDTRIP_SAMPLES = 5888;
|
const FX_RT_ROUNDTRIP_SAMPLES = 7936;
|
||||||
const FX_RT_START_EST_MS = 450;
|
const FX_RT_START_EST_MS = 450;
|
||||||
// G3: anchor processed — playhead = startOffset + (processed - anchor - latency)/sr
|
// G3: anchor processed — playhead = startOffset + (processed - anchor - latency)/sr
|
||||||
// (da tru latency -> bam vi tri mau NGHE DUOC; pre-roll tu giu tai startOffset —
|
// (da tru latency -> bam vi tri mau NGHE DUOC; pre-roll tu giu tai startOffset —
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ class SfFxRealtimeProcessor extends AudioWorkletProcessor {
|
|||||||
super();
|
super();
|
||||||
this.BLOCK = 256; // FXRT_BLOCK
|
this.BLOCK = 256; // FXRT_BLOCK
|
||||||
this.BURST = 4; // số block gom 1 frame (bridge batch)
|
this.BURST = 4; // số block gom 1 frame (bridge batch)
|
||||||
this.FILL = 16; // V43: 16 block ~85ms @48k: buffer khởi đầu — hấp thụ jitter main-thread (GUI decode, rAF, VST panel). PDC 5888 = (7+16)*256 (fxRtApplyPdc). V40 giam 24->8 -> cushion = FILL - d ~3-8; pump/WS gap 42ms + queue 3 -> underrun (fx_stats u=1 q=0 trong log). V43 len 16 -> cushion ~11-16, ngang muc q=10-15 sau flush/resume (het underrun trong log).
|
this.FILL = 24; // V44: 24 block ~128ms @48k: buffer khởi đầu — hấp thụ jitter main-thread + stall deschedule bridge 68-138ms. PDC 7936 = (7+24)*256 (fxRtApplyPdc). V43 16 -> cushion ~9 (q 3-9) chua du: stall 68-82ms van gay underrun. V44 len 24 -> cushion ~17 (~90ms).
|
||||||
this.RESUME_FILL = 16; // V26: re-buffer khi resume SAU STOP (flush_for_stop) — 16 block ~85ms (V43: = FILL) → play kế tiếp bắt đầu nhanh; underrun-stall vẫn dùng FILL (crackle/wobble).
|
this.RESUME_FILL = 24; // V26: re-buffer khi resume SAU STOP (flush_for_stop) — 16 block ~85ms (V43: = FILL) → play kế tiếp bắt đầu nhanh; underrun-stall vẫn dùng FILL (crackle/wobble).
|
||||||
this.resumeFill = this.FILL; // mức re-buffer khi resume sau flush — stop: RESUME_FILL, underrun-stall: FILL
|
this.resumeFill = this.FILL; // mức re-buffer khi resume sau flush — stop: RESUME_FILL, underrun-stall: FILL
|
||||||
this.CAP = 32; // V40: cap queue chặn overflow (~170ms)
|
this.CAP = 32; // V40: cap queue chặn overflow (~170ms)
|
||||||
this.HOLD_FADE = 4; // 4 block ~21ms: fade 1→0 sau HOLD hết (hết click cắt cứng)
|
this.HOLD_FADE = 4; // 4 block ~21ms: fade 1→0 sau HOLD hết (hết click cắt cứng)
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ int run_juce_fx_loop(const std::string& jobPath, const std::string& shmName,
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
timeBeginPeriod(1);
|
timeBeginPeriod(1);
|
||||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Engine: prepare graph (chain theo fx_chain). sr/block từ job; header là
|
// Engine: prepare graph (chain theo fx_chain). sr/block từ job; header là
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ int run_realtime_fx_loop(const std::string& jobPath, const std::string& shmName,
|
|||||||
// (fx-gui spawn + VST load instance thu 2, native VSTi GUI open...) preempt
|
// (fx-gui spawn + VST load instance thu 2, native VSTi GUI open...) preempt
|
||||||
// -> underrun -> am bi "bop nghet"/ngat quan. ChannelWorker (main.cpp)
|
// -> underrun -> am bi "bop nghet"/ngat quan. ChannelWorker (main.cpp)
|
||||||
// da dung THREAD_PRIORITY_ABOVE_NORMAL.
|
// da dung THREAD_PRIORITY_ABOVE_NORMAL.
|
||||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||||
#endif
|
#endif
|
||||||
// Chờ chain ĐẦU TIÊN được worker build xong (gen>=1) trước khi READY.
|
// Chờ chain ĐẦU TIÊN được worker build xong (gen>=1) trước khi READY.
|
||||||
// setChain() là ASYNC — worker thread load VST3 + preset mất 1-4s; nếu set
|
// setChain() là ASYNC — worker thread load VST3 + preset mất 1-4s; nếu set
|
||||||
|
|||||||
Reference in New Issue
Block a user