criação de novas patterns de composição nos projetos

This commit is contained in:
JotaChina committed 2025-12-27 18:50:36 -03:00
1 parent f80d6511a4
commit 2d40bf747f
3 files changed
+118 -23

No files matched your search

+22 -22
View File
@@ -544,31 +544,31 @@ export async function parseMmpContent(xmlString) {
const basslineContainers = bbTrackNodes
.map((trackNode, idx) => {
const trackName = trackNode.getAttribute("name") || "Beat/Bassline";
const playlistClips = Array.from(
trackNode.querySelectorAll(":scope > bbtco")
).map((bbtco) => ({
pos: parseInt(bbtco.getAttribute("pos"), 10) || 0,
len: parseInt(bbtco.getAttribute("len"), 10) || 192,
name: trackName,
}));
// ❌ remove esta linha:
// if (playlistClips.length === 0) return null;
// ✅ mantém mesmo vazia
const playlistClips = Array.from(trackNode.querySelectorAll(":scope > bbtco")).map((bbtco, cidx) => {
const pos = parseInt(bbtco.getAttribute("pos"), 10) || 0;
const len = parseInt(bbtco.getAttribute("len"), 10) || 192;
return {
id: `bassline_${Date.now()}_${Math.random().toString(36).slice(2)}`,
id: `plc_${idx}_${pos}_${len}_${cidx}`, // determinístico
pos,
len,
name: trackName,
type: "bassline",
playlist_clips: playlistClips, // pode ser []
patternIndex: idx,
instrumentSourceId: rackId,
volume: 1,
pan: 0,
patterns: [],
isMuted: trackNode.getAttribute("muted") === "1",
};
});
// NÃO retornar null quando não tem clips:
return {
id: `bb_container_${idx}`,
name: trackName,
type: "bassline",
patternIndex: idx,
playlist_clips: playlistClips, // pode ser []
patterns: [],
isMuted: false,
instrumentSourceId: bbRackId, // ou algo equivalente no teu parse
volume: 1,
pan: 0,
};
})
.filter(Boolean);