summaryrefslogtreecommitdiffstats
path: root/src/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/script.c')
-rw-r--r--src/script.c18
1 files changed, 9 insertions, 9 deletions
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;