summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-02-03 15:15:19 -0800
committerVito Caputo <vcaputo@pengaru.com>2020-02-03 15:15:19 -0800
commit6c357aefb327faeb6eca8809a6a60d0349dfc076 (patch)
tree0e41903249ace928cf19f106a11a59ac3fafd296 /src
parentda8c82023ed772ab91a71d034d8995373704f58e (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/libs/sig/ops_sin.c2
1 files changed, 1 insertions, 1 deletions
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;
}
© All Rights Reserved