summaryrefslogtreecommitdiff
path: root/src/modules/rkt
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-06-01 12:28:30 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-06-01 12:28:30 -0700
commitec35c6eb6a8890c6048e5f952b0493a8bf83ed86 (patch)
tree5c6f8889c16b12433e12eb2fd891b9967bbbb53e /src/modules/rkt
parent58c2cb3cf89a9eb1fa572051881256594a36eaac (diff)
modules/rkt: variadic warpper for sync_get_track()
Preparatory commit for adding scenes and a $rkt_setup_path:scene track for selecting them. This will also likely replace the whole track_name allocation/construction in rkt_pipe_t since we don't actually make use of that name after getting the track (except maybe for debugging purposes)
Diffstat (limited to 'src/modules/rkt')
-rw-r--r--src/modules/rkt/rkt.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c
index 77b3b49..41c47ad 100644
--- a/src/modules/rkt/rkt.c
+++ b/src/modules/rkt/rkt.c
@@ -1,3 +1,4 @@
+#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
@@ -47,6 +48,27 @@ typedef struct rkt_setup_t {
} rkt_setup_t;
+/* variadic helper wrapping librocket's sync_get_track() */
+static const struct sync_track * sync_get_trackf(struct sync_device *device, const char *format, ...)
+{
+ char buf[4096];
+ size_t len;
+ va_list ap;
+
+ assert(device);
+ assert(format);
+
+ va_start(ap, format);
+ len = vsnprintf(buf, sizeof(buf), format, ap);
+ va_end(ap);
+
+ if (len >= sizeof(buf))
+ return NULL;
+
+ return sync_get_track(device, buf);
+}
+
+
static til_module_context_t * rkt_create_context(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup)
{
rkt_context_t *ctxt;
© All Rights Reserved