Optimizing for UI Timers [EXCITEMENT!]
-
I've got two kinds of GUI components that run on timers called from the UI Note-On callback.
- callAfterDelay().
- fade() (which I assume is a timer inside HISE).
Now let's say I make the parent panel of those UI components invisible. I no longer need those timers to run. What happens?
I'm guessing the HISE fade API will check if it's visible, and if not, won't run. I'll keep calling it from the Note-On callback, but the overhead will be negligible
But my manual calls will still activate the callAfterDelay timer. So I would need to:
- Have a global variable to check in the UI Note-On callback.
- Have a function call I make from the Note-On callback to request whether the timer should be started. I'm guessing this has a lot more overhead than checking a global variable—but it means I don't need yet another global variable.
Any thoughts on this?
Thank you.
-
This post is deleted! -
@clevername27 said in Optimizing for UI Timers [EXCITEMENT!]:
I've got two kinds of GUI components that run on timers called from the UI Note-On callback.
- callAfterDelay().
- fade() (which I assume is a timer inside HISE).
is "fade()" here
.fadeComponent(bool shouldBeVisible, int milliseconds)
??
Now let's say I make the parent panel of those UI components invisible. I no longer need those timers to run. What happens?
I'm guessing the HISE fade API will check if it's visible, and if not, won't run. I'll keep calling it from the Note-On callback, but the overhead will be negligible
But my manual calls will still activate the callAfterDelay timer. So I would need to:
- Have a global variable to check in the UI Note-On callback.
- Have a function call I make from the Note-On callback to request whether the timer should be started. I'm guessing this has a lot more overhead than checking a global variable—but it means I don't need yet another global variable.
Any thoughts on this?
it really depends on what you are trying to achieve in these "manual calls", is there some reason you wouldnt just use a panel timer, and have it check (in the timer itself) if its panel is visible or not and then stop itself if its not visible...???
Thank you.
-
@Lindon Thank you - checking for visibility before making the call sounds like the answer - cheers. (And yes on fadeComponent.)
-
@clevername27 You could probably also use a broadcaster here to watch for changes in visibility.
-