From 73a61a96f40cee610edaf2b1915f3d5fe1c38c45 Mon Sep 17 00:00:00 2001 From: JotaChina Date: Thu, 25 Dec 2025 16:28:40 -0300 Subject: [PATCH] melhorando a leitura de projetos no mmpCreator --- assets/js/creations/audio/audio_audio.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/assets/js/creations/audio/audio_audio.js b/assets/js/creations/audio/audio_audio.js index 9b35cc7f..a90fb05c 100755 --- a/assets/js/creations/audio/audio_audio.js +++ b/assets/js/creations/audio/audio_audio.js @@ -250,8 +250,27 @@ function _animationLoop() { const loopDuration = loopEndTimeSec - loopStartTimeSec; newLogicalTime = loopStartTimeSec + ((newLogicalTime - loopStartTimeSec) % loopDuration); + startTime = now; 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 {} } }