summaryrefslogtreecommitdiff
path: root/src/libs/sig/sig.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-02-03 14:28:51 -0800
committerVito Caputo <vcaputo@pengaru.com>2020-02-03 14:31:20 -0800
commit54f6812ecb6469f7c3008ee0246a20f6d8cc1c46 (patch)
tree1ba96c881d058874ff2f99ea7815b56289ec4f1c /src/libs/sig/sig.c
parent53ff16348973deef1295e123b20a218eb6b7e339 (diff)
libs/sig: add ops_{abs,ceil,floor,pow,round}
Added a simple test exercising pow and round
Diffstat (limited to 'src/libs/sig/sig.c')
-rw-r--r--src/libs/sig/sig.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libs/sig/sig.c b/src/libs/sig/sig.c
index 865c6b4..4146cd3 100644
--- a/src/libs/sig/sig.c
+++ b/src/libs/sig/sig.c
@@ -119,6 +119,19 @@ int main(int argc, char *argv[])
for (unsigned i = 0; i < 1000; i++)
printf("sin 100hz * 1hz output %i=%f\n", i, sig_output(sig, i));
sig = sig_free(sig);
+
+ sig = sig_new(&sig_ops_pow, /* raise an ... */
+ sig_new(&sig_ops_sin, /* oscillator ... */
+ sig_new(&sig_ops_const, 10.f)), /* @ 10hz, */
+ sig_new(&sig_ops_round, /* to a rounded .. */
+ sig_new(&sig_ops_mult, sig_new(&sig_ops_const, 50.f), /* 50 X ... */
+ sig_new(&sig_ops_sin, sig_new(&sig_ops_const, 1.f)) /* 1hz oscillator */
+ )
+ )
+ );
+ for (unsigned i = 0; i < 1000; i++)
+ printf("sin 10hz ^ (sin 1hz * 50) output %i=%f\n", i, sig_output(sig, i));
+ sig = sig_free(sig);
}
#endif
© All Rights Reserved