Struggling to save state

dhjdhjdhj's icon

Based on the tutorial I saw on basic use of pattrstorage and autopattr, I tried again to create a test example (see attached patch) that can just save the state of the dials when the patcher is closed and reload the values when the patcher is opened again.

I must be missing something very basic but surely there ought to be a way to make this work. Would appreciate any insights. This is the only thing preventing me from finishing my project using Max for my live performances.

Max Patch
Copy patch and select New From Clipboard in Max.

Many thanks

dhjdhjdhj's icon

Anyone know what I did wrong?

AudioLemon's icon

Hello,

Max Patch
Copy patch and select New From Clipboard in Max.

I used the message store instead of write and it seems to work. I put a del after the loadbang to give the patch time to do it's thing before reloading the patch. There are better ways I am sure but at least it works.

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

You weren't saving into a slot of the pattrstorage and reloading This saves into slot 1, and restores that when re-opening. the savemode attribute is set to autosave.

dhjdhjdhj's icon

Chris, thank you for the patch but unfortunately, it does not work --- at least not on my Max 6 environment.

I replaced my patch with your version and saved it. I then changed the dial positions and just closed the patcher. When I opened it again, the dials did not reflect my changes.

dhjdhjdhj's icon

@grizzle Your patch works but I get prompted to save the json data every time I close the patch after I make a change.

My goal is that any changes I make are just silently saved and reloaded.

dhjdhjdhj's icon

However, if I insert the [delay] into the loadbang of Chris's patch, then it DOES work (yay) --- so the combination of both answers seems to address the problem.