aboutsummaryrefslogtreecommitdiffstats
path: root/src/Timer.hxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Timer.hxx (renamed from src/timer.h)44
1 files changed, 17 insertions, 27 deletions
diff --git a/src/timer.h b/src/Timer.hxx
index 1506c9173..96446a988 100644
--- a/src/timer.h
+++ b/src/Timer.hxx
@@ -17,43 +17,33 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPD_TIMER_H
-#define MPD_TIMER_H
+#ifndef MPD_TIMER_HXX
+#define MPD_TIMER_HXX
#include <stdint.h>
struct audio_format;
-struct timer {
+class Timer {
uint64_t time;
- int started;
- int rate;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+ bool started;
+ const int rate;
+public:
+ explicit Timer(const struct audio_format& af);
-struct timer *timer_new(const struct audio_format *af);
+ bool IsStarted() const { return started; }
-void timer_free(struct timer *timer);
+ void Start();
+ void Reset();
-void timer_start(struct timer *timer);
+ void Add(int size);
-void timer_reset(struct timer *timer);
+ /**
+ * Returns the number of milliseconds to sleep to get back to sync.
+ */
+ unsigned GetDelay() const;
-void timer_add(struct timer *timer, int size);
-
-/**
- * Returns the number of milliseconds to sleep to get back to sync.
- */
-unsigned
-timer_delay(const struct timer *timer);
-
-void timer_sync(struct timer *timer);
-
-#ifdef __cplusplus
-}
-#endif
+ void Synchronize() const;
+};
#endif