FIX: sửa lỗi hiển thị animation của VU meter khi play MIDI
This commit is contained in:
+29
-3
@@ -6984,10 +6984,16 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
}, [activeTracks]);
|
||||
|
||||
const ghostLayers = React.useMemo(function() {
|
||||
// Đang play (main/section) → BỎ ghost: extractGhostLayers duyệt TOÀN BỘ
|
||||
// project (tracks + notes) — block main thread 100-500ms → noteon
|
||||
// FluidSynth (scheduled qua setTimeout) TRỄ → âm bị lag 1-2 lần khi mở
|
||||
// piano roll tab lúc đang play (user bug 06:30). Ghost chỉ là hiển thị
|
||||
// tham chiếu — không cần khi âm đang chạy — tính lại khi dừng.
|
||||
if (isPlaying) return [];
|
||||
if (!activeTracks || !st || !st.target_id) return [];
|
||||
var fn = window.SonicGhost && window.SonicGhost.extractGhostLayers;
|
||||
return fn ? fn(activeTracks, st.trackId, st.target_id, parseInt(bpm) || 120) : [];
|
||||
}, [activeTracks, st.trackId, st.target_id, bpm]);
|
||||
}, [activeTracks, st.trackId, st.target_id, bpm, isPlaying]);
|
||||
|
||||
const secondsPerBar = (60.0 / (parseInt(bpm) || 120)) * 4;
|
||||
const activeTargetItem = React.useMemo(function() {
|
||||
@@ -18627,7 +18633,12 @@ const App = () => {
|
||||
const isSubTab = subTabsRef.current.some(sub => sub.id === activeTabRef.current);
|
||||
if (isSubTab) {
|
||||
const st = subTabsRef.current.find(s => s.id === activeTabRef.current);
|
||||
if (!st || !st.buffer) return;
|
||||
if (!st) return;
|
||||
// PIANO ROLL KHÔNG cần buffer: tab restored từ phiên trước — AudioBuffer
|
||||
// KHÔNG serialize → st.buffer undefined → return cũ làm playhead ĐỨNG IM
|
||||
// (user bug 06:15 — mở lại piano roll đã mở phiên trước khi đang play).
|
||||
// startSubTabPlayback tự tạo silent buffer khi play (18103).
|
||||
if (!st.buffer && st.type !== 'PIANO_ROLL') return;
|
||||
if (!st.isPlaying) {
|
||||
// PIANO ROLL / sub-tab KHÔNG play: playhead theo MAIN/SECTION nếu đang
|
||||
// play — ĐỒNG BỘ 2 CHIỀU: vị trí play (section/main) → vị trí TRONG
|
||||
@@ -19038,7 +19049,22 @@ const App = () => {
|
||||
// audible (bình thường rơi về masterBus.input, mất FX track).
|
||||
const _activeTabId = activeTabRef.current;
|
||||
const _activeSub = subTabsRef.current ? subTabsRef.current.find(s => s.id === _activeTabId) : null;
|
||||
if (_activeSub && _activeSub.type === 'PIANO_ROLL') {
|
||||
// MAIN/SECTION đang play + đang ở SUB-TAB (piano roll/audio): KHÔNG đổi
|
||||
// SF destination — âm đang phát thuộc MAIN context (route đã set ĐÚNG
|
||||
// lúc schedule — masterBus.input — qua mastering). Đổi đích khi âm đang
|
||||
// phát gây: (a) swap _gainNode → LAG ~1s (bug 06:20); (b) route vào node
|
||||
// MAIN trùng id (midiAudible nhánh) → sfEntry/sfRouteGain theo ♪ main →
|
||||
// âm dry NHỎ/không rõ (bug 06:25 — fix 0620). Giữ nguyên route hiện tại.
|
||||
if (isPlayingRef.current && _activeTabId && _activeTabId !== 'main' && !_activeTabId.startsWith('session_')) {
|
||||
return;
|
||||
}
|
||||
// MAIN/SECTION đang play (isPlayingRef) → BỎ QUA nhánh PIANO_ROLL:
|
||||
// đổi SF destination (setOutputDestination — disconnect/reconnect
|
||||
// _gainNode FluidSynth) khi âm đang phát → âm MIDI bị NGẮT ~1s (user
|
||||
// bug 06:20 — mở lại piano roll tab restored lúc main play → lag 1s
|
||||
// rồi mới phát tiếp). Chỉ route vào node piano roll khi KHÔNG play
|
||||
// (preview tab) — handlePlayPause sub-tab tự stopAllPlayback trước.
|
||||
if (_activeSub && _activeSub.type === 'PIANO_ROLL' && !isPlayingRef.current) {
|
||||
// PIANO ROLL của track TRONG SECTION (parent_tab_id = session_*): id
|
||||
// track trùng main track id → lookup key = id trúng node MAIN (route
|
||||
// theo ♪ main — sai context → MIDI bị kéo dry). ƯU TIÊN SUB-NODE
|
||||
|
||||
Reference in New Issue
Block a user