From 853f67297bafe344ba5b857270103eaa16685c91 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 11 Jul 2023 12:50:05 -0700 Subject: modules/blinds: update taps at context create too Especially since taps are established on first use, it's desirable to get them online immediately so they show in things like --print-pipes and modules::rkt/RocketEditor and not spuriously once the context becomes actively rendered... This kind of thing will be done for all modules eventually --- src/modules/blinds/blinds.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/modules/blinds') diff --git a/src/modules/blinds/blinds.c b/src/modules/blinds/blinds.c index 529cdaa..8acfae8 100644 --- a/src/modules/blinds/blinds.c +++ b/src/modules/blinds/blinds.c @@ -42,6 +42,19 @@ typedef struct blinds_context_t { } blinds_context_t; +static void blinds_update_taps(blinds_context_t *ctxt, til_stream_t *stream, unsigned ticks) +{ + if (!til_stream_tap_context(stream, &ctxt->til_module_context, NULL, &ctxt->taps.t)) + *ctxt->t = til_ticks_to_rads(ticks); + + if (!til_stream_tap_context(stream, &ctxt->til_module_context, NULL, &ctxt->taps.step)) + *ctxt->step = .1f; + + if (!til_stream_tap_context(stream, &ctxt->til_module_context, NULL, &ctxt->taps.count)) + *ctxt->count = ctxt->setup->count; +} + + static til_module_context_t * blinds_create_context(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup) { blinds_context_t *ctxt; @@ -56,6 +69,8 @@ static til_module_context_t * blinds_create_context(const til_module_t *module, ctxt->setup = (blinds_setup_t *)setup; + blinds_update_taps(ctxt, stream, ticks); + return &ctxt->til_module_context; } @@ -97,14 +112,7 @@ static void blinds_render_fragment(til_module_context_t *context, til_stream_t * unsigned blind; float t; - if (!til_stream_tap_context(stream, context, NULL, &ctxt->taps.t)) - *ctxt->t = til_ticks_to_rads(ticks); - - if (!til_stream_tap_context(stream, context, NULL, &ctxt->taps.step)) - *ctxt->step = .1f; - - if (!til_stream_tap_context(stream, context, NULL, &ctxt->taps.count)) - *ctxt->count = ctxt->setup->count; + blinds_update_taps(ctxt, stream, ticks); til_fb_fragment_clear(fragment); -- cgit v1.2.1