atualizando em tempo real as patterns no editor de patterns e playlist

This commit is contained in:
JotaChina committed 2025-12-27 15:14:50 -03:00
1 parent 7eeed3ee92
commit 443685ac72
3 files changed
+153 -98

No files matched your search

+7 -15
View File
@@ -61,20 +61,15 @@ function makePatternSnapshot() {
type: t.type,
samplePath: t.samplePath,
// ✅ extras necessários pro Song Editor / playlist
patternIndex: t.patternIndex ?? null,
playlist_clips: Array.isArray(t.playlist_clips)
? t.playlist_clips.map((c) => ({
id: c.id ?? null,
pos: c.pos ?? 0,
len: c.len ?? 192,
name: c.name ?? t.name ?? "Pattern",
}))
: null,
// ✅ mantém compat com a sua estrutura de rack/focus
// ✅ mantém relações do rack/BB
parentBasslineId: t.parentBasslineId ?? null,
instrumentSourceId: t.instrumentSourceId ?? null,
// ✅ mantém playlist patterns (bbtco “em memória”)
playlist_clips: t.playlist_clips ?? null,
patternIndex: Number.isInteger(t.patternIndex) ? t.patternIndex : null,
// estados de mute (você usa ambos em pontos diferentes)
isMuted: t.isMuted ?? false,
muted: t.muted ?? false,
@@ -92,12 +87,9 @@ function makePatternSnapshot() {
})),
activeTrackId: appState.pattern.activeTrackId,
activePatternIndex: appState.pattern.activePatternIndex,
focusedBasslineId: appState.pattern.focusedBasslineId ?? null,
};
}
// ----------------------
// Helper: existe snapshot local com áudio?
// ----------------------