OpenShot Audio Library | OpenShotAudio 0.4.0
 
Loading...
Searching...
No Matches
juce_Timer.h
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*/
22
23namespace juce
24{
25
26//==============================================================================
51class JUCE_API Timer
52{
53protected:
54 //==============================================================================
58 Timer() noexcept;
59
65 Timer (const Timer&) noexcept;
66
67public:
68 //==============================================================================
70 virtual ~Timer();
71
72 //==============================================================================
78 virtual void timerCallback() = 0;
79
80 //==============================================================================
90 void startTimer (int intervalInMilliseconds) noexcept;
91
95 void startTimerHz (int timerFrequencyHz) noexcept;
96
107 void stopTimer() noexcept;
108
109 //==============================================================================
111 bool isTimerRunning() const noexcept { return timerPeriodMs > 0; }
112
116 int getTimerInterval() const noexcept { return timerPeriodMs; }
117
118 //==============================================================================
120 static void JUCE_CALLTYPE callAfterDelay (int milliseconds, std::function<void()> functionToCall);
121
122 //==============================================================================
126 static void JUCE_CALLTYPE callPendingTimersSynchronously();
127
128private:
129 class TimerThread;
130 size_t positionInQueue = (size_t) -1;
131 int timerPeriodMs = 0;
133
134 Timer& operator= (const Timer&) = delete;
135};
136
137} // namespace juce
void stopTimer() noexcept
int getTimerInterval() const noexcept
Definition juce_Timer.h:116
Timer() noexcept
void startTimerHz(int timerFrequencyHz) noexcept
bool isTimerRunning() const noexcept
Definition juce_Timer.h:111
void startTimer(int intervalInMilliseconds) noexcept
virtual void timerCallback()=0