JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::TimedCallback Class Referencefinal

Utility class wrapping a single non-null callback called by a Timer. More...

#include "juce_TimedCallback.h"

Inheritance diagram for juce::TimedCallback:
juce::Timer

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.
 

Detailed Description

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.

See also
Timer @tags{Events}

Definition at line 35 of file juce_TimedCallback.h.

Constructor & Destructor Documentation

◆ TimedCallback()

juce::TimedCallback::TimedCallback ( std::function< void()>  callbackIn)
explicit

Constructor.

The passed in callback must be non-null.

Definition at line 39 of file juce_TimedCallback.h.

◆ ~TimedCallback()

juce::TimedCallback::~TimedCallback ( )
overridenoexcept

Destructor.

Definition at line 46 of file juce_TimedCallback.h.

Member Function Documentation

◆ getTimerInterval()

int juce::Timer::getTimerInterval ( ) const
noexcept

Returns the timer's interval.

Returns
the timer's interval in milliseconds if it's running, or 0 if it's not.

Definition at line 116 of file juce_Timer.h.

◆ isTimerRunning()

bool juce::Timer::isTimerRunning ( ) const
noexcept

Returns true if the timer is currently running.

Definition at line 111 of file juce_Timer.h.

◆ startTimer()

void juce::Timer::startTimer ( int  intervalInMilliseconds)
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.

Parameters
intervalInMillisecondsthe interval to use (any value less than 1 will be rounded up to 1)

Definition at line 90 of file juce_Timer.cpp.

◆ startTimerHz()

void juce::Timer::startTimerHz ( int  timerFrequencyHz)
noexcept

Starts the timer with an interval specified in Hertz.

This is effectively the same as calling startTimer (1000 / timerFrequencyHz).

Definition at line 95 of file juce_Timer.cpp.

◆ stopTimer()

void juce::Timer::stopTimer ( )
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.

Definition at line 107 of file juce_Timer.cpp.


The documentation for this class was generated from the following file: