melhorando a leitura de projetos no mmpCreator
Deploy / Deploy (push) Has been cancelled Details

This commit is contained in:
JotaChina 2025-12-25 13:06:20 -03:00
parent 0ff6235dba
commit 0beb9cddb5
2 changed files with 16 additions and 23 deletions

View File

@ -372,17 +372,9 @@ export async function parseMmpContent(xmlString) {
// 1. Identifica colunas de beat/patterns (usado para mapear steps)
// Normalmente ficam dentro do primeiro container de Bassline
const bbTrackNodes = Array.from(xmlDoc.querySelectorAll('track[type="1"]'));
let sortedBBTrackNameNodes = [];
if (bbTrackNodes.length > 0) {
sortedBBTrackNameNodes = Array.from(
bbTrackNodes[0].querySelectorAll("bbtco")
).sort((a, b) => {
return (
(parseInt(a.getAttribute("pos"), 10) || 0) -
(parseInt(b.getAttribute("pos"), 10) || 0)
);
});
}
// Cada BBTrack do Song Editor representa uma “coluna/pattern” (pos 0, 192, 384...)
// então usamos o próprio array de BBTracks para nomear as patterns:
const sortedBBTrackNameNodes = bbTrackNodes;
// -------------------------------------------------------------
// 2. EXTRAÇÃO DE INSTRUMENTOS DA RAIZ (SONG EDITOR)

View File

@ -636,11 +636,11 @@ document.addEventListener("DOMContentLoaded", () => {
appState.pattern.focusedBasslineId = basslineTrack.id;
// 🔥 chave: sincroniza a coluna/pattern com o BBTrack escolhido
if (Number.isInteger(basslineTrack.patternIndex)) {
appState.pattern.activePatternIndex = basslineTrack.patternIndex;
// fonte de verdade: aplica em TODAS as tracks (samplers/plugins)
sendAction({ type: "SET_ACTIVE_PATTERN", patternIndex: basslineTrack.patternIndex });
// opcional: manter o selector UI consistente (se existir)
// opcional: manter selector sincronizado
const sel = document.getElementById("global-pattern-selector");
if (sel) sel.value = String(basslineTrack.patternIndex);
}
@ -650,6 +650,7 @@ document.addEventListener("DOMContentLoaded", () => {
};
window.exitPatternFocus = function() {
console.log("Saindo do foco da Bassline");
appState.pattern.focusedBasslineId = null;