fix(ui): wire Synth button to VST3 selection and render engine

- UI: setTrackInstrumentWithProgram stores instrumentId + enables MIDI type
- UI: SoundFont preset selection now passes soundfont_bank to server
- Server: render_engine reads instrument_id field (fallback instrument)
- Serialize/deserialize: soundfont_bank, soundfont_program preserved
- Rebuilt app.precompiled.js from app.jsx
This commit is contained in:
2026-07-26 16:25:26 +07:00
parent 3e805179c2
commit 2ab989132b
4 changed files with 20 additions and 8 deletions
+10 -4
View File
@@ -6130,6 +6130,8 @@ const serializeTracksList = (tracksList, secondsPerBar) => {
instrument_id: t.instrumentId || null,
instrument_program: t.instrumentProgram !== undefined ? t.instrumentProgram : null,
instrument_name: t.instrumentName || null,
soundfont_bank: t.soundfont_bank !== undefined ? t.soundfont_bank : null,
soundfont_program: t.soundfont_program !== undefined ? t.soundfont_program : null,
items: items
};
});
@@ -6196,7 +6198,9 @@ const deserializeTracksList = (schemaTracks, secondsPerBar, sectionStore) => {
midiItems: midiItems,
instrumentId: t.instrument_id || null,
instrumentProgram: t.instrument_program !== null ? t.instrument_program : undefined,
instrumentName: t.instrument_name || null
instrumentName: t.instrument_name || null,
soundfont_bank: t.soundfont_bank !== null ? t.soundfont_bank : undefined,
soundfont_program: t.soundfont_program !== null ? t.soundfont_program : undefined
};
});
};
@@ -6483,10 +6487,12 @@ const App = () => {
"Tinkle Bell","Agogo","Steel Drums","Woodblock","Taiko Drum","Melodic Tom","Synth Drum","Reverse Cymbal",
"Guitar Fret Noise","Breath Noise","Seashore","Bird Tweet","Telephone Ring","Helicopter","Applause","Gunshot"
];
const setTrackInstrumentWithProgram = (trackId, instrumentId, programNumber, displayName) => {
const setTrackInstrumentWithProgram = (trackId, instrumentId, programNumber, displayName, bankNumber) => {
updateActiveTracks(prev => prev.map(t => {
if (t.id !== trackId) return t;
return { ...t, instrumentId, instrumentProgram: programNumber !== undefined ? programNumber : undefined, instrumentName: displayName };
const hasInstrument = !!instrumentId;
const isSfInstrument = instrumentId && typeof instrumentId === 'string' && instrumentId.startsWith('sf_');
return { ...t, instrumentId, instrumentProgram: programNumber !== undefined ? programNumber : undefined, instrumentName: displayName, soundfont_bank: bankNumber !== undefined ? bankNumber : (isSfInstrument ? 0 : undefined), soundfont_program: programNumber !== undefined ? programNumber : undefined, type: hasInstrument ? 'MIDI' : (t.type === 'MIDI' ? 'audio' : t.type) };
}));
setInstrumentDropdownTrackId(null);
setInstrumentDropdownBtnRect(null);
@@ -16839,7 +16845,7 @@ const App = () => {
React.createElement("div", { className: "grid grid-cols-2 gap-0.5" },
sfPresets.map((p, i) => React.createElement("button", {
key: i,
onClick: () => setTrackInstrumentWithProgram(instrumentSelectorTrackId, selectedSoundFontId, p.program, p.name || 'Preset ' + p.program),
onClick: () => setTrackInstrumentWithProgram(instrumentSelectorTrackId, selectedSoundFontId, p.program, p.name || 'Preset ' + p.program, p.bank),
className: "text-left px-2 py-1 text-[10px] rounded bg-zinc-800/60 hover:bg-amber-800 text-zinc-300 truncate"
}, p.name || 'Preset ' + p.program)
))