fix: MIDI tab real-time instrument change - restart playback
This commit is contained in:
@@ -6445,6 +6445,17 @@ const App = () => {
|
||||
if (s.trackId !== trackId) return s;
|
||||
return { ...s, instrumentProgram: programNumber !== undefined ? programNumber : undefined, instrumentName: displayName, instrumentId };
|
||||
}));
|
||||
const playingSub = subTabs.find(s => s.trackId === trackId && s.type === 'PIANO_ROLL' && s.isPlaying);
|
||||
if (playingSub) {
|
||||
stopAllPlayback();
|
||||
setTimeout(() => {
|
||||
const context = getAudioContext();
|
||||
startOffsetTimeRef.current = playingSub.currentTime || 0;
|
||||
startAudioTimeRef.current = context.currentTime;
|
||||
schedulePianoRollMidi(playingSub, playingSub.currentTime || 0);
|
||||
startSubTabPlayback(playingSub, playingSub.currentTime || 0);
|
||||
}, 50);
|
||||
}
|
||||
setTimeout(() => lucide.createIcons(), 50);
|
||||
};
|
||||
const setTrackInstrument = (trackId, instrumentId, displayName) => {
|
||||
|
||||
Reference in New Issue
Block a user