feat(05-01): extend activeSessionSlice and sessionUISlice for JamTrack
activeSessionSlice extensions: - Add availableMixdowns array to store mixdown objects - Add activeMixdown for currently selected mixdown - Add mixdownCache for package metadata - Add 4 reducers: setAvailableMixdowns, setActiveMixdown, cacheMixdownPackage, clearMixdowns - Add 3 selectors for mixdown state sessionUISlice extensions: - Add openJamTrack to track currently open JamTrack ID - Add jamTrackUI for user preferences (lastUsedMixdownId, volume) - Add 3 reducers: setOpenJamTrack, updateJamTrackUI, clearOpenJamTrack - Add 2 selectors for JamTrack UI state Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bb74c50462
commit
52ee8f3eab
|
|
@ -63,6 +63,11 @@ const initialState = {
|
|||
// Backing track data (for currently active backing track)
|
||||
backingTrackData: null,
|
||||
|
||||
// Mixdown management (Phase 5)
|
||||
availableMixdowns: [], // Array of mixdown objects: { id, type: 'master'|'custom-mix'|'stem', name, jamTrackId, packageId }
|
||||
activeMixdown: null, // Currently selected mixdown object
|
||||
mixdownCache: {}, // Map of packageId -> { metadata, sampleRate, fileType, encryptType }
|
||||
|
||||
// Recording state
|
||||
recordingState: {
|
||||
isRecording: false,
|
||||
|
|
@ -204,6 +209,25 @@ export const activeSessionSlice = createSlice({
|
|||
state.recordingState.recordedTracks = [];
|
||||
},
|
||||
|
||||
// Phase 5: Mixdown management
|
||||
setAvailableMixdowns: (state, action) => {
|
||||
state.availableMixdowns = action.payload;
|
||||
},
|
||||
|
||||
setActiveMixdown: (state, action) => {
|
||||
state.activeMixdown = action.payload;
|
||||
},
|
||||
|
||||
cacheMixdownPackage: (state, action) => {
|
||||
state.mixdownCache[action.payload.packageId] = action.payload.metadata;
|
||||
},
|
||||
|
||||
clearMixdowns: (state) => {
|
||||
state.availableMixdowns = [];
|
||||
state.activeMixdown = null;
|
||||
state.mixdownCache = {};
|
||||
},
|
||||
|
||||
// Phase 4: Update session data (for partial updates)
|
||||
updateSessionData: (state, action) => {
|
||||
if (state.sessionData) {
|
||||
|
|
@ -287,6 +311,10 @@ export const {
|
|||
stopRecording,
|
||||
addRecordedTrack,
|
||||
clearRecordedTracks,
|
||||
setAvailableMixdowns,
|
||||
setActiveMixdown,
|
||||
cacheMixdownPackage,
|
||||
clearMixdowns,
|
||||
updateSessionData,
|
||||
clearSession
|
||||
} = activeSessionSlice.actions;
|
||||
|
|
@ -316,3 +344,6 @@ export const selectIsRecording = (state) => state.activeSession.recordingState.i
|
|||
export const selectRecordedTracks = (state) => state.activeSession.recordingState.recordedTracks;
|
||||
export const selectActiveSessionLoading = (state) => state.activeSession.loading;
|
||||
export const selectActiveSessionError = (state) => state.activeSession.error;
|
||||
export const selectAvailableMixdowns = (state) => state.activeSession.availableMixdowns;
|
||||
export const selectActiveMixdown = (state) => state.activeSession.activeMixdown;
|
||||
export const selectMixdownCache = (state) => state.activeSession.mixdownCache;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,13 @@ const initialState = {
|
|||
min: null,
|
||||
max: null
|
||||
}
|
||||
},
|
||||
|
||||
// JamTrack UI state (Phase 5)
|
||||
openJamTrack: null, // Currently open JamTrack ID or null
|
||||
jamTrackUI: {
|
||||
lastUsedMixdownId: null, // User's last selected mixdown for this session
|
||||
volume: 100 // Last used volume (0-100)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -155,6 +162,19 @@ export const sessionUISlice = createSlice({
|
|||
state.mixerUI.currentMixerRange = action.payload;
|
||||
},
|
||||
|
||||
// Phase 5: JamTrack UI reducers
|
||||
setOpenJamTrack: (state, action) => {
|
||||
state.openJamTrack = action.payload;
|
||||
},
|
||||
|
||||
updateJamTrackUI: (state, action) => {
|
||||
state.jamTrackUI = { ...state.jamTrackUI, ...action.payload };
|
||||
},
|
||||
|
||||
clearOpenJamTrack: (state) => {
|
||||
state.openJamTrack = null;
|
||||
},
|
||||
|
||||
// Reset UI state (useful when leaving session)
|
||||
resetUI: (state) => {
|
||||
return { ...initialState };
|
||||
|
|
@ -189,6 +209,10 @@ export const {
|
|||
setMixMode,
|
||||
toggleMixMode,
|
||||
setCurrentMixerRange,
|
||||
// Phase 5: JamTrack UI actions
|
||||
setOpenJamTrack,
|
||||
updateJamTrackUI,
|
||||
clearOpenJamTrack,
|
||||
resetUI
|
||||
} = sessionUISlice.actions;
|
||||
|
||||
|
|
@ -220,3 +244,7 @@ export const selectMediaUI = (state) => state.sessionUI.mediaUI;
|
|||
export const selectMixMode = (state) => state.sessionUI.mixerUI.mixMode;
|
||||
export const selectCurrentMixerRange = (state) => state.sessionUI.mixerUI.currentMixerRange;
|
||||
export const selectMixerUI = (state) => state.sessionUI.mixerUI;
|
||||
|
||||
// Phase 5: JamTrack UI selectors
|
||||
export const selectOpenJamTrack = (state) => state.sessionUI.openJamTrack;
|
||||
export const selectJamTrackUI = (state) => state.sessionUI.jamTrackUI;
|
||||
|
|
|
|||
Loading…
Reference in New Issue