FIX: sửa lỗi phát hiện đã không còn play midi note để PIANO ROLL TAB quay về vị trí 0

This commit is contained in:
2026-08-07 10:41:45 +07:00
parent 6c16bf8410
commit c1aa1eb4d4
4 changed files with 30 additions and 2 deletions
+18
View File
@@ -14925,6 +14925,24 @@ const App = () => {
const [selectionCleared, setSelectionCleared] = useState(false); // LOOP_EDITOR_2.md §4.2
// Detect MAIN/SECTION play va DNG (hết notes/projectEnd/stop): nếu đang
// PIANO ROLL tab (không play tab) playhead v 0 user: main play hết
// không còn midi note piano roll phi v đu (không gi local cui).
const prevIsPlayingRef = useRef(false);
useEffect(() => {
const wasPlaying = prevIsPlayingRef.current;
prevIsPlayingRef.current = isPlaying;
if (wasPlaying && !isPlaying) {
const _tabId = activeTabRef.current;
if (_tabId && _tabId.startsWith('midi_')) {
const _prSt = subTabsRef.current.find(s => s.id === _tabId);
if (_prSt && !_prSt.isPlaying) {
setSubTabs(prev => prev.map(s => s.id === _tabId ? { ...s, currentTime: 0 } : s));
}
}
}
}, [isPlaying]);
const midiVuActivityRef = useRef({});
const triggerMidiVuActivity = (trackId, velocity) => {
if (!trackId) return;