Strange behavior with Presets
-
@nouslou Post a minimal project, it's no good posting a snippet in this case because I don't have your presets
-
@d-healey you mean this project in .zip on any file hosting?
-
@d-healey it's only 3 mb :)
-
@nouslou said in Strange behavior with Presets:
@d-healey it's only 3 mb :)
That seems to be some project related to tabbed interfaces...
I mean make a new minimal project - minimal = the project only contains the essential components required to demonstrate the problem.
-
@d-healey here it is, David
-
In your
changeTab2
callback you are hiding/showing panels and also changing the preset.When changing preset through the preset browser though you haven't set anything up to hide/show the panels. The
UserPresetHandler.setPostCallback()
might be the way to go.https://docs.hise.audio/scripting/scripting-api/engine/index.html#createuserpresethandler
https://docs.hise.audio/scripting/scripting-api/userpresethandler/index.html#setpostcallback -
@d-healey I totally don't understand how to implement this) I wrote this code. But every time I choose preset manually or with buttons - Hise crashes. Where should I exactly put it?
const var presetHandler = Engine.createUserPresetHandler(); presetHandler.setPostCallback(postPreCallback); inline function postPreCallback() { Panel3.showControl(true); Panel4.showControl(false); }
-
@nouslou I think you need to use a real function here (not an inline one).
presetHandler.setPostCallback(function() { // Your code here });
-
@d-healey and how can I declare each preset? Because for every specific preset there are different panels need to show/hide . I mean how to tell Hise for example : if I choose this preset_1 manually from preset Browser - do this, but when I manually from preset browser choose preset_2 - do that
-
@nouslou There are a number of ways to do that. If you are using buttons to hide/show each combination of panels you could set the buttons to saveInPreset = true, then it would happen automatically (but not if those buttons are also changing presets because that would create an infinite loop). Another way is to hardcode it in the postCallback, but this could get ugly quickly. Another way is to store the configuration in an external JSON file and read it in after the preset loads and do the hiding/showing then.
-
@d-healey Thank you so much, David, as usual!! I managed to solve this