Store values in ScriptPanel data object
-
okay so you are storing the values you want in the panel with this:
// Store values from dummy array in Panel UI_Panels[0].setValue(stutterPresets);
so I think you need to get the values back out with:
stutterPresets = UI_Panels[0].getValue();
-
@Lindon Oh, i see, i misspelled stutterPresets in my comments (i wrote stutterPanels), but I already tried that. The switch / case statement in UI_PanelsCallback seems not to be triggerd, so i tried to
UI_Panels[0].setValue(stutterPresets);
in diffenerent places, but it always results in a single
0.0
value in the dummy array (and some error messages related to that). -
@toxonic what is this giving you?
Console.print(UI_Panels[0].getValue());
-
Okay, i made a mistake first... :D
The console spits out[Array]
, so i just don't really know, what's wrong....EDIT: Inside the UI_PanelsControlCallback it spits out
0
-
@toxonic I think I just have a basic problem understanding, how and where to store and recall values in panels.... :-(
-
@toxonic Why are you wanting to store values in a panel in this way? There is probably a better way to do what you want.
-
@toxonic This should help you to understand the principle:
HiseSnippet 1486.3ocsW0raabCDlqr2zraZRZ.5wdfPmjPUbjb9soHs1R1tPMwxBVNIsHnHfZWJKFuhbAWJ6HXXfdnO.8QnuB8Mq25wzgjqzt5GqXKftHHVbFNC+luYHGx1RQ.MIQHQNdGMJlhb9R2Ni3p9M5SXbTycPN2wsiRHoM4sIbZDp9nXRRBMD43r1Oomii25Hy2+7i0IQDd.MSDB8FAKf9J1.lJSZ6sdIKJZORH8H1fby9Qa0LPvaHhDCA7rlaUTLI3DxwzVD8zJ3hbtwtgL.McTDEMAlScQ3nN8Emwsy+MrDV2HpdPMTGvQVwnF8YQgsGGqIHjy5syh70rQ9W6tOKjMQdFC7UFE3LKxyANEVFjpcMfjSNHstER2ysSfjEqxznwysbaxUTYOBP04ghctnBCccaHfYvUaLfbBcOILXhEkdR0pUvv+U9688A5NQgOkHwljaM7Kvis7XppgXPrfCCJUzptHXSlI0GpTB9kaSp9oM5kbQ2K2DiVsA9O3A3s4XQ2OPCTXUehBmnqBSfeSwAis.DpY8b92H3fte.Vhy6p3OuGIJgVAeBu6yqtQ0K.Oa7c6sas6qvMpiKkPNUWa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XtaOC2aWDNLhnl9x75Wsjp.pTm5Fz5aICYR0n7up4ZbC+pK8F9WUHdO21LUP+EiwBK.iv4w+efwz2Eca2c60Ct.XF.W2cueYUeDzmY4OTLTej29DkjAm34B6e5.mHEPgUmC8GRz46B5td1wU0i0LPGJOzL3SvWpxZ5wNoJqMVIZ.IPJdefsWo9kW2zHAvD27PSO280iwSZR55BMFQCfGA99f.c3eenQ7hsYyUvlGtB17nUvlGuB17jUvlmtB17rkZi982aOTIFX2N.BZuqoujiyt1mrY5t9e.4zdxOB
Note that, as @d-healey said, there might be a better way for your use case. My example makes no sense since knobs and buttons can be saved in preset, but it's just an example for storing an object in a panel... I use this to store other kind of data than component values (and this was before the apparition of file handling...)
-
@d-healey @ustk i'm not at home at the moment, but i'll try your example tomorrow. Indeed i want to store knob values , but in my project i use a sequencer, and when i try to use the preset browser, the sequencer will stop running on each preset change, so i can't use that option.
What could be another approach? -
@toxonic You could write the values to a file. Using a panel also relies on the preset system BTW.
-
@d-healey okay, that's a good point!
-
Saving values in a file works fine so far, this seems to be the way to go for me.
Just a quick question: which directory would i have to specify in the code, that the compiled plugin can find the preset files in it's own directory (or maybe a subdirectory)? is there a wildcard for that? -
@toxonic I'm not entirely sure of the question but I think your answer might be here - https://docs.hise.audio/scripting/scripting-api/filesystem/index.html#special-locations
-
@d-healey ahh, okay! Is there a way to embed the textfiles with the stored parameter values in the compiled binary? I mean, i don't want the end user needing to care about the correct location for the files in order to get the compiled plugin working properly.
-
@toxonic Just include them as scripts
-
@d-healey Okay, i didn't know, that this works. Actually, the files are saved in the UserPresets Directory.
- Do the files need a special filexetension, like
.js
? - Can i pass the path in the include statement? Soemthing like
include ("./UserPresets/filename");
or do the files then need to be stored in the
Scripts
subfolder in order that HISE can find them?- Can the content of the files be modified, when the the plugin is compiled, so that the user can change the "presets" ?
Sorry for all these questions, but i never used includes for anything other than external scripts...
- Do the files need a special filexetension, like
-
@toxonic They will need to be js files and they need to be in the Scripts folder. The content can't be changed because they are part of the plugin. If you want the files to be separate then you need to find a way of including in one of the appData folders.
-
@d-healey Okay,thank you for your quick response!
How will the AppData folder be created? When i compile a plugin i usually only find the compiled binary. Is there any information on that topic out there? -
@toxonic That folder is created automatically when the plugin/standalone runs the first time. If you want to put files in it then you'll need to build an installer that creates the folder and puts the files there.
-
@d-healey uhh, that sounds complicated...
-
@toxonic Yup :)