diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2023-09-14 23:49:54 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2023-09-14 23:49:54 +0300 |
commit | a7c39399e3ec051f210d9e991fe0112d0f988817 (patch) | |
tree | fe22b9e8b13ec3053cecca006ffaa88912188776 /src | |
parent | 51821bb2e9b67fc70486a4ee8dcbc88971adc3b6 (diff) | |
download | synth-project-a7c39399e3ec051f210d9e991fe0112d0f988817.tar.gz synth-project-a7c39399e3ec051f210d9e991fe0112d0f988817.tar.bz2 synth-project-a7c39399e3ec051f210d9e991fe0112d0f988817.zip |
Add sqr osc file
Diffstat (limited to 'src')
-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); +} |