summaryrefslogtreecommitdiffstats
path: root/src/script.c
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-01 14:09:08 -0500
committerXANTRONIX Development2022-03-01 14:09:08 -0500
commit435f0e4f87aa25bd0ca5f605a5104692bd204a35 (patch)
treeea2a8013a2658f27ac9dde7313ed3365c2fe2a59 /src/script.c
parent25dfe9a0dd859ddd6b8ab1353ffbb14f727ab983 (diff)
downloadxas-435f0e4f87aa25bd0ca5f605a5104692bd204a35.tar.gz
xas-435f0e4f87aa25bd0ca5f605a5104692bd204a35.tar.bz2
xas-435f0e4f87aa25bd0ca5f605a5104692bd204a35.zip
Fix timerupdate() in src/script.c
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;