summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-08-14 06:18:44 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-08-14 06:18:44 -0700
commit05fcdc986c2c3657f2c78eace807b2df8ef0b660 (patch)
tree639de801d0e234d22ce80035a63305c733c2efba /src
parentb58ffca50742350f05978fe1e698da4e452d8176 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/modules/mixer/mixer.c29
1 files changed, 29 insertions, 0 deletions
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,
© All Rights Reserved