How many times is the onControl callback supposed to be triggered on compile?
-
I was checking the onControl callback for handling certain tasks for persistent data when I noticed a bit of redundancy.
Here in my project it is being triggered 171 times:
It was my impression that it only needs to run the onControl once after everything compiles.
How/why is it getting triggered so many times?
Is that something I need to fix or is that expected? -
@VirtualVirgin I suspect it will be triggered once for every control on the UI that has saveInPreset enabled.
@VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:
Is that something I need to fix or is that expected?
The OnControl callback is a left over thing from the early days of HISE before we were able to assign individual callbacks to controls. I wouldn't use it these days, I guess it might even be removed in the future or hidden behind a preprocessor definition.
-
@d-healey I'm imagining that you answered that question before I even submitted it! Lightning fast response.
-
@VirtualVirgin How were you able to count the number of calls?
-
@clevername27 said in How many times is the onControl callback supposed to be triggered on compile?:
@VirtualVirgin How were you able to count the number of calls?
I put
reg onControlCount = 0;
on the onInit
then putonControlCount++; Console.print("count: " + onControlCount);
in the onControl callback.
-
@d-healey said in How many times is the onControl callback supposed to be triggered on compile?:
@VirtualVirgin I suspect it will be triggered once for every control on the UI that has saveInPreset enabled.
@VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:
Is that something I need to fix or is that expected?
The OnControl callback is a left over thing from the early days of HISE before we were able to assign individual callbacks to controls. I wouldn't use it these days, I guess it might even be removed in the future or hidden behind a preprocessor definition.
Right now I am using it to update some things after the persistent values have been loaded.
How do I then update those things without the onControl?
The advantage, I think with the onControl callback is that I can order them so they load in a specified order, whereas I generally cannot change the order of callbacks of independent components in a script. -
@VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:
Right now I am using it to update some things after the persistent values have been loaded.
Put the same code in one of your control's callbacks. You could even add a hidden dedicated "post init" component at the end of the list.
@VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:
I generally cannot change the order of callbacks of independent components in a script.
They execute in the order they are placed in the widget list.
-
@d-healey said in How many times is the onControl callback supposed to be triggered on compile?:
@VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:
Right now I am using it to update some things after the persistent values have been loaded.
Put the same code in one of your control's callbacks. You could even add a hidden dedicated "post init" component at the end of the list.
@VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:
I generally cannot change the order of callbacks of independent components in a script.
They execute in the order they are placed in the widget list.
The "Component List"?
-
@VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:
The "Component List"?
Yea