Saving vs auto save

Rack saves patch state as JSON every few seconds, and when the user saves a patch manually. Is there a way in 1.0 to write different data in these two cases?

Plugins with a lot of state disrupt the UI if the JSON write takes too long. Writing all state makes it easier to share patches. What’s the correct approach here?

I think I’m missing something… what you could omit in the autosave case that would still allow the entire patch to be recovered after a crash (for example)?

How long does your plugin take to serialize its state, and why? External files like WAVs should be referenced from an absolute file path.

Maybe it would be a good idea, if the autosave feature could be disabled, or the autosave time could be adjusted, for really big patches, or modules with lots of data.

1 Like

Sounds reasonable. Added "autosavePeriod" to settings.json. Set to 0 to disable autosaving except for when quitting Rack.

1 Like

The plugin can take a half second to serialize, because it is saving a sequence with thousands of notes. The notes came from a MIDI file, which can be arbitrarily large.

My current approach is to save the edit history, so that the current state can be reconstructed from the original MIDI. If autosave gets slow, the user can save to create a new base MIDI file.

The downside to this is that if the user wishes to share their work, they need to include the MIDI files they’ve edited in addition to their VCV patch file. If there was a way to distinguish calls to PatchManager::save(), I could serialize all the data into a single file only when the user is saving patch data.

If you base64 encode 10k MIDI notes, that’s only 40kB, which would only double the filesize of normal patches (since they range around 20-100kB). If it takes half a second to serialize that, there are serious problems with your serialization routine.

My current test file is ELP’s “Tarkus”, which is 178K of MIDI, but I take your point. I will see how far base64 gets me.

this is really great, some software that I used, have this feature (timing for auto save), and even save different versions of the auto save (for different sessions it assigning a random name ) and also save a quit file, (and it allow move from the tmp folder to prevent deletion ) its is very useful to recover data.

1 Like