plugin v1.0.1
This commit is contained in:
1 parent
7dd21b5ddc
commit
82e1ff025a
3 files changed
+71
-46
No files matched your search
@@ -314,11 +314,11 @@ export async function parseMmpContent(xmlString) {
|
||||
console.log("Restaurando estado temporário da sessão...");
|
||||
const tempState = JSON.parse(tempStateJSON);
|
||||
|
||||
// 1. Restaura Pattern (código que já existia)
|
||||
appState.pattern.tracks.forEach((liveTrack) => {
|
||||
const savedTrack = tempState.pattern.tracks.find(
|
||||
(t) => t.id === liveTrack.id
|
||||
);
|
||||
|
||||
if (savedTrack) {
|
||||
liveTrack.name = savedTrack.name;
|
||||
liveTrack.patterns = savedTrack.patterns;
|
||||
@@ -335,14 +335,33 @@ export async function parseMmpContent(xmlString) {
|
||||
}
|
||||
});
|
||||
|
||||
// Filtra tracks deletadas
|
||||
appState.pattern.tracks = appState.pattern.tracks.filter((liveTrack) =>
|
||||
tempState.pattern.tracks.some((t) => t.id === liveTrack.id)
|
||||
);
|
||||
|
||||
// 2. 🔥 FIX: Restaura Áudio (Clips e Tracks)
|
||||
if (tempState.audio) {
|
||||
console.log("Restaurando faixas de áudio e clips...");
|
||||
appState.audio.tracks = tempState.audio.tracks || [];
|
||||
appState.audio.clips = tempState.audio.clips || [];
|
||||
}
|
||||
|
||||
// 3. Restaura Global
|
||||
document.getElementById("bpm-input").value = tempState.global.bpm;
|
||||
document.getElementById("compasso-a-input").value = tempState.global.compassoA;
|
||||
document.getElementById("compasso-b-input").value = tempState.global.compassoB;
|
||||
document.getElementById("bars-input").value = tempState.global.bars;
|
||||
|
||||
if (tempState.global.syncMode) {
|
||||
appState.global.syncMode = tempState.global.syncMode;
|
||||
// Atualiza visual do botão sync se existir (pode precisar disparar evento ou fazer manual)
|
||||
const syncBtn = document.getElementById("sync-mode-btn");
|
||||
if (syncBtn) {
|
||||
syncBtn.classList.toggle("active", tempState.global.syncMode === "global");
|
||||
syncBtn.textContent = tempState.global.syncMode === "global" ? "Global" : "Local";
|
||||
}
|
||||
}
|
||||
|
||||
appState.pattern.activeTrackId = tempState.pattern.activeTrackId;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user