Using pattrstorage to save and load patch states
I'm currently attempting to learn how to use the [pattr] and [pattrstorage] objects to save and load the values/settings of objects in my patch.
Below is a very stripped down example of what i'm trying to do, but I don't think I've got the hang of how pattr works, as it doesn't seem to be working how I want it to. Basically, in the example, I want to be able to change the value of the number boxes, save/write the values/settings into an external file, and then at a later point load/read these values back into the correct number boxes.
As far as I can tell I'm managing to write the values into a .json file fine, but when I read the file using the [pattrstorage] object it doesn't put the saved values back into the number boxes.
What am I currently doing wrong? How can I implement this?
You're 50% of the way there.
Each pattrstorage 'preset' file is composed of 'slots', where each slot represents a state/preset of the pattr system in your patcher.
You'll want to 'store' a slot before saving your preset file, and 'recall' a slot (typically the first slot, i.e. slot 1) after loading a preset file.
The patch below shows this, including a trick using the 'read' message sent out of pattrstorage to only load a slot once the file read operation has completed
Thats just what I was after thanks!
Is a 'slot' the same as a dot on the 'preset' object?
Since posting this question I managed to get what I wanted working with the [preset] object, but I think your methods is better.