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:
2026-08-10 11:33:47 +07:00
parent 1cf5b18492
commit d20932a68b
5 changed files with 46 additions and 5 deletions
+18
View File
@@ -663,6 +663,23 @@ def _write_carla_project(plugin_name: str, plugin_path: str) -> str:
from xml.sax.saxutils import escape
name = escape(plugin_name or os.path.splitext(os.path.basename(plugin_path))[0])
binary = escape(plugin_path)
# Patchbay: kết nối TỰ ĐỘNG MIDI input + audio output → default speaker.
# Mặc định Carla KHÔNG connect khi load project (chỉ restore connection có
# trong file) → lần đầu mở không có âm, không nhận MIDI (phải unload/load
# lại mới auto-connect như thêm plugin thủ công). Connection nào trỏ tới
# port không tồn tại sẽ bị Carla bỏ qua im lặng → thêm nhiều biến thể tên.
pb_name = name
patchbay = (
" <Patchbay>\n"
# Audio out plugin → loa mặc định (system:playback_1/2)
f" <Connection><Source>{pb_name}:audio_out1</Source><Target>system:playback_1</Target></Connection>\n"
f" <Connection><Source>{pb_name}:audio_out2</Source><Target>system:playback_2</Target></Connection>\n"
# MIDI input → plugin midi_in (biến thể tên client: Carla / carla / system)
f" <Connection><Source>Carla:midi_in</Source><Target>{pb_name}:midi_in</Target></Connection>\n"
f" <Connection><Source>carla:midi_in</Source><Target>{pb_name}:midi_in</Target></Connection>\n"
f" <Connection><Source>system:midi_capture_1</Source><Target>{pb_name}:midi_in</Target></Connection>\n"
" </Patchbay>\n"
)
xml = (
"<?xml version='1.0' encoding='UTF-8'?>\n"
"<!DOCTYPE CARLA-PROJECT>\n"
@@ -688,6 +705,7 @@ def _write_carla_project(plugin_name: str, plugin_path: str) -> str:
" <Options>0x0</Options>\n"
" </Data>\n"
" </Plugin>\n"
+ patchbay +
"</CARLA-PROJECT>\n"
)
try: