diff --git a/src/app/App.tsx b/src/app/App.tsx index 9e2e9ec3..7ea6450d 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -4140,6 +4140,39 @@ export function App({ store, initialStatusMessage }: AppProps) { } }; + const applyProjectSequencerState = ( + nextScheduler: typeof editorState.projectDocument.scheduler, + nextSequences: ProjectSequenceLibrary, + label: string, + successMessage: string + ) => { + if ( + areProjectSchedulersEqual( + editorState.projectDocument.scheduler, + nextScheduler + ) && + areProjectSequenceLibrariesEqual( + editorState.projectDocument.sequences, + nextSequences + ) + ) { + return; + } + + try { + store.executeCommand( + createSetProjectSequencerCommand({ + label, + scheduler: nextScheduler, + sequences: nextSequences + }) + ); + setStatusMessage(successMessage); + } catch (error) { + setStatusMessage(getErrorMessage(error)); + } + }; + const updateProjectDialogues = ( label: string, successMessage: string, @@ -4172,6 +4205,33 @@ export function App({ store, initialStatusMessage }: AppProps) { } }; + const updateProjectSequencerState = ( + label: string, + successMessage: string, + mutate: ( + scheduler: typeof editorState.projectDocument.scheduler, + sequences: ProjectSequenceLibrary + ) => void + ) => { + try { + const nextScheduler = cloneProjectScheduler( + editorState.projectDocument.scheduler + ); + const nextSequences = cloneProjectSequenceLibrary( + editorState.projectDocument.sequences + ); + mutate(nextScheduler, nextSequences); + applyProjectSequencerState( + nextScheduler, + nextSequences, + label, + successMessage + ); + } catch (error) { + setStatusMessage(getErrorMessage(error)); + } + }; + const updateProjectTimeSettings = ( label: string, successMessage: string,