melhorando a leitura de projetos no mmpCreator
This commit is contained in:
1 parent
a9c716f037
commit
a3b8268f96
2 files changed
+7
-14
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user