feat: VSTi live playback 100% client-side (không Carla) — autosample SF2 backend (pedalboard) → FluidSynth WASM qua masterBus → mastering → main out; SonicVstiAutosample ensure+dedup+cooldown; runtime gating __enableCarlaLivePlayback; âm bắt qua ensureMidiCapture → clientSideExport

This commit is contained in:
2026-08-11 14:28:42 +07:00
parent 7293d7ac7e
commit cadb5402a3
12 changed files with 676 additions and 44 deletions
+10 -1
View File
@@ -198,7 +198,7 @@ const isSfTrackEngine = (se) => {
};
const isVstTrackEngine = (se) => !!se && String(se.type || '').indexOf('vst') !== -1;
// Track dùng VSTi + Carla local route Carla (native GUI, realtime).
const shouldRouteCarla = (se) => !!(window.SonicCarlaMidi && window.SonicCarlaMidi.shouldRoutePlayback(se));
const shouldRouteCarla = () => false; // live playback 100% client (SF2 autosampled WASM) không route Carla
// Native soundfont preview (standalone)
// Render 1 note bng backend native FluidSynth (pyfluidsynth) play WAV.
@@ -15492,6 +15492,11 @@ const App = () => {
setInstrumentDropdownTrackId(null);
setInstrumentDropdownBtnRect(null);
setSynthCategory(null);
// VSTi live playback: pre-warm autosample (SF2 backend) note đu không b
// delay (SonicSF cũng ensure lazily trong _playNoteFluid nếu chưa có).
if (window.SonicVstiAutosample && instrumentId && !isSfInstrument) {
window.SonicVstiAutosample.ensure({ plugin_id: instrumentId, type: 'vst3' });
}
// Trigger FluidSynth load + program change when soundfont instrument selected
if (window.SonicSF && window.SonicSF.selectInstrument && instrumentId && isSfInstrument) {
const sfId = instrumentId.replace('sf_', '');
@@ -16398,6 +16403,10 @@ const App = () => {
return;
}
updateActiveTracks(prev => prev.map(t => t.id === trackId ? { ...t, synth_engine: { ...(t.synth_engine || {}), preset_id: presetId } } : t));
// Autosample li theo preset mi (key khác) live playback dùng âm preset
if (window.SonicVstiAutosample && se.plugin_id) {
window.SonicVstiAutosample.ensure({ plugin_id: se.plugin_id, preset_id: presetId, type: 'vst3' });
}
setInstrumentDropdownTrackId(null);
setInstrumentDropdownBtnRect(null);
var p = ((window.SonicRuntime && window.SonicRuntime.presets) || []).find(function (x) { return x.id === presetId; });