openshot-audio  0.1.2
juce_Timer.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_TIMER_H_INCLUDED
26 #define JUCE_TIMER_H_INCLUDED
27 
28 
29 //==============================================================================
53 {
54 protected:
55  //==============================================================================
59  Timer() noexcept;
60 
66  Timer (const Timer&) noexcept;
67 
68 public:
69  //==============================================================================
71  virtual ~Timer();
72 
73  //==============================================================================
79  virtual void timerCallback() = 0;
80 
81  //==============================================================================
91  void startTimer (int intervalInMilliseconds) noexcept;
92 
96  void startTimerHz (int timerFrequencyHz) noexcept;
97 
106  void stopTimer() noexcept;
107 
108  //==============================================================================
110  bool isTimerRunning() const noexcept { return timerPeriodMs > 0; }
111 
115  int getTimerInterval() const noexcept { return timerPeriodMs; }
116 
117 
118  //==============================================================================
122  static void JUCE_CALLTYPE callPendingTimersSynchronously();
123 
124 private:
125  class TimerThread;
126  friend class TimerThread;
127  int timerCountdownMs, timerPeriodMs; // NB: these member variable names are a little verbose
128  Timer* previousTimer, *nextTimer; // to reduce risk of name-clashes with user subclasses
129 
130  Timer& operator= (const Timer&) JUCE_DELETED_FUNCTION;
131 };
132 
133 #endif // JUCE_TIMER_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
int getTimerInterval() const noexcept
Definition: juce_Timer.h:115
#define JUCE_CALLTYPE
Definition: juce_PlatformDefs.h:50
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
#define JUCE_DELETED_FUNCTION
Definition: juce_CompilerSupport.h:133
Definition: juce_Timer.cpp:25
bool isTimerRunning() const noexcept
Definition: juce_Timer.h:110
Definition: juce_Timer.h:52