private void ProjectCleanup() { var props = dialog.GetPropertyPage((int)TransformOperation.ProjectCleanup); var deleteUnusedInstruments = props.GetPropertyValue <bool>(0); var mergeIdenticalInstruments = props.GetPropertyValue <bool>(1); var unassignUnusedSamples = props.GetPropertyValue <bool>(2); var deleteUnusedSamples = props.GetPropertyValue <bool>(3); var applyAllSamplesProcessing = props.GetPropertyValue <bool>(4); var deleteUnusedArpeggios = props.GetPropertyValue <bool>(5); if (mergeIdenticalInstruments || deleteUnusedInstruments || unassignUnusedSamples || deleteUnusedSamples || applyAllSamplesProcessing || deleteUnusedArpeggios) { app.UndoRedoManager.BeginTransaction(TransactionScope.Project); CleaningUp?.Invoke(); if (deleteUnusedInstruments) { app.Project.DeleteUnusedInstruments(); } if (mergeIdenticalInstruments) { app.Project.MergeIdenticalInstruments(); } if (unassignUnusedSamples) { app.Project.UnmapUnusedSamples(); } if (deleteUnusedSamples) { app.Project.DeleteUnmappedSamples(); } if (applyAllSamplesProcessing) { app.Project.PermanentlyApplyAllSamplesProcessing(); } if (deleteUnusedArpeggios) { app.Project.DeleteUnusedArpeggios(); } app.UndoRedoManager.EndTransaction(); } }
private void SongCleanup() { var props = dialog.GetPropertyPage((int)TransformOperation.SongCleanup); var songIds = GetSongIds(props.GetPropertyValue <bool[]>(3)); var mergeIdenticalPatterns = props.GetPropertyValue <bool>(0); var deleteEmptyPatterns = props.GetPropertyValue <bool>(1); var reduceNoteLengths = props.GetPropertyValue <bool>(2); if (songIds.Length > 0 && (mergeIdenticalPatterns || deleteEmptyPatterns || reduceNoteLengths)) { app.UndoRedoManager.BeginTransaction(TransactionScope.Project); CleaningUp?.Invoke(); foreach (var songId in songIds) { app.Project.GetSong(songId).DeleteNotesPastMaxInstanceLength(); } if (reduceNoteLengths) { foreach (var songId in songIds) { app.Project.GetSong(songId).SetNoteDurationToMaximumLength(); } } if (mergeIdenticalPatterns) { foreach (var songId in songIds) { app.Project.GetSong(songId).MergeIdenticalPatterns(); } } if (deleteEmptyPatterns) { foreach (var songId in songIds) { app.Project.GetSong(songId).DeleteEmptyPatterns(); } } app.UndoRedoManager.EndTransaction(); } }
public void OnCleanup() { CleaningUp?.Invoke(); }