From 05fcdc986c2c3657f2c78eace807b2df8ef0b660 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Mon, 14 Aug 2023 06:18:44 -0700 Subject: modules/mixer: restrict randomized module settings This is mainly to prevent the mixer's b_module=compose default from always sending the randomizer down a deep nested compose scenario. But it's also just giving the mixer random variety in both a/b modules, while keeping compose out. This alone seems to go a long way towards preventing problematically deep randomized setups under rtv. --- src/modules/mixer/mixer.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src') diff --git a/src/modules/mixer/mixer.c b/src/modules/mixer/mixer.c index fbe2308..6f390b5 100644 --- a/src/modules/mixer/mixer.c +++ b/src/modules/mixer/mixer.c @@ -284,6 +284,34 @@ static void mixer_finish_frame(til_module_context_t *context, til_stream_t *stre } +static char * mixer_random_module_setting(unsigned seed) +{ + const char *candidates[] = { + "blinds", + "checkers", + "drizzle", + "julia", + "meta2d", + "moire", + "pixbounce", + "plasma", + "plato", + "roto", + "shapes", + "snow", + "sparkler", + "spiro", + "stars", + "submit", + "swab", + "swarm", + "voronoi", + }; + + return strdup(candidates[rand() % nelems(candidates)]); +} + + static void mixer_setup_free(til_setup_t *setup) { mixer_setup_t *s = (mixer_setup_t *)setup; @@ -351,6 +379,7 @@ static int mixer_setup(const til_settings_t *settings, til_setting_t **res_setti .key = input_keys[i], .preferred = input_preferred[i], .as_nested_settings = 1, + .random = mixer_random_module_setting, }, &inputs[i], res_setting, -- cgit v1.2.3