SliderPack for variables storage: strange behaviour
-
@d-healey said in SliderPack for variables storage: strange behaviour:
Try assigning a control callback to the sliderpack and get the value in there instead of in on init.
Thanks a lot David. I thought about the SliderPack custom callback, but I should have specified that the only reason the SliderPack is there is because to store data (in the real script it will be invisible). Should I create the callback regardless of the user interaction?
PS: yes, I'm coming from there! :)
-
@Giuseppe said in SliderPack for variables storage: strange behaviour:
Should I create the callback regardless of the user interaction?
Yes
@Giuseppe said in SliderPack for variables storage: strange behaviour:
PS: yes, I'm coming from there! :)
Your code now makes sense :) I was there too when I first started.
-
@d-healey thanks again, will give it a try tomorrow!
-
@d-healey said in SliderPack for variables storage: strange behaviour:
Yes
Update: I just stored the variables in two separate Sliders instead of SliderPacks and it works. It's the SliderPack having this init behaviour for some reasons.
Will try to store the values into a numeric array because having a bunch of knobs just for variable persistence sounds a bit tedious. -
@Giuseppe New update: no matter what widget I use and/or control callback assigned to it, Hise just won't recall the saved value when launched, A new compile or an interaction with the UI is required to restore those values I need to be persistent.
I'm obviously doing something wrong, but honestly what's the best way to store a value that needs to be recalled at launch? Is using widgets a good solution or is there something that simply makes a variable persistent? -
@Giuseppe said in SliderPack for variables storage: strange behaviour:
Is using widgets a good solution
It's pretty much the only solution
-
@d-healey ok, but given that Hise can't read the numeric value of a given widget until an UI event happens or a new compile is launched, how does one solve the issue?
Say I want to print the value of a given widget at launch, where should I put the Console.print() line?
What I'm trying to understand is how Hise handles the variables storage. -
@Giuseppe said in SliderPack for variables storage: strange behaviour:
where should I put the Console.print() line?
In the component's control callback - the component must have saveInPreset enabled.
What I'm trying to understand is how Hise handles the variables storage.
Only component values are saved/restored, not variables.
-
@Giuseppe Thanks David. It's starting to make sense :)
-
@Giuseppe Also:
ScriptSliderPack.getDataAsBuffer()
.