summaryrefslogtreecommitdiffstats
path: root/src/osc_sqr.c
blob: 130ede66a6bf8b4601fb5a1b0aada553dfc7b620 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "osc.h"

osc_t OSC_sqr = {
  .name = "f_sqr",
  .len = 1,
  .start = 0,
};

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);
}