fix: restore isPlaying after stopAllPlayback on instrument change

This commit is contained in:
2026-07-26 11:13:50 +07:00
parent 6926c79357
commit 90ca8f484b
3 changed files with 6 additions and 1 deletions
+5
View File
@@ -6447,6 +6447,7 @@ const App = () => {
}));
const playingSub = subTabs.find(s => s.trackId === trackId && s.type === 'PIANO_ROLL' && s.isPlaying);
if (playingSub) {
const pid = playingSub.id;
stopAllPlayback();
setTimeout(() => {
const context = getAudioContext();
@@ -6456,6 +6457,10 @@ const App = () => {
startBufferOffsetRef.current = offset * (playingSub.speed || 1.0);
schedulePianoRollMidi(playingSub, offset);
startSubTabPlayback(playingSub, offset);
setSubTabs(prev => prev.map(s => s.id === pid ? { ...s, isPlaying: true } : s));
if (subTabsRef.current) {
subTabsRef.current = subTabsRef.current.map(s => s.id === pid ? { ...s, isPlaying: true } : s);
}
animationFrameIdRef.current = requestAnimationFrame(updatePlayhead);
}, 50);
}