FIX: sửa lỗi không load soundfont trên window, MIDI item không play được qua carla

This commit is contained in:
2026-08-10 10:50:02 +07:00
parent 1db892bb99
commit 1cf5b18492
5 changed files with 87 additions and 38 deletions
+10
View File
@@ -75,6 +75,16 @@ window.SonicCarlaMidi = window.SonicCarlaMidi || {
return String(se.type || '').indexOf('vst') !== -1 && !!se.plugin_id;
} catch (e) { return false; }
},
// Playback MIDI items: route khi track VSTi + Carla local (không cần ARM —
// user đã chủ động bấm Play trên item đó).
shouldRoutePlayback: function (synthEngine) {
try {
var c = window.SonicRuntime && window.SonicRuntime.capabilities;
if (!c || !c.features || !c.features.carla_local) return false;
var se = synthEngine || {};
return String(se.type || '').indexOf('vst') !== -1 && !!se.plugin_id;
} catch (e) { return false; }
},
noteOn: function (channel, note, velocity) {
if (!window.SonicAPI || !window.SonicAPI.carlaMidi) return;
window.SonicAPI.carlaMidi({ event: 'note_on', note: note, velocity: velocity || 100, channel: channel || 0 }).catch(function () {});