Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autosave #374

Merged
merged 6 commits into from
Feb 15, 2025
Merged

Autosave #374

merged 6 commits into from
Feb 15, 2025

Conversation

maks
Copy link
Collaborator

@maks maks commented Feb 12, 2025

Implements auto save functionality where project data file is autosaved every X period (currently 2min) to a backup file within the project directory. Note that autosaves will not occur while the sequencer is running but that time is taken into account, so autosave will then usually trigger immediately after sequencer is stopped.

This autosave data file is deleted each time there is an explicit project save operation done by the user. Thus when a project is loaded, if an autosave data file exists, it means it supercedes the last explicit save to the project data file and so the autosave file should be loaded in preference to it.

I also took the opportunity to update docs with initial explanations about the mainloop and clock tick event handling.

Fixes: #371

@maks maks requested a review from democloid February 12, 2025 07:25
Copy link
Collaborator

@democloid democloid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, but to me there is a big gap in potential intent of what the user might want to do here and may be problematic.

If I load a file and mess around, an autosave happens, then I'm fucked, no way to scrap the changes.

To me there are three things that are important:

  1. If the file was loaded from autosave, it needs to be explicitly be noted in the name of the project when loaded
  2. If I save my project and no changes happen after that, then autosave should not happen (otherwise file will be marked as loaded from autosave when the last time I used it I saved and didn't change anything else)
  3. If I explicitly load the project, it should load from my saved file. (I save before messing around with the project and testing some things, but then want to go back to my saved version)

In essence the way this is working today is that there is no difference between autosaved file and explicitly saved, since we cannot choose one or the other. If you autosaved to the normal save file functionality would be the same.

@maks
Copy link
Collaborator Author

maks commented Feb 14, 2025

Ok, as discussed offline: an explicit project load via the project screen will now load the last explicitly saved project data (lgptsav.dat) while onboot the last autosave file will be loaded unless its not available, in which case the project data file will be loaded.

The user manual has also been updated to explain the new autosave functionality from a users point of view.

@maks maks requested a review from democloid February 14, 2025 01:48
Copy link
Collaborator

@democloid democloid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I cannot see where the changes are to being able to load the saved project as opposed to the autosave file. Am I missing it?

It seems the load function will always load the autosave file if it exists.

@maks
Copy link
Collaborator Author

maks commented Feb 15, 2025

Sorry, but I cannot see where the changes are to being able to load the saved project as opposed to the autosave file. Am I missing it?

It seems the load function will always load the autosave file if it exists.

it works by removing the autosave just before rebooting to load the project (calling ClearAutoSave())

@maks maks merged commit 76dedf0 into master Feb 15, 2025
1 check passed
@maks maks deleted the 371-autosave branch February 15, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto save project file
2 participants