summaryrefslogblamecommitdiffstats
path: root/src/osc_sqr.c
blob: 9b680592374ed917299cfdf70a6cee696715fc42 (plain) (tree)



















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