melhorando a leitura de projetos no mmpCreator

This commit is contained in:
JotaChina committed 2025-12-25 16:28:40 -03:00
1 parent 2ff26bc493
commit 5c0be96853
1 file changed
+19
+19
View File
@@ -250,8 +250,27 @@ function _animationLoop() {
const loopDuration = loopEndTimeSec - loopStartTimeSec; const loopDuration = loopEndTimeSec - loopStartTimeSec;
newLogicalTime = newLogicalTime =
loopStartTimeSec + ((newLogicalTime - loopStartTimeSec) % loopDuration); loopStartTimeSec + ((newLogicalTime - loopStartTimeSec) % loopDuration);
startTime = now; startTime = now;
appState.audio.audioEditorSeekTime = newLogicalTime; appState.audio.audioEditorSeekTime = newLogicalTime;
// ✅ 1) manter o Tone.Transport em sincronia
try { Tone.Transport.seconds = newLogicalTime; } catch {}
// ✅ 2) permitir reagendamento de clips/patterns
runtimeClipState.clear();
scheduledNodes.forEach(({ player }) => {
try { player.unsync(); } catch {}
try { player.stop(); } catch {}
try { player.dispose(); } catch {}
});
scheduledNodes.clear();
// ✅ 3) reinicia patterns no Transport (se houver scheduleOnce para notes)
try {
stopSongPatternPlaybackOnTransport();
startSongPatternPlaybackOnTransport();
} catch {}
} }
} }