Memorizing more than only the parameter map in a snapshot

Once you start using lua it’s easy to store values in variables. I guess these however aren’t by default stored in a snapshot (at leadt not when I tried). however, some of them should better be stored as well to allow a snapshot to function correctly. For instance I’m using controls to define the number of polychain voices an instrument can have, but then the actual voices are being stored in tables, as these are not one-to-one with any control value. It would be valuable if there is a way we could define what variables should be stored as well in a snapshot.

1 Like

hmm, that is a very good question / idea. I think that storing of values of every variable would be rather difficult and maybe a bit of an overkill. I can imagine, however, making it possible to store these values in the parameter map and having callback functions that would be triggered when the snapshot is saved and recalled. Then, you could use something like “onSnapshotSave” callback to memorize your data and “onSnapshotLoad” to load the data back and bring the Lua script to a known state. Would that work for your script?

You are reading my mind :smiley:
I just did not dare suggesting it myself.