fix: sfBank/sfProg ReferenceError — move declarations outside closure
This commit is contained in:
@@ -6501,12 +6501,12 @@ const App = () => {
|
||||
"Guitar Fret Noise","Breath Noise","Seashore","Bird Tweet","Telephone Ring","Helicopter","Applause","Gunshot"
|
||||
];
|
||||
const setTrackInstrumentWithProgram = (trackId, instrumentId, programNumber, displayName, bankNumber) => {
|
||||
const isSfInstrument = instrumentId && typeof instrumentId === 'string' && instrumentId.startsWith('sf_');
|
||||
const sfBank = bankNumber !== undefined ? bankNumber : (isSfInstrument ? 0 : undefined);
|
||||
const sfProg = programNumber !== undefined ? programNumber : undefined;
|
||||
updateActiveTracks(prev => prev.map(t => {
|
||||
if (t.id !== trackId) return t;
|
||||
const hasInstrument = !!instrumentId;
|
||||
const isSfInstrument = instrumentId && typeof instrumentId === 'string' && instrumentId.startsWith('sf_');
|
||||
const sfBank = bankNumber !== undefined ? bankNumber : (isSfInstrument ? 0 : undefined);
|
||||
const sfProg = programNumber !== undefined ? programNumber : undefined;
|
||||
const instrType = isSfInstrument ? 'soundfont' : (hasInstrument ? 'vst3' : 'default');
|
||||
const synthEngine = hasInstrument ? {
|
||||
type: instrType,
|
||||
@@ -6523,7 +6523,7 @@ const App = () => {
|
||||
setSynthCategory(null);
|
||||
setSelectedSoundFontId(null);
|
||||
// Trigger SpessaSynth load + program change when soundfont instrument selected
|
||||
if (window.SonicSF && window.SonicSF.selectInstrument && instrumentId && typeof instrumentId === 'string' && instrumentId.startsWith('sf_')) {
|
||||
if (window.SonicSF && window.SonicSF.selectInstrument && instrumentId && isSfInstrument) {
|
||||
const sfId = instrumentId.replace('sf_', '');
|
||||
const ch = sfBank === 128 ? 9 : 0;
|
||||
window.SonicSF.selectInstrument(ch, sfBank || 0, sfProg || 0, sfId);
|
||||
|
||||
Reference in New Issue
Block a user