Using custom preset system - as in the actual presets themselves, not a browser
-
@Christoph-Hart along these lines....
Calling:
updateSaveInPresetComponents(params) does indeed have the effect of setting any non specified parameters to their default value. This is not optimal for all use cases, for example my fx chain use case. Because what is happening is my synthesis generators are being reset to their default state, and the only way I can see how to avoid this is by iterating over all controls I do want to edit, and calling .setValue and then .changed() on them... which is actually quite slow it turns out.Could anything be done about this???
-
@Orvillain I'm not certain my brain gets all this so pardon me if it's not helping...
But can't you do it the other way round, saving the module state withaddModuleStateToUserPresetand then restore the UI components from it withupdateConnectedComponentsFromModuleState? -
@ustk Yep, indeed you can! the XML data you get from the module state call isn't pretty, but it does work. I think you'd do that if you had some module that did not have any UI controls, but you still wanted the preset to dictate its internal state when loading or saving.
-
@ustk clever - but possibly running through all the presets every time you load a new preset is going to take a while.... I'd need to cache them somehow.
How does saving panel data work? Do you have to save the preset (bad for my use case)? Does it auto update / write to the .preset file? Where is the data in the .preset file?!
EDIT - Oh it's not persistant... doh

-
@DanH said in Using custom preset system - as in the actual presets themselves, not a browser:
@ustk clever - but possibly running through all the presets every time you load a new preset is going to take a while.... I'd need to cache them somehow.
No, only at init when for checking if new presets are present
How does saving panel data work? Do you have to save the preset (bad for my use case)? Does it auto update / write to the .preset file?
Yes true... but it should be possible to just write it in the preset dynamically without the need to save. but that would require some clever string handling, don't know if it's secure enough and/or doable, but that might worth a try...
That might be where the already existing custom preset system is better...Where is the data in the .preset file?!
Under the panel's value, like all other components
EDIT - Oh it's not persistant... doh

Yes it is if in the preset..., it's recalled like any other value, that's what I do a lot in the things I've worked on
-
@ustk said in Using custom preset system - as in the actual presets themselves, not a browser:
that's what I do a lot in the things I've worked on
of course
Ok I'm obviously passing the data in wrong. Will take another look... -
@ustk ok got it working. Is it possible to update the .preset file without using
Engine.saveUserPreset? -
@DanH Yeah that's where the biggest job resides.
might doable with some XML parsing, and save as XML but the object might live as strings that are difficult to read/write. I won't be able to make tests within the next days so... -
@ustk I think it's too risky. One mistake in a preset file and it doesn't load.
-
@DanH what about with HISE's xml parser?
-
@David-Healey don't know anything about it
-
@DanH These two

-
@David-Healey I tried in during my testing and even if I could make it work, the parsing of an array that contains strings is bad bad bad. You need to rework the result to remove the escape char and other things.
This might just be normal, but then what about rewriting it back? Might work, might be risky, this I'm not sure until further testing it