How to reliably save samplemaps in preset? (Expansions)
-
Hey there i have a basic setup that loads the samplemaps of my 3 expansions into a multi column dropdown for the user to choose from (works fine!)
We have been adding a few more samplemaps today and experienced that the old presets dont work anymore because the combobox only saves a value/index (but array+values change due to variable expansion content)
<Control type="ScriptComboBox" id="ComboBox1" value="123.0"/>
That is why i would prefer saving my samplemaps as a path inside of the preset file instead - quick example mockup:
<CustomData> <Data key="ComboBox1_SampleMap" value="{EXP::Hardware Lab}Absorbing"/> <Data key="ComboBox2_SampleMap" value="{EXP::Pro Essentials}Detuner"/> </CustomData>
Any ideas on how to solve this? Maybe Expansion-specific indexing (i dont think that is possible)? I think i am overlooking something beacuse with this setup expansions in general would not be possible...
-
S Straticah marked this topic as a question
-
@Straticah Oh, I just reread your original question—you were actually asking how to do it.
Yes, I used a label to save the samplemap name. The combobox still relies on the samplemaps array (with saveInPreset disabled), but I use the label to store the string name. Then I restore the combobox by matching the samplemap name.
edit: actually, David told me to do this a couple a months ago lol.
-
@Straticah Oh, I did something similar a few days ago.
I asked ChatGPT to create a script to transform all the numeric values into strings. To do this, I gave it the list of sample maps for each expansion (using Expansion.getSampleMapList), letting it know that the combo box has index 1. It worked like a charm.
I can't find the script.. but in my case it was a little different because I used a hidden label to store the names of the samplemaps. Then of course it's required to update all the expansions.
-
@bendurso Yes that makes a lot of sense - whats the way you used to save strings to a preset?
Edit: oh i see you used a hidden label
-
@Christoph-Hart sry to bother - is there a less hacky way?
@bendurso I would have never thought about that good idea. -
@Straticah Oh, I just reread your original question—you were actually asking how to do it.
Yes, I used a label to save the samplemap name. The combobox still relies on the samplemaps array (with saveInPreset disabled), but I use the label to store the string name. Then I restore the combobox by matching the samplemap name.
edit: actually, David told me to do this a couple a months ago lol.
-
S Straticah has marked this topic as solved
-
Multiple options:
- Use a hidden panel with
saveInPreset=true
and store all loaded sample map in a JSON array, then call Panel.setValue() with this. In its control callback, restore all comboboxes / load the sample maps. The comboboxes must not besavedInPreset
for this to work. - Use the custom user preset system and define your data model as you wish.
Number 2 is probably overkill, so I would go with option 1.
- Use a hidden panel with