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
juce_TimedCallback.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22namespace juce
23{
24
35class TimedCallback final : private Timer
36{
37public:
40 : callback (std::move (callbackIn))
41 {
42 jassert (callback);
43 }
44
46 ~TimedCallback() noexcept override { stopTimer(); }
47
50 using Timer::stopTimer;
53
54private:
55 void timerCallback() override { callback(); }
56
57 std::function<void()> callback;
58};
59
60} // namespace juce
Utility class wrapping a single non-null callback called by a Timer.
~TimedCallback() noexcept override
Destructor.
void stopTimer() noexcept
Stops the timer.
TimedCallback(std::function< void()> callbackIn)
Constructor.
Makes repeated callbacks to a virtual method at a specified time interval.
Definition juce_Timer.h:52
void stopTimer() noexcept
Stops the timer.
int getTimerInterval() const noexcept
Returns the timer's interval.
Definition juce_Timer.h:116
void startTimerHz(int timerFrequencyHz) noexcept
Starts the timer with an interval specified in Hertz.
bool isTimerRunning() const noexcept
Returns true if the timer is currently running.
Definition juce_Timer.h:111
void startTimer(int intervalInMilliseconds) noexcept
Starts the timer and sets the length of interval required.
#define jassert(expression)
Platform-independent assertion macro.
JUCE Namespace.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88