Restoring a number from mslider on patch load with pattr
Hey all,
I've been getting into Max over the past couple of months and I decided to build a silly M4L utility device as a break from a synth I'm working on. The device is meant to sit on the master chain in the user's template set in Live, counting the total amount of time they have spent in the project, as well as their total 'lifetime' hours in Live.
I am using the text object to store a file called "lifetime_seconds.txt" in the same path as the device. When the patcher loads, it sets the lifetime counter object to the last saved value in the text file before the metro starts. When the patcher closes, the new lifetime value is written to the text file. This works as I expected, and the device can keep track of the lifetime seconds between different instances/projects.
I tried to use the same approach for the 'project' seconds, using pattr instead of text so the value is stored with the project, not the device. When the patcher loads, a bang is sent to a pattr object which is bound to the mslider that receives the project seconds. This does not work - it seems that my pattr values aren't being saved with the project, or my patcher isn't able to access them when it loads. I am very new to pattr and Max in general so I appreciate I may be missing something obvious here.
I have attached a simplified version of the patch below.
Cheers
Not an expert either, but shouldn't adding pattrstorage a savemode attribute (@savemode 3, for instance), be the solution ?
Thanks, that's done the trick! Changing the savemode attribute didn't do it on its own, but I realised I also needed parameter mode to be enabled on my pattr/pattrstorage objects.