From a7c39399e3ec051f210d9e991fe0112d0f988817 Mon Sep 17 00:00:00 2001 From: gramanas Date: Thu, 14 Sep 2023 23:49:54 +0300 Subject: Add sqr osc file --- src/osc_sqr.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/osc_sqr.c diff --git a/src/osc_sqr.c b/src/osc_sqr.c new file mode 100644 index 0000000..9b68059 --- /dev/null +++ b/src/osc_sqr.c @@ -0,0 +1,20 @@ +#include "osc.h" + +osc_t OSC_sqr = { + .name = "f_sqr", + .len = 1, + .start = 0, + .end = 1, +}; + +float +osc_sqr(float offset) +{ + return offset < 0.5 ? -1 : 1; +} + +float +osc_sqr_next(float f, float offset) +{ + return osc_next_offset(&OSC_sqr, f, offset); +} -- cgit v1.2.3