FIX: sửa lỗi MIDI item không play được qua carla, loop không tắt với soundfont
This commit is contained in:
@@ -3056,3 +3056,8 @@
|
||||
- **Tóm tắt thay đổi:** (1) **Playback MIDI items → Carla**: `schedulePianoRollMidi` (app.jsx ~21133) giờ route note_on/note_off tới Carla qua `SonicCarlaMidi.shouldRoutePlayback()` (track VSTi + carla_local, KHÔNG cần ARM — user chủ động bấm Play) — schedule bằng setTimeout theo audio clock (preview, timing gần đúng). Keybed/draw preview vẫn yêu cầu ARM (shouldRoute). (2) **List instrument soundfont hoạt động không cần libfluidsynth**: `PluginManager.list_soundfont_instruments` bỏ early-return `if not ensure_pyfluidsynth(): return []`; thêm fallback đọc TRỰC TIẾP file SF2 qua `SoundFontInspector.inspect_sf2_file` (sf2utils — thuần Python, đọc preset header pdta/phdr → bank/program/name) — quan trọng trên Windows khi thiếu fluidsynth DLL. Giữ đường FluidSynth khi có lib.
|
||||
- **Các file ảnh hưởng:** `app/core/vst_engine.py`, `app/static/js/services/runtime.js` (+shouldRoutePlayback), `app/static/js/app.jsx` (schedulePianoRollMidi), `app/static/js/app.precompiled.js` (rebuild), `dist/daw_engine/_internal/app/static/**`, `wiki.md`
|
||||
- **Ghi chú/Test (nếu có):** pytest: 86 passed, 7 skipped. Test fallback trên máy KHÔNG có libfluidsynth (đúng kịch bản Windows): file sf2 thật → 137 presets (first: {bank:128, program:48, name:'Orchestra Kit', is_percussion:True}). Rebuild bundle BUILD OK; dist synced. ⚠️ Cần rebuild PyInstaller trên Windows để nhận backend fix (dist backend trong exe).
|
||||
|
||||
### [2026-08-09] Task: Carla auto-connect (Patchbay) + MIDI item play + fix note kẹt keybed
|
||||
- **Tóm tắt thay đổi:** (1) **Carla auto-connect lần đầu**: `_write_carla_project` thêm section `<Patchbay>` vào .carxs — audio out plugin → `system:playback_1/2` (default speaker) + MIDI in → plugin `midi_in` (biến thể tên client Carla/carla/system:midi_capture_1; connection trỏ port không tồn tại bị Carla bỏ qua im lặng). Trước đây Carla load project KHÔNG connect gì → lần đầu không có âm/không nhận MIDI (phải unload/load lại). (2) **MIDI item play qua Carla**: nguyên nhân chính là (a) thiếu audio connection (đã fix ở trên) + (b) browser cache bundle cũ — bump `?v=` stamps trong index.html (runtime.js/api.js/app.precompiled.js → 202608091200) để chắc chắn load bundle mới có `SonicCarlaMidi.shouldRoutePlayback`. (3) **Keybed note kẹt**: onMouseUp + onMouseLeave (mới) giờ gọi `SonicSF.stopNote(kbCtx.ch, pitch)` (dừng âm soundfont khi thả/rời phím) + clear timer Carla + `noteOff` tới Carla. Không đụng MIDI item playback của soundfont (vẫn chạy tốt).
|
||||
- **Các file ảnh hưởng:** `app/api/v1/plugins.py` (_write_carla_project +Patchbay), `app/static/js/app.jsx` (keybed onMouseUp/onMouseLeave), `app/static/js/app.precompiled.js` (rebuild), `app/templates/index.html` (?v= bump), `dist/daw_engine/_internal/app/**`, `wiki.md`
|
||||
- **Ghi chú/Test (nếu có):** pytest: 86 passed, 7 skipped. Test .carxs: XML parse OK, 5 Connection đúng (audio_out1/2 → system:playback_1/2; Carla/carla/system:midi_capture_1 → plugin:midi_in). Rebuild bundle BUILD OK; dist synced (gồm index.html mới ?v=). ⚠️ Rebuild PyInstaller trên Windows để nhận backend fix (.carxs mới).
|
||||
|
||||
Reference in New Issue
Block a user