summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-07-16 12:34:31 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-07-16 12:39:46 -0700
commit1239467bc6c19eca1beaf7aefa1ac499e5ef4c1c (patch)
tree32015661c917a16032ebff2459d0ddb22db89b41 /src/modules
parentbd7a68e42a65289c64395363103a5e5ac66d65ca (diff)
modules/rkt: cleanup Rocket track names
- strip off the leading /path/to/rkt/module prefix - separate taps from their scene context path with ':' vs. '/' RocketEditor doesn't currently support recursive grouping, so this is as good as it gets. Note this commit will break the existing tracks for alphazed, so you'll have to use a newer .zip for track data if building your rototiller from source. Or build from a prior commit.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/rkt/rkt.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c
index 089d27f..9bc154b 100644
--- a/src/modules/rkt/rkt.c
+++ b/src/modules/rkt/rkt.c
@@ -30,8 +30,8 @@
/* variadic helper wrapping librocket's sync_get_track() */
static const struct sync_track * rkt_sync_get_trackf(rkt_context_t *ctxt, const char *format, ...)
{
- char buf[4096];
- size_t len;
+ char buf[4096], *start = buf;
+ size_t len, i;
va_list ap;
assert(ctxt);
@@ -44,7 +44,38 @@ static const struct sync_track * rkt_sync_get_trackf(rkt_context_t *ctxt, const
if (len >= sizeof(buf))
return NULL;
- return sync_get_track(ctxt->sync_device, buf);
+ /* skip the rkt module path prefix, let's not turn RocketEditor tracks into Paris street signs. */
+ i = strlen(ctxt->til_module_context.setup->path);
+ assert(i <= len);
+ start += i;
+ len -= i;
+
+ if (!strncmp(start, "/scenes/[", 9)) {
+ int i = 9;
+
+ /* Replace the slash after /scenes[N]/$modname with :, grouping by scene in RocketEditor */
+ for (; i < len; i++) {
+ if (start[i] < '0' || start[i] > '9')
+ break;
+ }
+
+ if (i < len && start[i] == ']') {
+ i++;
+
+ if (i < len && start[i] == '/') {
+ i++;
+
+ for (; i < len; i++) {
+ if (start[i] == '/') {
+ start[i] = ':';
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return sync_get_track(ctxt->sync_device, start);
}
@@ -123,7 +154,7 @@ int rkt_stream_pipe_ctor(void *context, til_stream_t *stream, const void *owner,
return -ENOMEM;
rkt_pipe->tap = til_tap_init(ctxt, tap->type, &rkt_pipe->ptr, 1, &rkt_pipe->var, tap->name);
- rkt_pipe->track = rkt_sync_get_trackf(ctxt, "%s:%s", parent_path, tap->name);
+ rkt_pipe->track = rkt_sync_get_trackf(ctxt, "%s/%s", parent_path, tap->name);
*res_owner = ctxt;
*res_owner_foo = rkt_pipe;
@@ -220,7 +251,7 @@ static til_module_context_t * rkt_create_context(const til_module_t *module, til
if (s->connect && !sync_tcp_connect(ctxt->sync_device, s->host, s->port))
ctxt->connected = 1;
- ctxt->scene_track = rkt_sync_get_trackf(ctxt, "%s:scene", setup->path);
+ ctxt->scene_track = rkt_sync_get_trackf(ctxt, "%s/scene", setup->path);
if (!ctxt->scene_track)
return til_module_context_free(&ctxt->til_module_context);
© All Rights Reserved