Makes repeated callbacks to a virtual method at a specified time interval. More...
|virtual void||timerCallback ()=0|
|The user-defined callback routine that actually gets called periodically. More...|
|void||startTimer (int intervalInMilliseconds) noexcept|
|Starts the timer and sets the length of interval required. More...|
|void||startTimerHz (int timerFrequencyHz) noexcept|
|Starts the timer with an interval specified in Hertz. More...|
|void||stopTimer () noexcept|
|Stops the timer. More...|
|bool||isTimerRunning () const noexcept|
|Returns true if the timer is currently running. More...|
|int||getTimerInterval () const noexcept|
|Returns the timer's interval. More...|
|static void JUCE_CALLTYPE||callAfterDelay (int milliseconds, std::function< void()> functionToCall)|
|Invokes a lambda after a given number of milliseconds. More...|
|static void JUCE_CALLTYPE||callPendingTimersSynchronously ()|
|For internal use only: invokes any timers that need callbacks. More...|
|Timer () noexcept|
|Creates a Timer. More...|
|Timer (const Timer &) noexcept|
|Creates a copy of another timer. More...|
Makes repeated callbacks to a virtual method at a specified time interval.
A Timer's timerCallback() method will be repeatedly called at a given interval. When you create a Timer object, it will do nothing until the startTimer() method is called, which will cause the message thread to start making callbacks at the specified interval, until stopTimer() is called or the object is deleted.
The time interval isn't guaranteed to be precise to any more than maybe 10-20ms, and the intervals may end up being much longer than requested if the system is busy. Because the callbacks are made by the main message thread, anything that blocks the message queue for a period of time will also prevent any timers from running until it can carry on.
If you need to have a single callback that is shared by multiple timers with different frequencies, then the MultiTimer class allows you to do that - its structure is very similar to the Timer class, but contains multiple timers internally, each one identified by an ID number.
Constructor & Destructor Documentation
Creates a copy of another timer.
Note that this timer won't be started, even if the one you're copying is running.
Member Function Documentation
The user-defined callback routine that actually gets called periodically.
Referenced by ThreadWithProgressWindow::getAlertWindow(), AudioDeviceSelectorComponent::getItemHeight(), MidiKeyboardComponent::getOctaveForMiddleC(), and FileBrowserComponent::LookAndFeelMethods::~LookAndFeelMethods().
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)
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.
Returns true if the timer is currently running.
Returns the timer's interval.
- the timer's interval in milliseconds if it's running, or 0 if it's not.
Invokes a lambda after a given number of milliseconds.
For internal use only: invokes any timers that need callbacks.
Don't call this unless you really know what you're doing!
The documentation for this class was generated from the following file:
Generated on Fri Jan 12 2018 09:51:24 for JUCE by 1.8.13