@David-Healey said in How do I flush the UI parameters on first run??:
@Orvillain said in How do I flush the UI parameters on first run??:
run script init / callbacks
This is the important part. The last thing to run are the callbacks, in the order that the components appear in the module list.
So if you have a callback that sets the active effect, and then other callbacks that set the effect's parameter values, you might get what you want by changing their order.
oooooooo... I've just realised something .....
My generic UI parameters themselves do not have a callback assigned to them. IE: I never call uiParam.setControlCallback(blahblahblah)
I currently rely entirely on my effect load menu to do the following, and in this order:
- Get the menus component id.
- Derive the effect slot id string from the menu id.
- Read the menu item text - force it to lower case.
- Get the slotFX processor for the slot we want to address.
- Look up the hardcoded effect name for the chosen effect; using a map that takes in the lowercase menu item, and returns the name of the hardcoded effect to load.
- call setEffect(effectToLoad) on the slotFX instance.
At this point, my effect is loaded.
- If the effect we loaded was the "empty" one, then just hide all of the parameters, and reset all of their attributes to blank slates.
If it wasn't "empty"... then do this:
8. Fetch the UI layout+binding spec for the effect.
9. Bind the generic UI controls to that effects parameters.
9.1 - build the UI prefix for the slot.
9.2 - collect the UI components.
9.3 - clear existing bindings.
9.4 - set processorId to the correct effect slot name.
9.5 - set the parameterId to the correct effect parameter name.
At this point, the knob does control the DSP.
10 - setup the other binding parameters (min, max, stepSize, colours, etc)
11 - Hide any UI widgets that were not used.
... so in effect.... my actual UI parameters within each of my effect slots, do not have callbacks themselves. I rely entirely on the menu... which thinking about it... feels a bit stupid.
Effectively, I'm relying entirely on HISE's attachment of processorId and parameterId - and I don't really know when that happens in relation to the callback.
As I say; my UI parameters always look correct. They sound correct when I load a preset. They do not sound correct when I load a DAW project.