aboutsummaryrefslogtreecommitdiffstats
path: root/src/timer.h
diff options
context:
space:
mode:
authorDenis Krjuchkov <denis@crazydev.net>2013-05-12 19:03:42 +0600
committerDenis Krjuchkov <denis@crazydev.net>2013-05-12 19:03:42 +0600
commit49a3845135142ada6d581d5a6f4a5192aaed49be (patch)
tree67dd709c03fb8cc18377ad74d09da512a217f42a /src/timer.h
parent21dac6c05ddff1ce130843a82127618f9ed766a7 (diff)
downloadmpd-49a3845135142ada6d581d5a6f4a5192aaed49be.tar.gz
mpd-49a3845135142ada6d581d5a6f4a5192aaed49be.tar.xz
mpd-49a3845135142ada6d581d5a6f4a5192aaed49be.zip
timer: convert to class
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