fix: brush draw preview note uses wrong instrument

Line 5273 called playNote with undefined program + no channel,
defaulting to channel 0 with last-set instrument (may be Track 2's).
Fix: resolve parent track from st.trackId, pass correct channel
and synth_engine/instrumentProgram.
This commit is contained in:
2026-07-27 20:52:49 +07:00
parent b42190e6bc
commit e38391ac7d
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -5270,7 +5270,9 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
// Play the note with SoundFont
if (window.SonicSF) {
const ctx = getAudioContext();
window.SonicSF.playNote(pitch, 0.8, 300, ctx.currentTime, undefined, null);
var dwTrk = activeTracks.find(function(t) { return t.id === st.trackId; });
var dwCh = window.SonicPianoRoll ? window.SonicPianoRoll.getTrackMidiChannel(dwTrk, activeTracks) : (dwTrk ? dwTrk.midiChannel : 0);
window.SonicSF.playNote(pitch, 0.8, 300, ctx.currentTime, dwTrk ? dwTrk.instrumentProgram : undefined, null, dwCh, dwTrk ? dwTrk.synth_engine : undefined);
}
}
};
File diff suppressed because one or more lines are too long