From 6c357aefb327faeb6eca8809a6a60d0349dfc076 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Mon, 3 Feb 2020 15:15:19 -0800 Subject: libs/sig: fixup sig_ops_sin to stay within 0-1 The whole idea was to produce values 0-1, except of course sig_ops_{mult,const} where one could deliberately get out of these bounds. Everything else should stay within 0-1 as it makes everything much more composable. --- src/libs/sig/ops_sin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/sig/ops_sin.c b/src/libs/sig/ops_sin.c index fa9dfa5..17f08cf 100644 --- a/src/libs/sig/ops_sin.c +++ b/src/libs/sig/ops_sin.c @@ -52,7 +52,7 @@ static float ops_sin_output(void *context, unsigned ticks_ms) rads_per_ms = (M_PI * 2.f) * hz * .001f; rads = (float)(ticks_ms % ms_per_cycle) * rads_per_ms; - return sinf(rads); + return sinf(rads) * .5f + .5f; } -- cgit v1.2.1