Store values in ScriptPanel data object
-
@d-healey Ah, thank you! :-) So, on Linux there is no
AppData
directory?
The folder/.config/My Company/Plugin Name
contains (among others) aUser Presets
directory, and surprisingly, it transferred the text files which I gave the.preset
file extension, but the content of each file isnull
... -
@d-healey Okay, i just changed the preset file names, at the moment they have no file extension.
Everything works fine in HISE, but not the compiled plugin. It sets up all the needed files in the AppData Directory (or whatever I should call it on Linux... ;-) ) , but changes of parameters won't be saved to the preset files. What am I missing?
I use the following functions to store and recall values from the preset files:var PresetDir = FileSystem.getFolder(FileSystem.UserPresets); // store inline function writePreset (FILE, ARRAY) { local PresetFile = PresetDir.getChildFile(FILE); PresetFile.writeObject(ARRAY); } //recall inline function recallPresets (FILE) { local PresetFile = PresetDir.getChildFile(FILE); return PresetFile.loadAsObject(); }
-
@toxonic AppData is just the generic name, it's actually only on Windows that it's called appData
-
Any ideas, why the compiled plugin won't saveparameter value data to the preset files? Inside Hise it works like a charme, but not the compiled plugin...
-
@toxonic No I'm not sure, but presets are an xml format so writing an object to it doesn't make sense.
Let's go back to the beginning, there is probably a better way to do whatever it is you are trying to do. What do you want to achieve?
-
@d-healey Yeah, "preset" might be the wrong word.
Okay, so far I have a multieffect plugin, each effect has it's own sequencer track to trigger the effect.
Each effect has a UI Section, where you can adjust the effect parameters.
Now, I want to be able to store and recall 10 parameter sets of each effect individually, so you can automate these "presets" in the DAW, instead of automating each parameter of each effect, which would be tricky and time consuming. I can't use the HISE preset system because of the inbuilt sequencer, which will always stop playing, when i would change a preset.
Actually, I got it working to store the parameter sets as a 2 dimensional arrays for each effect.
So, for example the 10 values of the first parameter of effect one's parameter set would be stored ineffectOneArray [0]
(just an example name).
And to save the parameter sets between the sessions, i store these arrays as objects into files, via the mentioned functions above. As i already said, this work fine in HISE itself, but for some reason, the compiled plugin won't write any values to the files in theAppData
directory. -
Noone?
-
@toxonic Do you have a small example snippet?
-
@ulrik mhh, i'm afraid, i would have to create one, since the project is too large to reduce it to a snippet.
I will give it a try, to make a small snippet to demonstrate the point, where i stuck... -
@ulrik Oh, this is driving me nuts! I created a snippet, that basically does, what happens in my project file in regard of saving and recalling "presets" (don't mind about that term, i don't mean hise presets). And what shall I say, the example works without issues, also as compiled plugin!
Here's the snippet, but that's kinda senseless to dig into, because this one works...HiseSnippet 1383.3ocsW0jaabCElismzHklhDfd.H7pQHN1RxIoE00MxV1NvHMIpQNAIvvHgZFJIVOCoJGpXITDfbC5UnGkhtr6691UcauAsOxgye1xINBNZgvv2ue7iOR9XGovmFGKjHmJGLcDE474tcmxUCaOjv3n82A4bc2NRZLUc.MV0.s8zQj3XZ.xwYwGnMwoxRHyu+89aSBIbeZtHD54BlO86YQLUtzNsdHKLbOR.8.VTAquSq88E71hPwX.NK5VGMh3eLY.8wDsYK3hbtxtALkP1UQTzXjyRaKBl1cn3Ddh8OmEy5ER0CZf5BAJQ7dhv.Mh0RQsGxBC5jNsiQPT5jSBKlPBeo6iXArL44jwMLJv4dTjObVnL7VrD7ZTDd0K.uY.ImBPZoDHcS2t9R1HUtFMdtl69bEU1m.zdQnjXKZg+5JtsEfEb0pQjio6IgAYd3cu50WAC+Uaip.yGqvugHw68hNDIIJFuI9vTeGPUsEQiDbXf2xOjK50X4ZqTEOyemuSMmGmVe4ZGUDeIUicogTefqATNaWgO6I1VLA.5FUqt1Z3cXRiGSwJANF9fZCUb07vBFAQbOVHs6zXEMRGTS4izqfvmESkVegfm6s1Dv8rPYfjdwUqva4biRwT+wbeESvSvSUFOjwo4ROQxTzDuvda8zmt0KqU8mMDXdnV0XzS58ivjyZyFUeagnqCDLyIggmI9IhsyDrmN3UjT0XIuXBBEjfshsYHK36LNJZJdKojXHzSDxiwEIRiZnDBV65CKSdrMquAl8soUWqFR4CTCAQ25V0J5ypiFGOz6virLTBDSWov8khHbeMMaHMhTMdzJXV+DYzIrXX4DF5U.+rXC8Wq1ofVoYumMeV1tKMs9RWcIEg31fs8fyipVt9a0XcUmwjTK7xrnsRlJTG9SS+yxNO+zR3Ufp8vwTyhx6iA0DX0JfQUR0bH6HMrdt1cuByYP9glXhuMtglfK6h+PBe.M.D+V6ZrQGENs3rrfAQSvLd14E0vSlIYnU9gHhSYSARHmCBEvxElE.qbYp0av1OPu1UI9DlxeHvRAV1vmDSw1yp9FXbQhn9QGdpkwAo7Usa23HHEl7pYnB6AKxkF1qmjRNV+Qoz07LoqwkY5pb57s9YxWyK2oGTNjsTI3OV.G2vSNr.pSvmVU+9yTmstHDNIcVp0sBHeeN5wGG0iJKtqPaHb+X4KccO+KcK1SfexkFELTv2myTOYDkedcJfr2zn6YvhJvTk454uvd8b2PFbYAhA2B+YtlhOjAv11bd8u76+48QWXmaVx42sY0+4iv40K47u9f+9ONqy2v5b5skF2ula1kmkBA76FsPOa+cHJhtIEKc.TzHpTwzruyNz2.c7kzxRE2cnwGqDiL1Z2xBMwkj5qm1PCgSCM48ptluafljkv28Csllm8uq0Ir.0vbs8aMjxFLLu4x28SszqMY4x8Ct5LoXCnkx0HhDhQgfkgOzGQFZdtY3fKoLr94kgVu9BlgqdAKFlTjdxyyuE1Jh.5bcbgQmeJUzI5UJ66IhQvIOQPMyZVA3F16VwMS+X8zOtS5G2sJ7.hyzbLzVtHXbHQUtWc8CTrJfyRJ0frtIXdLSMs3CXtzZf+hBwa51Qeq0rw3By.iv1tOEXz9rmq6ta+9vEF4.bI28dwml23fdpXrhwG7HhRxzEOOdbTW3ke9TH6bndQeVtyB5ScSFWWOVy.co7.yf+C9YU1PO1wprQpRTDwWJdkexgd5GVcUiD.SbyaJq39H8Xb14btt0WsNJBdi2q780S+aC6TlsOMmCeVeN74NygO2cN74dygOe0b3yW+d8Q+75sFqDQIaG.Ac10beiiytbBTYYpBQ+eep3r3
I'm afraid, I have to find out, where the difference to my project is...
-
But it seems not to be a problem, that i can't write to the files, rather than theres something wrong with the internal dummy arrays, that don't seem to work properly.
Whenever i change a preset in the DAW plugin, it shows only default values, but it should at least show the values, that are stored in it's dummy array.
I just copied the preset files from my hise project to the AppData User Presets directory, and as soon, as i change a parameter, the corresponding preset file will be overwritten withnull
.
Any ideas? -
@toxonic It works here, in Hise no problems.
I compiled it and opened it in Logic, at the first launch, I had not copied the presetFile to the AppData UserPresets folder so it created a new presetFile with all values at undefined.But if I changed the knob values it wrote them down to the file
-
@ulrik Yeah, that's what i mean, the snippet works like expected, but in my project i go pretty much the same way, but it wont work as compiled plugin! That's driving me crazy!
-
@toxonic Have you located where on your computer the file "presetFile" is located when you open the daw?
If so, while you're running the daw, open the file with some text editor and have it open, chose a preset and start changing your knobs, is the file changing, what is written inside?Like this:
-
@ulrik Yeah, it's getting overwritten with 'null' , as i stated 2 posts above ... this is, why i believe, it must have something to do with the dummy arrays, but i can't get my head around,why it works in HISE but not with the compiled plugin
-
Just to demonstrate my issue, i added a panel, whcih i use to visualize the content of one of the preset dummy arrays.
This is, what it looks in HISE, i can see the values changing, when tweaking parameters:
And this is, what it looks in Ardour as compiled plugin.
Remember, the snippet i posted, which works pretty much the same way, works in both, Hise and in Ardour as compiled plugin....
-
@toxonic Ok starting from the bottom up then(you have probably done all this):
- How are you saving these values? In a json file? - I assume yes.
- In which folder are you saving the file? - I assume AppData
- How are you loading this data on init?
-
@Lindon Thanks for your reply!
- No, i'm saving the data inside the files via the
File.writeObject(ArrayToStore)
in a file called for examplestutterPresets
. The array to store in the files, containing the values for the UI controls is called the same. - Yes, actually in AppData/User Presets
- I made two functions, one to save the arrays in a file and one to recall them.
// Directory to store Presets var PresetDir = FileSystem.getFolder(FileSystem.UserPresets); //function store inline function writePreset (FILE, ARRAY) { local PresetFile = PresetDir.getChildFile(FILE); PresetFile.writeObject(ARRAY); } //function recall inline function recallPresets (FILE) { local PresetFile = PresetDir.getChildFile(FILE); return PresetFile.loadAsObject(); }
I recall them on init lie this (for example):
stutterPresets = recallPresets("stutterPresets");
PS: What you are seeing in the Panel in my last post are the values of the array, which I wan't to store inside a file. Since this is already empty in the compiled plugin, I don't wonder about, that the files are overwritten with
null
. I just can't get my head around, why the arrays won't get filled with the parameter values i set in the corresponding "presets"... - No, i'm saving the data inside the files via the
-
Okay so theres no validation going on, and some maybe incorrect naming, and an incorrect call to writeObject: so start like this:
//function store inline function writePreset (fileName, myJSONData) { local PresetFile = PresetDir.getChildFile(fileName); if (PresetFile.isFile()) { PresetFile.writeObject(myJSONData); }else{ // display an error here..... }; }
So the most obvious problem is you were trying to save an array when the command expects JSON, so you should fix that at least...