editando patterns na playlist

This commit is contained in:
JotaChina committed 2025-12-27 12:12:22 -03:00
1 parent ec772ad8aa
commit ef499e3df9
6 files changed
+234 -5

No files matched your search

+25 -1
View File
@@ -31,7 +31,9 @@ const globalState = {
loopStartTime: 0,
loopEndTime: 8,
resizeMode: "trim",
selectedClipId: null,
selectedClipId: null,
selectedPlaylistClipId: null,
selectedPlaylistPatternIndex: null,
isRecording: false,
clipboard: null,
lastRulerClickTime: 0,
@@ -58,6 +60,24 @@ function makePatternSnapshot() {
name: t.name,
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
parentBasslineId: t.parentBasslineId ?? null,
instrumentSourceId: t.instrumentSourceId ?? null,
isMuted: t.isMuted ?? false,
muted: t.muted ?? false,
patterns: (t.patterns || []).map((p) => ({
name: p.name,
steps: p.steps,
@@ -72,10 +92,12 @@ function makePatternSnapshot() {
})),
activeTrackId: appState.pattern.activeTrackId,
activePatternIndex: appState.pattern.activePatternIndex,
focusedBasslineId: appState.pattern.focusedBasslineId ?? null,
};
}
// ----------------------
// Helper: existe snapshot local com áudio?
// ----------------------
@@ -137,6 +159,8 @@ export function resetProjectState() {
loopEndTime: 8,
resizeMode: "trim",
selectedClipId: null,
selectedPlaylistClipId: null,
selectedPlaylistPatternIndex: null,
isRecording: false,
clipboard: null,
lastRulerClickTime: 0,