V45.30: REVERT V45.29 (a069773) - V45.29 ring worklet 80 (~426ms) gay latency cao khi preview midi keyboard (ring luon day, do tre = dung ring cap) va crackle khi Chord VST2; quay ve V45.28 (4ed1de6): ring 48 (~256ms), worklet URL v=202608311820, bo log worklet_stats dinh ky. v=202608311820

This commit is contained in:
2026-08-31 18:43:48 +07:00
parent a069773d4a
commit 833f3bd158
3 changed files with 10 additions and 24 deletions
+2 -14
View File
@@ -17,7 +17,6 @@
var _initialized = false;
var _useWorklet = false;
var _workletStats = null; // stats tu worklet (overrun/underrun) — getDiag
var _statsLogAccum = 0; // dem stats messages — log dbg dinh ky (V45.29)
var _dest = null; // destination gain node da noi (chong connect trung)
function _getCtx() {
@@ -33,7 +32,7 @@
console.warn('[BridgeAudioNode] AudioWorklet unavailable — ScriptProcessor fallback');
return false;
}
var url = '/static/js/services/bridgeAudioWorklet.js?v=202608311832';
var url = '/static/js/services/bridgeAudioWorklet.js?v=202608311820';
_ctx.audioWorklet.addModule(url).then(function () {
if (!_initialized) return; // disconnect() happened while loading
if (_useWorklet) return; // already set up (init retry)
@@ -45,18 +44,7 @@
});
_workletNode.connect(_gainNode);
_workletNode.port.onmessage = function (ev) {
if (ev.data && ev.data.type === 'stats') {
_workletStats = ev.data;
// V45.29: log dinh ky worklet_stats (moi ~2s) — preview_diag chi
// fire khi bam keybed/vkb, duong preview khac khong log ws= duoc.
try {
_statsLogAccum++;
if (_statsLogAccum >= 4) {
_statsLogAccum = 0;
if (window.__dbgLog) window.__dbgLog('worklet_stats', 'ov=' + ev.data.overruns + ' un=' + ev.data.underruns + ' ring=' + ev.data.ring + ' max=' + ev.data.max);
}
} catch (e) {}
}
if (ev.data && ev.data.type === 'stats') _workletStats = ev.data;
};
_useWorklet = true;
// drain pre-buffer into worklet (order preserved)
+7 -9
View File
@@ -1,13 +1,11 @@
// app/static/js/services/bridgeAudioWorklet.js
// VSTi crackle fix: audio sink chay tren audio thread (khong jank main thread).
// - Ring block 256 mau, toi da 80 block (~426ms @48k) — hap thu jitter pump
// (V45.29: 48->80 theo log thuc te: render loop C++ stall toi ~361ms —
// fxrt_bridge loopMax=361ms, fxrt_pump pump_gap 362ms, longtask d=346 —
// ring 48 (256ms) van khong du -> underrun lap lai -> wobble chord van con.
// Lich su: 8->16 (V45) dung tremolo crackle, 16->32 (V45.27) dung crackle,
// 32->48 (V45.28) chua du stall chord, 48->80 (V45.29) phu stall ~426ms).
// Flush o play start (app.jsx) xoa ring nen do tre khong tang: ring thuong
// can o preview.
// - Ring block 256 mau, toi da 48 block (~256ms @48k) — hap thu jitter pump
// (V45.28: 32->48 de dung wobble VST2 loop/tremolo khi nhan chord — chord
// nhieu voice -> render loop C++ stall dai hon ~170ms -> underrun lap lai
// (fade ve 0) nghe nhu wobble; 8->16 (V45) dung tremolo crackle, 16->32
// (V45.27) dung crackle, 32 van chua du cho stall chord). Flush o play
// start (app.jsx) xoa ring nen do tre khong tang: ring thuong can o preview.
// - Underrun: fade ve 0 thay vi click (hard silence).
// - Resume sau silence: fade vao tu 0.
// - Overrun: drop block cu nhat + crossfade tich luy — moi block drop cong
@@ -19,7 +17,7 @@ class BridgeAudioSinkProcessor extends AudioWorkletProcessor {
constructor() {
super();
this._ring = [];
this._MAX = 80;
this._MAX = 48;
this._gain = 1.0;
this._lastOutL = 0.0;
this._lastOutR = 0.0;
+1 -1
View File
@@ -40,7 +40,7 @@
<script src="/static/js/services/soundfontStorage.js?v=202608290945"></script>
<script src="/static/js/services/soundfontPlayer.js?v=202608290945"></script>
<script src="/static/js/services/nativeBridgeService.js?v=202608291510"></script>
<script src="/static/js/services/bridgeAudioNode.js?v=202608311832"></script>
<script src="/static/js/services/bridgeAudioNode.js?v=202608311820"></script>
<script src="/static/js/services/unifiedMidiRouter.js?v=202608311756"></script>
<script src="/static/js/services/audioRoutingEngine.js?v=202608290945"></script>
<script src="/static/js/services/aiGateway.js?v=202608290945"></script>