Strange behavior with Presets
-
@d-healey no, it's not what I meant) I try to explain this: for example I have 2 articulations, each of them has they own panel with different controls. When I choose one of the articulations (by pressing a button) - there is callback on the button, which trigger Engine.loadUserPreset and then show or hide panels. When I only pressing the buttons - all works fine, presets are changing and panels are changing too. BUT when I click on the presets themselves in the preset browser - they almost work, sample maps are changing, stored values on knobs too, BUT panels (with controls related specifically to this articulation) don't. And I can't understand at all why?I changed my code 100 times but it still doesn't work properly.
HiseSnippet 2435.3oc4ZstaabbEdWIu1docbrSSA5eJvBghB5HEQxcot35VDJpKFBIxlPT1oEtFNC2cH4TsbG1YGJKk.gFzmj9HzGA+Vz+lGA+FzdlYuvYWtjhTNNHAU+PVy4Lm47c9lyYtstEi5hCCoLMcyStXHVS+tFsuHf2e29HRf1g6ooeOi2P38aNhyoAg1ZMuXHJLD6ooqu7SD8Q27FZxed2WzD4iBbwiEoo8BJwE+UjAD9XosZ7kDe+CPd3SHCT5c8FG5RC1k5SGA3YYipZCQtmh5geJRzskLzzu49dDNk0li33PM8azj5cQ69z2DD0+WPBIc7whF0zZCCTj3Cn9dBDKjpsaehuWqj3NTSS2n0XVX4HV3SMNh3QRkOlMtuTg0XKT4C8kxBuky.uZpvqpB7J.R5JP5FQP5AFscYjg7wZD34NFGFvwrtHf1UgRTe0V5+XZrKE5Q.e8AnSwGvfFoVTdypUWyZipUe3iKUpRkmvPcrfY.Ni5awvcwLLLaFVBDExsNCwrd5yO50mrSy1V+IK6GqHeHJ.6GBRe4qTE2IJoIRtkhhSCncB2kNX.MXBihFK6IMJdzR0TpKkYUl.Mq9XKh0ezxA9mUW8gk9tRlJN3kjWAcIgD5g4f3gz.nQ4U9RnaqrZYxp0dHPAWN4PlDvoirE7SDBm031RziwCrvnXzOKqhpwllYqGJ5rbxYWjueGnznraeTPO7InNQneB3amfayRlw757.amUIB+alv3yEnKvnYBY6HLWohUazfg9XlUkJJy1wBqANVtfjzsh5DYqxqjneknb239acDZn0NLF5BwnoLbgR0fVQ1Xrshgr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3FJoa9.6P0F1U1EqtOkvuwsql7f3swAdxF+W3mXk0Ds0iUVKmRaUKsyozQ0RmDkZtIf.RXi+a4sYzWFtF.Dfxit4Caz5qlbGBmZPDL2xv0mBqtns3ldSCFkNXB5wnP5Yo2K5Qa.xkQec7+sWDg5skR.jFH+ucjowQh1VouusgQ00qpM.1b60tthpqOG1qrXaruF13bMro90vlMtF1r40vlstF1r8LsQbthcFwoChVsEDzZ+njK88SStVV6+M7zXBO
Could you pleeease check this snippet of my code?:folded_hands_light_skin_tone:
-
@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