diff options
-rw-r--r-- | src/osc_sqr.c | 20 |
1 files changed, 20 insertions, 0 deletions
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); +} |