M17: realtime FX mượt — MMCSS Pro Audio + HIGH_PRIORITY_CLASS (JuceFxLoop), GUI tick cadence động 30/200ms (guiBusy), worklet CAP 32->48, track FX gửi input NGAY như master
This commit is contained in:
+13
-27
@@ -25713,34 +25713,20 @@ const App = () => {
|
||||
}
|
||||
if (d.type !== 'in') return;
|
||||
// Burst 4 block (1024 mẫu) → tách 4 WS frame 512 floats → bridge batch 4.
|
||||
// Pace 1 burst/21ms (giống master) — tránh dồn frame sau stall làm tràn ring.
|
||||
entry.inQueue.push(d);
|
||||
const pump = () => {
|
||||
if (!entry.inQueue.length) return;
|
||||
const now = Date.now();
|
||||
while (entry.inQueue.length && now - entry.lastInSent >= FXRT_BURST_MS) {
|
||||
entry.lastInSent = now;
|
||||
const dd = entry.inQueue.shift();
|
||||
if (entry.ws && entry.ws.readyState === 1) {
|
||||
try {
|
||||
const f = new Float32Array(dd.data);
|
||||
if (f.length > 512) {
|
||||
for (let i = 0; i < f.length; i += 512) entry.ws.send(f.slice(i, i + 512).buffer);
|
||||
} else {
|
||||
entry.ws.send(dd.data);
|
||||
}
|
||||
} catch (e) {}
|
||||
// Gửi NGAY (không pace setTimeout) như master path (proven): worklet đã
|
||||
// pace 1 burst/21.33ms theo đồng hồ audio; timer main-thread bận/trễ →
|
||||
// input gửi trễ → engine chỉ sản xuất khi có input → cushion cạn →
|
||||
// crackle. Burst sau stall: engine hấp thụ (in ring 4 slot, drop-oldest).
|
||||
if (entry.ws && entry.ws.readyState === 1) {
|
||||
try {
|
||||
const f = new Float32Array(d.data);
|
||||
if (f.length > 512) {
|
||||
for (let i = 0; i < f.length; i += 512) entry.ws.send(f.slice(i, i + 512).buffer);
|
||||
} else {
|
||||
entry.ws.send(d.data);
|
||||
}
|
||||
}
|
||||
if (entry.inQueue.length) {
|
||||
if (entry.pumpTimer) clearTimeout(entry.pumpTimer);
|
||||
entry.pumpTimer = setTimeout(pump, Math.max(1, FXRT_BURST_MS - (now - entry.lastInSent)));
|
||||
} else if (entry.pumpTimer) {
|
||||
clearTimeout(entry.pumpTimer);
|
||||
entry.pumpTimer = null;
|
||||
}
|
||||
};
|
||||
pump();
|
||||
} catch (e) {}
|
||||
}
|
||||
};
|
||||
} catch (e) {
|
||||
console.warn('[FX RT track] setup fail', trackId, path, e);
|
||||
|
||||
Reference in New Issue
Block a user