Page 1 of 1

SetStateInformation not firing when no custom info in preset

Posted: Sat Mar 16, 2019 5:19 pm
by AndyMac
I'm wanting to use additional state information to automagically migrate user presets from my custom Log scale knobs to the new Log scales in the designer. However, when testing it in debug mode, the SetStateInformation routine does not appear to fire if there is no custom information stored in the preset.

This is a pretty major issue as there is no way for me to work out whether the module has loaded with a preset in the old form, or initialised completely from scratch (where it will automatically want to use the new log knobs).

Is there a way to get at this information? I have tried a load of workarounds and have found none to actually allow me to work out whether a preset or state has been loaded (which could imply the version). I am trying to understand the initialisation sequence so that I can try to get at whether state has been restored of defaults just used - I can't seem to find any way to even get at this!

A couple of suggestions that would help:
1. ensure, or allow SetStateInformation to fire even when nothing in the custom byte array - devs would need to handle null arrays
2. maybe a simple value that can be queried to get at whether the state has been restored, and from what
3. include some form of build version in the presets as saved - and make this available through the variables for the modules as well

I am going to add the versioning into all modules going forwards, but this still does not help with the migration question.

Re: SetStateInformation not firing when no custom info in preset

Posted: Thu Mar 21, 2019 12:39 am
by CherryRuss
Hi AndyMac.

We've talked this over and decided to send notifications when preset loading begins and ends. Then you can set a boolean flag when preset loading starts and another when SetStateInformation gets called, and if you start getting knob values during the loading process without the SetState flag set, you'll know this is a preset from an older version of the module. Let us know if this won't work for you.

Re: SetStateInformation not firing when no custom info in preset

Posted: Thu Mar 21, 2019 8:18 am
by AndyMac
That's brilliant. This would work for me fine, and seems like a great way to deal with it.
I presume this will be on the backlog for the next release?
Thank you

Re: SetStateInformation not firing when no custom info in preset

Posted: Fri Mar 22, 2019 12:26 am
by CherryRuss
Yes, it should be in the next build. Possibly out next week, depending on how testing goes.

Re: SetStateInformation not firing when no custom info in preset

Posted: Fri Mar 22, 2019 8:13 am
by AndyMac
Brilliant :-)