V45.26: fix wobble/crackle khi preview MIDI keyboard nhan (1/8 lien tuc) o MAIN/SECTION/PR tab. Root cause: unifiedMidiRouter.pushEvent clear master FX outQueue (__clearMasterFxQueue, V31 fix lag idle backlog ~341ms) tren MOI live NOTE_ON -> rapid notes: moi note wipe queue dang chua tail note truoc + resume fade-in 43ms -> cat tail (crackle) + fade nhap nhay (wobble). Fix: chi clear khi that su idle->active (khong con note dang giu VA im lang >500ms) — dem _liveHeldCount + _lastLiveEventAt; note dang ngan / chuoi note nhanh giu queue. Timeline (live=false) khong doi. v=202608311756

This commit is contained in:
2026-08-31 17:56:17 +07:00
parent fbefa7e864
commit 72ae2c8a9a
3 changed files with 26 additions and 5 deletions
+22 -1
View File
@@ -6,6 +6,10 @@
var MELODIC_CHANNELS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14]; // skip 9 (percussion); 15 reserved for Media Explorer preview
var _lastTimelineDbgTs = 0;
// V45.26: dem note live dang giu + lan live event gan nhat — quyet dinh co
// clear master FX outQueue khong (chi idle->active; KHONG khi dang phat lien tuc).
var _liveHeldCount = 0;
var _lastLiveEventAt = 0;
var router = {
bridgeConnected: false,
@@ -59,7 +63,23 @@
// V31: live note (ARM keyboard preview) — clear master FX outQueue backlog
// (idle block ~341ms) truoc khi note moi render; timeline note (live=false)
// KHONG clear — tranh drop audio dang phat.
if (opts.live && opts.cmd === 'NOTE_ON') { try { if (window.__clearMasterFxQueue) window.__clearMasterFxQueue(); } catch (e) {} }
// V45.26: chi clear khi THAT SU idle -> active (khong con note dang giu
// VA im lang >500ms). Truoc day clear MOI note-on live -> rapid 1/8 lien
// tuc: moi note wipe outQueue (dang chua tail note truoc + resume fade-in)
// -> wobble/crackle (bug user). Note dang ngan / chuoi note nhanh -> giu
// queue -> tail note truoc khong bi cat.
if (opts.live) {
try {
var _nowEv = (window.performance && performance.now) ? performance.now() : Date.now();
if (opts.cmd === 'NOTE_ON') {
if (_liveHeldCount === 0 && (_nowEv - _lastLiveEventAt) > 500 && window.__clearMasterFxQueue) window.__clearMasterFxQueue();
_liveHeldCount++;
} else if (opts.cmd === 'NOTE_OFF') {
if (_liveHeldCount > 0) _liveHeldCount--;
}
_lastLiveEventAt = _nowEv;
} catch (e) {}
}
var cmd = opts.cmd, ch = opts.channel, pitch = opts.pitch;
var vel = (opts.velocity === undefined ? 1.0 : opts.velocity);
var sampleOffset = opts.sampleOffset || 0;
@@ -85,6 +105,7 @@
/** Stop/panic -> bridge transport panic (flush all notes) + fallback local stopAll. */
panic: function () {
_liveHeldCount = 0;
if (this.isBridgeActive() && window.NativeBridgeService.transport) {
window.NativeBridgeService.transport('panic');
}