melhorando a leitura de projetos no mmpCreator
Deploy / Deploy (push) Successful in 2m9s Details

This commit is contained in:
JotaChina 2025-12-25 16:01:06 -03:00
parent 1a0436d4bb
commit 4d2468b12d
1 changed files with 4 additions and 2 deletions

View File

@ -977,6 +977,8 @@ async function handleActionBroadcast(action) {
}); });
try { try {
const stepsPerBar = 16; // 4/4 em 1/16
const maxSteps = appState.pattern.tracks const maxSteps = appState.pattern.tracks
.filter(t => t.type !== "bassline") .filter(t => t.type !== "bassline")
.map(t => t.patterns?.[patternIndex]?.steps?.length || 0) .map(t => t.patterns?.[patternIndex]?.steps?.length || 0)
@ -984,11 +986,11 @@ async function handleActionBroadcast(action) {
const barsEl = document.getElementById("bars-input"); const barsEl = document.getElementById("bars-input");
if (barsEl && maxSteps > 0) { if (barsEl && maxSteps > 0) {
// assumindo 16 steps por compasso (4/4 em 1/16) barsEl.value = Math.max(1, Math.ceil(maxSteps / stepsPerBar));
barsEl.value = Math.max(1, Math.ceil(maxSteps / 16));
} }
} catch {} } catch {}
// Mostra o toast (só uma vez) // Mostra o toast (só uma vez)
if (!isFromSelf) { if (!isFromSelf) {
const who = actorOf(action); const who = actorOf(action);