summaryrefslogtreecommitdiff
path: root/src/modules/mixer
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-11-22 08:25:07 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-11-22 08:25:07 -0800
commit40551dcfadf1c6ef1a1d80ad08d35ef4b9557c66 (patch)
treeab72d964fbeea276a0d20d1cad429aa72e8cf47b /src/modules/mixer
parent6246ecb19b407d85768a5b1cbba2244ae5624a5d (diff)
modules/mixer: consider epsilon in fast-path edge cases
Near the fringes of 0,1 it should just be considered 0,1, which handles rounding error as well as slightly increasing the quantity of frames the fast path will tend to run on interpolated fades.
Diffstat (limited to 'src/modules/mixer')
-rw-r--r--src/modules/mixer/mixer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/mixer/mixer.c b/src/modules/mixer/mixer.c
index b6cc16c..fb62daf 100644
--- a/src/modules/mixer/mixer.c
+++ b/src/modules/mixer/mixer.c
@@ -151,17 +151,17 @@ static void mixer_prepare_frame(til_module_context_t *context, til_stream_t *str
case MIXER_STYLE_BLEND: {
float T = ctxt->vars.T;
- if (T < 1.f) {
+ if (T < .999f) {
til_module_render(ctxt->inputs[0].module_ctxt, stream, ticks, &fragment);
- if (T > 0.f)
+ if (T > 0.001f)
ctxt->snapshots[0] = til_fb_fragment_snapshot(&fragment, 0);
}
- if (T > 0.f) {
+ if (T > 0.001f) {
til_module_render(ctxt->inputs[1].module_ctxt, stream, ticks, &fragment);
- if (T < 1.f)
+ if (T < .999f)
ctxt->snapshots[1] = til_fb_fragment_snapshot(&fragment, 0);
}
break;
@@ -226,7 +226,7 @@ static void mixer_render_fragment(til_module_context_t *context, til_stream_t *s
float T = ctxt->vars.T;
float one_sub_T = 1.f - T;
- if (T <= 0.f || T >= 1.f)
+ if (T <= 0.001f || T >= .999f)
break;
assert(ctxt->snapshots[0]);
@@ -285,7 +285,7 @@ static void mixer_render_fragment(til_module_context_t *context, til_stream_t *s
til_fb_fragment_t *snapshot_a, *snapshot_b;
float T = ctxt->vars.T;
- if (T <= 0.f || T >= 1.f)
+ if (T <= 0.001f || T >= .999f)
break;
assert(ctxt->snapshots[0]);
© All Rights Reserved