FIX: (1) masteringConnected default true + ensureMasteringRouting/refreshCarlaStatus ở mọi đường play — MIDI item/preview qua mastering ngay khi chạy app; (2) _instrumentEpoch chống cache stale + retry bank 0 — hết chọn Synth String nghe Piano; (3) /carla-status + auto-open Carla + route exclusive chỉ khi Carla sống (fallback FluidSynth tránh câm); (4) keybed giữ note theo thời gian bấm (auto-off 5s phòng hờ, mouseup dừng ngay)

This commit is contained in:
2026-08-10 09:51:58 +00:00
parent f492104869
commit 75eba27dcf
7 changed files with 135 additions and 26 deletions
+9
View File
@@ -1,3 +1,12 @@
### [2026-08-10] Task: Thực thi fix (phiên có tool) — mastering ON mặc định, âm sai instrument, Carla alive check
- **Tóm tắt thay đổi:**
(1) **Mastering FX bật ON mặc định**: `masteringSettings` khởi tạo `masterConnected: true` — MIDI item/preview được xử lí qua mastering FX ngay khi chạy app (không cần bật/tắt power). Kèm `ensureMasteringRouting()` + `refreshCarlaStatus()` gọi ở đầu `startTrackPlayback`/`startLocalTrackPlayback`/`schedulePianoRollMidi`.
(2) **Âm sai instrument (chọn Synth String nghe Piano)**: `soundfontPlayer.js` thêm `_instrumentEpoch` — tăng khi `selectInstrument`/load soundfont thành công; `progAlreadySet` chỉ skip program_select khi cache khớp EPOCH hiện tại → mọi đổi instrument đều program_select lại đúng preset (hết cache stale); `program_select` fail → thử lại bank 0; cache channel lưu `_epoch`.
(3) **Carla không play MIDI note / câm toàn phần**: backend thêm `GET /api/v1/plugins/carla-status` (running + osc_port); `api.js` thêm `carlaStatus()`; frontend `refreshCarlaStatus()` + `ensureCarlaForPlayback()` (auto-mở Carla với VSTi khi chưa chạy); `routeToCarla` chỉ EXCLUSIVE khi `window.__carlaRunning !== false` — Carla chết → fallback FluidSynth (luôn có âm).
(4) **Keybed giữ note theo thời gian bấm**: durationMs 500/200 → 5000 (auto-off phòng hờ); mouseup/mouseleave dừng NGAY qua stopNote.
- **Các file ảnh hưởng:** `app/api/v1/plugins.py` (+/carla-status), `app/static/js/app.jsx`, `app/static/js/app.precompiled.js` (rebuild babel), `app/static/js/services/soundfontPlayer.js` (epoch + fallback), `app/static/js/services/api.js` (+carlaStatus), `app/templates/index.html` (?v= 202608101700), `dist/daw_engine/_internal/app/static/**` + `templates/index.html`
- **Ghi chú/Test (nếu có):** pytest 86 passed, 7 skipped. Smoke jsdom EVAL OK. Test noteoff 6/6. curl `/carla-status` → {"running":false,"osc_port":22752}. ⚠️ Rebuild PyInstaller exe trên Windows để nhận backend `/carla-status` (PYZ); static/templates đã sync dist.
### [2026-08-10] Task: Fix (KHÔNG bỏ qua) — MIDI keyboard preview không qua mastering + noteoff không xử lí + MIDI item không play qua Carla bridge
- **Tóm tắt thay đổi:**
(1) **MIDI item PHẢI play qua Carla bridge khi VSTi loaded** (`app.jsx`): trước đây các hàm playback gọi `SonicSF.playNote` (FluidSynth GM — âm SAI) SONG SONG với route Carla → âm nghe được là GM, không phải VSTi. Giờ: mọi đường playback (startTrackPlayback main, MIDI section subTrack, startLocalTrackPlayback, schedulePianoRollMidi + ghost notes) tính `routeToCarla = shouldRoutePlayback(synth_engine)` — nếu TRUE → CHỈ route Carla (bỏ hẳn FluidSynth); FALSE → FluidSynth như cũ.