From 4d2468b12da9f43bd52c364e0a69ec9d92073384 Mon Sep 17 00:00:00 2001 From: JotaChina Date: Thu, 25 Dec 2025 16:01:06 -0300 Subject: [PATCH] melhorando a leitura de projetos no mmpCreator --- assets/js/creations/socket.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/js/creations/socket.js b/assets/js/creations/socket.js index 60609a5e..1ba8ef2d 100755 --- a/assets/js/creations/socket.js +++ b/assets/js/creations/socket.js @@ -977,6 +977,8 @@ async function handleActionBroadcast(action) { }); try { + const stepsPerBar = 16; // 4/4 em 1/16 + const maxSteps = appState.pattern.tracks .filter(t => t.type !== "bassline") .map(t => t.patterns?.[patternIndex]?.steps?.length || 0) @@ -984,11 +986,11 @@ async function handleActionBroadcast(action) { const barsEl = document.getElementById("bars-input"); if (barsEl && maxSteps > 0) { - // assumindo 16 steps por compasso (4/4 em 1/16) - barsEl.value = Math.max(1, Math.ceil(maxSteps / 16)); + barsEl.value = Math.max(1, Math.ceil(maxSteps / stepsPerBar)); } } catch {} + // Mostra o toast (só uma vez) if (!isFromSelf) { const who = actorOf(action);