From 435f0e4f87aa25bd0ca5f605a5104692bd204a35 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 1 Mar 2022 14:09:08 -0500 Subject: Fix timerupdate() in src/script.c --- src/script.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/script.c') diff --git a/src/script.c b/src/script.c index d84a54a..798f793 100644 --- a/src/script.c +++ b/src/script.c @@ -239,15 +239,6 @@ error_malloc_ev: return -1; } -static inline void timerupdate(struct timeval *tv, - suseconds_t interval, - size_t frame) { - struct timeval zero = { 0, 0 }, - timer = { 0, frame * interval }; - - timeradd(&zero, &timer, tv); -} - static int event_trigger(xas_spatial_scene *scene, xas_script_event *ev) { switch (ev->type) { case XAS_SCRIPT_EVENT_OFF: @@ -300,6 +291,15 @@ error_invalid_event: return -1; } +static inline void timerupdate(struct timeval *tv, + suseconds_t interval, + size_t frame) { + suseconds_t usec = frame * interval; + + tv->tv_sec = usec / 1000000; + tv->tv_usec = usec % 1000000; +} + int xas_script_play(xas_script *script, xas_audio_stream *sink) { xas_script_event *ev = script->first; xas_audio_stream *source; -- cgit v1.2.3