summaryrefslogtreecommitdiffstats
path: root/src/osc_weird.c
blob: 143cc23d935e57b08b27386c1a096728c0b9fed9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "osc.h"

float osc_weird_fun(int index)
{
  return ((float)(index * index * index) / (200 * 200 * 200)) * 2 - 1;
}

osc_t OSC_weird = {
  .name = "f_weird",
  .len = 200
};

float
osc_weird(float offset)
{
  return osc_interpolate(offset,
                         osc_weird_fun((int)offset),
                         osc_weird_fun(osc_next_index(&OSC_weird, offset)));
}

float
osc_weird_next(float f, float offset)
{
  return osc_next_offset(&OSC_weird, f, offset);
}