Utility class wrapping a single non-null callback called by a Timer. More...
#include <juce_TimedCallback.h>
Public Member Functions | |
TimedCallback (std::function< void()> callbackIn) | |
Constructor. | |
~TimedCallback () noexcept override | |
Destructor. | |
void | startTimer (int intervalInMilliseconds) noexcept |
Starts the timer and sets the length of interval required. | |
void | startTimerHz (int timerFrequencyHz) noexcept |
Starts the timer with an interval specified in Hertz. | |
void | stopTimer () noexcept |
Stops the timer. | |
bool | isTimerRunning () const noexcept |
Returns true if the timer is currently running. | |
int | getTimerInterval () const noexcept |
Returns the timer's interval. | |
Utility class wrapping a single non-null callback called by a Timer.
You can use the usual Timer functions to start and stop the TimedCallback. Deleting the TimedCallback will automatically stop the underlying Timer.
With this class you can use the Timer facility without inheritance.
|
explicit |
|
overridenoexcept |
Destructor.
References stopTimer().
|
noexcept |
Starts the timer and sets the length of interval required.
If the timer is already started, this will reset it, so the time between calling this method and the next timer callback will not be less than the interval length passed in.
intervalInMilliseconds | the interval to use (any value less than 1 will be rounded up to 1) |
|
noexcept |
Starts the timer with an interval specified in Hertz.
This is effectively the same as calling startTimer (1000 / timerFrequencyHz).
|
noexcept |
Stops the timer.
No more timer callbacks will be triggered after this method returns.
Note that if you call this from a background thread while the message-thread is already in the middle of your callback, then this method will cancel any future timer callbacks, but it will return without waiting for the current one to finish. The current callback will continue, possibly still running some of your timer code after this method has returned.
Referenced by ~TimedCallback().
|
noexcept |
Returns true if the timer is currently running.
|
noexcept |
Returns the timer's interval.