store user preset to an object?
-
Is it possible to store "saveUserPreset()" as a temporary object instead of a file? for later use..
Like store the state of all components?
-
@ulrik You could do this. Won't work for tables though.
const myObj = {}; for (c in Content.getAllComponents("")) myObj[c.get("id")] = c.getValue();
-
@ulrik I tried using an array to push all .getValue() and .setValue() but it gets tricky when there are slider packs involved....
It is over 200 components
-
@ulrik Are you trying to make an a/b system?
-
@d-healey Yes it won't work with all components
-
@d-healey yes :)
-
Maybe start here - https://forum.hise.audio/topic/1197/a-b-comparison
-
@d-healey thank you!
-
@d-healey I used getAllComponents that has saveInPreset enabled, get and set values for all components except type == "ScriptSliderPack"
It works ok but it miss all changes made in SliderPacks :(
-
@ulrik it would be great if the "Content.restoreAllControlsFromPreset()" was working
-
for (c in Content.getAllComponents("")) { if (c.get("type") == "ScriptSliderPack") { var values = []; for (j = 0; j < c.getNumSliders(); j++) values.push(c.getSliderValueAt(j)); myObj[c.get("id")] = values; } else { myObj[c.get("id")] = c.getValue(); } }
-
@d-healey Nice :)