summaryrefslogtreecommitdiffstats
path: root/src/osc_sqr.c
blob: 9b680592374ed917299cfdf70a6cee696715fc42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);
}