summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-11-21 20:52:32 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-11-21 20:52:32 -0800
commit0c25fbea454f6198c6958ce6be75fe31797b2b54 (patch)
treee0619baca63730bab8f6c2c3e3433e88cea211de /src
parent5a13b8135ec29adf65a8de492ded3c178deea9e0 (diff)
modules/mixer: some random small cleanups
No functional change except technically the ticks to rads modulo
Diffstat (limited to 'src')
-rw-r--r--src/modules/mixer/mixer.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/modules/mixer/mixer.c b/src/modules/mixer/mixer.c
index ebc7171..ecaa2b5 100644
--- a/src/modules/mixer/mixer.c
+++ b/src/modules/mixer/mixer.c
@@ -60,7 +60,7 @@ typedef struct mixer_setup_t {
static void mixer_update_taps(mixer_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 = cosf(ticks * .001f) * .5f + .5f;
+ *ctxt->T = cosf(til_ticks_to_rads(ticks)) * .5f + .5f;
else /* we're not driving the tap, so let's update our local copy just once */
ctxt->vars.T = *ctxt->T; /* FIXME: taps need synchronization/thread-safe details fleshed out / atomics */
}
@@ -143,6 +143,7 @@ static void mixer_prepare_frame(til_module_context_t *context, til_stream_t *str
if (T > 0.f) {
til_module_render(ctxt->inputs[1].module_ctxt, stream, ticks, &fragment);
+
if (T < 1.f)
ctxt->snapshots[1] = til_fb_fragment_snapshot(&fragment, 0);
}
@@ -410,14 +411,8 @@ static int mixer_setup(const til_settings_t *settings, til_setting_t **res_setti
if (!setup)
return -ENOMEM;
- for (i = 0; style_values[i]; i++) {
- if (!strcasecmp(style_values[i], style->value)) {
- setup->style = i;
- break;
- }
- }
-
- if (!style_values[i])
+ r = til_value_to_pos(style_values, style->value, (unsigned *)&setup->style);
+ if (r < 0)
return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, style, res_setting, -EINVAL);
for (i = 0; i < 2; i++) {
© All Rights Reserved