aboutsummaryrefslogtreecommitdiffstats
path: root/src/Timer.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-06-24 16:17:46 +0200
committerMax Kellermann <max@duempel.org>2013-06-24 16:17:46 +0200
commitef48eca9cac875f65622daf500bd702e20d666f3 (patch)
tree52fe455c347fd0f0ab14b471e2482c17c8aed5e6 /src/Timer.hxx
parent906d2fbadf075b7d8e3a5be7134a9bebb09b7285 (diff)
parente9e55b08127dc45b4c6045e1f42e34115086a521 (diff)
downloadmpd-ef48eca9cac875f65622daf500bd702e20d666f3.tar.gz
mpd-ef48eca9cac875f65622daf500bd702e20d666f3.tar.xz
mpd-ef48eca9cac875f65622daf500bd702e20d666f3.zip
Merge branch 'master' of git://git.musicpd.org/dk/mpd
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