fix: playhead not moving in SECTION-TAB with empty tracks

Two fixes:
1. handlePlayPause: add explicit requestAnimationFrame(updatePlayhead)
   after setIsPlaying(true) to ensure RAF starts immediately.
2. handleEditSectionInTab: add setCurrentTime(0) to reset playhead
   to section start. Without this, currentTime may be outside
   the section's timeline range (e.g. from main session playback).
This commit is contained in:
2026-07-28 09:20:31 +07:00
parent 2f2f84066c
commit 5d31563df6
3 changed files with 10 additions and 2 deletions
+6
View File
@@ -539,6 +539,12 @@
- **Ghi chú/Test (nếu có):** `npm run build` pass. Ctrl+Click+Drag section/MIDI item → copy đến vị trí mới, item không bị selected.
---
### [2026-07-28 09:17] Task: Playhead SECTION-TAB di chuyển dù không có items
- **Tóm tắt thay đổi:** Thêm `requestAnimationFrame(updatePlayhead)` sau `setIsPlaying(true)` trong `handlePlayPause` để đảm bảo RAF luôn chạy. Thêm `setCurrentTime(0)` trong `handleEditSectionInTab` để reset playhead về 0 khi mở section tab. Trước đây playhead không di chuyển vì effect useEffect dependency chưa kịp fire hoặc `currentTime` ở vị trí ngoài section timeline.
- **Các file ảnh hưởng:** `app/static/js/app.jsx`, `app/static/js/app.precompiled.js`
- **Ghi chú/Test (nếu có):** `npm run build` pass. Mở SECTION-TAB → Play → playhead di chuyển từ 0 đến maxDuration.
---
### [2026-07-28 09:40] Task: Cả main + section MIDI playback không default program 0
- **Tóm tắt thay đổi:** Thay đổi line 10283 giống line 10393: `instrumentProgram !== undefined ? ... : 0``instrumentProgram`. Trước đây main playback cũng default program 0 khi `instrumentProgram` undefined → `_playNoteFluid` gọi `program_change(ch,0)` trên FluidSynth → load program 0 của MAIN SoundFont. Fix: undefined → oscillator fallback.
- **Các file ảnh hưởng:** `app/static/js/app.jsx`, `app/static/js/app.precompiled.js`