loadUserPreset - strange behaviour...
-
@dustbro
switch (number) { case 1: Engine.loadUserPreset(list[0]); break; case 2: Engine.loadUserPreset(list[1]); break; }
Use this instead :
Engine.loadUserPreset(list[number-1]);
it's not a fix to the issue it's just a much shorter way of writing the same thing. Where are you gettingnumber
from though? -
@Lindon I believe so:
-
Protip: Rightclick on the row in the table to get a popup with the data for arrays and objects :)
-
@d-healey said in loadUserPreset - strange behaviour...:
Where are you getting number from though?
I thought the number was the position of the selected combo box?
-
@dustbro said in loadUserPreset - strange behaviour...:
I thought the number was the position of the selected combo box?
The combobox has a index starting with 1 because 0 marks "no selection".
-
@dustbro
I thought the number was the position of the selected combo box?
In this function the first time the word
number
appears is inside theswitch
. I think you want to replace number with value.inline function onComboBox1Control(component, value) { switch (number) { case 1: Engine.loadUserPreset(list[0]); break; case 2: Engine.loadUserPreset(list[1]); break; } };
-
@d-healey said in loadUserPreset - strange behaviour...:
I think you want to replace number with value.
If I replace number with value, HISE crashes when I compile the script
-
Even if I ditch the array
this = instant HISE crash:inline function onComboBox1Control(component, value) { switch(value) { case 1: Engine.loadUserPreset("asdf/Bass/BassLeveler"); break; case 2: Engine.loadUserPreset("asdf/Drums/DrumPump"); break; } }; Content.getComponent("ComboBox1").setControlCallback(onComboBox1Control);
-
@dustbro yeah HISE crashes like a 0.1 app when I use loadUserPreset
-
@Lindon :( Using the Preset browser floating tile works as expected... but my GUI only has room for a simple combo box.
not sure what I'm doing wrong -
@dustbro yeah must be some bug with the load preset function. But value is definitely right since number doesn't exist
-
@dustbro As Dave pointed out to me, using:
storeAllControlsAsPreset("abc",false);
and
restoreAllControlsAsPreset("abc");seems to be more reliable - try substituting those?
-
@Lindon I'll give that a try.
Is it required to use storeAllControlsAsPreset if the preset files already exist? -
@Christoph-Hart Is there an example of the CustomUserPreset tutorial that uses a combobox instead of the Viewport?
-
@dustbro dont think so you could just give the Restore option a try...
-
I'm having a go at making a custom preset browser, the first issue I've hit is
storeAllControlsAsPreset()
doesn't allow a folder structure with the file name, so all presets end up in the top level. Is there a known workaround for this?