Store values in ScriptPanel data object
-
Hi all,
i't trying to save several knob value presets in a two dimensional array inside a script panel data object.
The values seem to be stored in the data object and i can recall them without issues, but the values won't be saved with the project. I enabled "save in preset" for the panel containing the data object, but it won't work... what am i missing?HiseSnippet 1123.3ocsWEzaaaCElx1rKVcYnEXG2AgfdvFH0v1sqaXECUKNICFcI0XNKX.FdEzRz1DQhTPhNodC4e09Az+J69NrK671iRxVz1xJFFa5PfIeuu26iej7wW5EJbnQQhPjQ0qlGPQFeJt+btbZmoDFG08Tjwg3dgzHpz5JZjDcx7.RTD0EYXT96UtXTsBJ96udyIDOB2glMEBcsf4P+AlOSlMaO62x77Nm3Ruh4q48Ks65H3cDdhY.cJiahBHN2PlPujnbqDFY7nybYRQXeIQRiPFUNQ3Nu+Twc7D+ulEwF4QUCZg5CAJY5yEdtJFqlE0YJyys2hkcDBhRuLQnbhH743KXtrkymIFOI1fUFBc8vnzpzq7JzqkN8ZpQubnjgFkpjPomh66DxBjYVT74w3tbIMbLAjccpj3KpDqBti.7fKa3StgddHLXIhZupYyisf+T+0llfzGIstkDZ0ivodsr9VqEHmPkcD9ABNLn1QIlOBvjA4sbwnH.wf7gnLCHN1zZyusin8Q0GpmDv7HwIhOrcpszCE6LSHZCWhjz3Vh2LZLCGL73ACg3Zx3dLN0Z7LtijI3VpidovUQOT3UyYQnO1JN.0M+MypUiWrCZNrAbo3Z0z01LSf4Aw+54sFBbQCjyTBeB0MatVEGnV4FnVZA5dXw7f5gJGoKqNDOuQvMqZathUxVNBiJmEpIQ2wjNSsxLpHRW2Z0qaVUIYNjHpU5wfuwBl.hVjvi1HHjADMIPpUW07kxk7TE2DopNHHv9YrOwHGERI275URV6jjUMeY8gBpkdTuu.YN8vZ9Rrl1AqvBuerKAPaW4Rgj9Nds3M.y6MsV2z3w4ZKMVdzvbMqpIGVDvZ7Y9ing5a+JGgBUqV8Cu8pe5EmcRTDMGE7tbl7cAT91JYiRkQUw6TVAtJiqSd3h5jp8bDCpFd.NY+GESX8WmPqC9yRA22i4RCiQ+I33cmU.+w+t1e9lcGb6U.a+G+5uuI3mjBdwgxX3OFu7L55j+.azO08T3.s50hT4.jn.ZnjoTeiSo2BO8l71QU7oznajh.3UzkG6.18fJ1GVlvONxddV16ZeGyUNc4D1T6oT1joRc+iH2R6xSZd.HTo7xcABdVtQOSO2OyNfDBwPKXK46prB8KqyJf3HMb3Gbiaaj3pBHgdFdzNt6lkG6Y544RaeBXCaTFFvjTeXq8KVzPVKyzezdwOdAzc0FcN.8rHbm4Qjq1Hip6sTCv86U5dP0g.OhImq2c25c2TY25to3lu1U59TbO0KL4y2R4vW3Zw+27MsWwCwmMdL0QlQ1J3y+4BaL7+Fp7ihYRFexEDYHScF4xY98gVmcn.S3vIQUMXiRppbIiapFqTl9Tta7f+A9RM1RM1H0XqEFQ9DmPw6cRJVo5L8f3Y.NwiaJuJ9B0Xqk0mv3lMZh7gljeuiiRJdNv87wzdOv7h8.yK2CLe4df4U6AluZOv70EhQ8+m7cyjB+jqIvD8NK9cBCiy3D3TV7IRz+BbfX3aB�
-
@toxonic The data object is not being stored with the user preset, but if you want to make a complex data object persistent, you can just give it to the
setValue()
function. -
@Christoph-Hart Ahhhh, okay.... Thank you for your quick response! :-)
-
I don't know why, but i have huge problems in understanding, how to access the data stored in a panel.
I have a quite complex project i'm working on, so i tried to boil it down to a snippet, that demontrates my problem. This makes it look awkward in some aspects, but keep in mind, that it's just a small part of the whole project.
Maybe someone take look at it?HiseSnippet 3366.3oc4a07aabbEeojGISF6D6XGzVffhAFsnRH1Rjxel3jJZIKYyF8Aqnra.LDXWs6PwEZ4NL6NTRLoAvEnEn+CzC4RQ.J50dt8PQ7e.t.8dQAR.5o1bvGZQOzB39dyreL6pkxTxNNMtzFF6Nyadya989blYccetEKHf6aTn3586xLJbBRi9dh1y21zwyn1MMJ7sHq27VtNBq1Mavd+KT2mEvDqyBDFy0uqYP.y1nPgQuERdghGyP96QyNmoqomEKoICi6xcrXK4zwQjzZ8puqiq6hl1r0c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277.uU2w95T9436E1HrlDo5Ht9jwPrOcQJ2v0kuKd5oNglopUEzu7kwIkmB9ihr5b29QwZJLpZPQR+M5v64IhVB21LXcSGW4k1UXEYbiwVzD+hF5W2DqI5zD7duAaQlO903DZSlVzRrKjVb.lm7E4nDSjy523n7Tp6HOjA7ajcTreDAFUIBDkomf0oKuY.TjfQJY5rRYBrElRihzBwSZBSb2W2zeKlHH7hb8XVJvcDjC0rwR4gICVq3gMGurvNFmbW0UAqsXwbrIGMMjB0SQSABpdLV1buv2GiT4ZPCMhuVDBoB7NttGmrNtpLhG4kgNLFDaqjksWY.r8Djk6gGStqCviTC2X3DYEw4w5hjn5xNJ783DnboxoX8YARvFweUtzaVtRkqTQNSuL4Ndn1lYKKsLjCiSlQx.Csqf2vPyTRWGlxR5LwVRIDb3LjzmRY7T7MHawH37NFQlJNdgtbvLyUeYCig25abBTRQfHskGg.UWlwtqvvB1yjEr0s7TTcidBdGHJZTkjZHYj7jBEOAfh9roT87T.eijA9JRl2E3UsX6pRwgch00Qz9JXXZMDIbDxP7o.pQyGnFib4zHUjQ0PXUpzGYQsmZO1iSTelhCMmGd+0nhNyx4FxuyvXixzH2H5yqR.C247gX4ISZoSqtg+gzOHFfLxJYI2h+viOojrxOcRVBBabfAHNAoVvcwdsLcilbHu7Q4aK54RYKOOliNlV97lgwkkWymrEPA4I2jdQxx36zJQeLYJsUGX6pMsrv5kuPECi7GyLGgwbwivXtzQXLW9HLlqbDFyUOBi4ZG3XvSJHLRB5aDZ1p9JQgju5uPJPRusG8+2.ImK4G1YjwP5aMA9oekIvtEWrmq69nAaLCcM1lsa1cX6CKIrsO7r+1a84evOC2fsuyl8vSRJ6WlPMUsAxceYrb8EjdmEJDeZTPq+WvHY7ys�
-
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.Oa7c6sas6qvMpiKkPNUWaCtlpvTNAxUgk8Y7HFmh6MjGnXB.H1p+ZZXKEQklffJvpFMjV1+beOvuGRCHQQ3dRw.brwm9drd3RJHcJ5kYlNtei1vRkKiewKvEsQZwx9dfi7RotMRFOKyhrADP.2joNnOgeLMrjQH7OC8MqQPnaza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OzL3SvWpxZ5wNoJqMVIZ.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.