Pd++  0.01
A pure C++ implementation of Pure Data objects
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Timer.h
1 /*
2  Timer.cpp
3  Pd++
4 
5  Created by Robert Esler on 10/29/14.
6  Copyright (c) 2014 Robert Esler. All rights reserved.
7 */
8 
9 #ifndef __Pd____Timer__
10 #define __Pd____Timer__
11 
12 #include <stdio.h>
13 #include "PdMaster.h"
14 
15 namespace rwe {
16 
17 /*! \brief A simple timer that outputs milliseconds
18 
19  The timer class only returns the time in ms. Use the functions start() and stop()
20  to begin and end the time measurement. Make sure to keep updating the perform()
21  function in your routine. The time is calculated based on the sample rate.
22 
23 */
24 
25 class Timer : public PdMaster {
26 
27 private:
28  bool timerOn = false;
29  bool timerReset = false;
30  double timerCounter = 0;
31 
32 public:
33  Timer();
34  ~Timer();
35  double perform();
36  void start();
37  void stop();
38  void reset();
39 
40 };
41 
42 } // rwe namespace
43 
44 #endif /* defined(__Pd____Timer__) */
A super class inherited by all Pd++ objects.
Definition: PdMaster.h:62
Personal namespace. Use intials for your own classes.
Definition: CosineWave.cpp:18
A simple timer that outputs milliseconds.
Definition: Timer.h:25