V45.21: fix Bug 1 (seek delay - seek branch resumeFill=8 thay vi RESUME_FILL 24 ~128ms -> 43ms nhu wrap V45.4; applyPlayheadDirect stopAllPlayback(false,true) skipRouting nhu seekPlaybackTo) + Bug 2 (attachMidiHandler guard _isPrTabNow nhu vkbNoteOn V45.19 - ARM piano roll khong leak ra MAIN/SESSION) v=202608311642

This commit is contained in:
2026-08-31 16:43:32 +07:00
parent 75b1512779
commit 7572d339de
4 changed files with 23 additions and 14 deletions
+13 -7
View File
@@ -18626,6 +18626,10 @@ const App = () => {
const rawVel = msg.data[2];
// Scale low MIDI velocity naturally (min 1, max 127)
const scaledVel = Math.min(127, Math.max(1, Math.round(rawVel)));
// V45.21: ARM piano roll chi hieu luc khi dang o PIANO_ROLL tab
// (giong vkbNoteOn V45.19) — quay lai MAIN/SESSION khong leak preview.
const _prTabNow = (subTabsRef.current || []).find(function (s) { return s.id === activeTabRef.current; });
const _isPrTabNow = !!(_prTabNow && _prTabNow.type === 'PIANO_ROLL');
if (cmd === 0x9 && rawVel > 0) {
lastMidiNoteRef.current = { pitch, velocity: scaledVel, startTime: performance.now(), length: 0 };
setLastMidiNote({ pitch, velocity: scaledVel, length: 0, time: Date.now() });
@@ -18646,11 +18650,13 @@ const App = () => {
// track - preview note tu piano roll tab phai toi track dang
// edit du track main KHONG ARM (ARM piano roll khong truyen).
var bPrArmed = {};
try {
(subTabsRef.current || []).forEach(function (s) {
if (s.type === 'PIANO_ROLL' && s.isArmed && s.trackId) bPrArmed[s.trackId] = true;
});
} catch (e) {}
if (_isPrTabNow) {
try {
(subTabsRef.current || []).forEach(function (s) {
if (s.type === 'PIANO_ROLL' && s.isArmed && s.trackId) bPrArmed[s.trackId] = true;
});
} catch (e) {}
}
bTracks.forEach(function (bt) {
if (!bt.isArmed && !bPrArmed[bt.id]) return;
if (window.triggerMidiVuActivity) {
@@ -18663,7 +18669,7 @@ const App = () => {
});
} else if (window.SonicSF) {
var allTracks = activeTracksRef.current || [];
var arSubs = subTabsRef && subTabsRef.current ? subTabsRef.current.filter(function(s) { return s.type === 'PIANO_ROLL' && s.isArmed; }) : [];
var arSubs = _isPrTabNow && subTabsRef && subTabsRef.current ? subTabsRef.current.filter(function(s) { return s.type === 'PIANO_ROLL' && s.isArmed; }) : [];
var armedTracks = allTracks.filter(function(t) { return t.isArmed; });
// Piano Roll arming has priority: route to each armed sub-tab's parent track
if (arSubs.length > 0) {
@@ -19437,7 +19443,7 @@ const App = () => {
setCurrentTime(time);
fxRtKeepForRestart = true; // restart/resume — giữ session FX realtime
fxRtSeekRestartFlag = true; // V45.18: seek khi play — startTrackPlayback clear_queue mode 'seek' (wipe queue cu + resume nhanh)
stopAllPlayback();
stopAllPlayback(false, true); // V45.21: skipRouting nhu seekPlaybackTo (V45.10)
try { if (window.__fxRtPlayheadFreeze) window.__fxRtPlayheadFreeze(true); } catch (e) { }
setTimeout(() => {
startAudioTimeRef.current = getAudioContext().currentTime;