blob: b71a9e311fda837284bdb0059a3b8cdb9bb00c68 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#include "osc.h"
osc_t OSC_digisaw = MAKE_OSC("f_digisaw", 21, WAVE);
OSC_COMMON(digisaw)
static float
digisaw(int index)
{
if (index == 0) return -1.0f;
else if (index == 1) return -0.9f;
else if (index == 2) return -0.8f;
else if (index == 3) return -0.7f;
else if (index == 4) return -0.6f;
else if (index == 5) return -0.5f;
else if (index == 6) return -0.4f;
else if (index == 7) return -0.3f;
else if (index == 8) return -0.2f;
else if (index == 9) return -0.1f;
else if (index == 10) return 0.0f;
else if (index == 11) return 0.1f;
else if (index == 12) return 0.2f;
else if (index == 13) return 0.3f;
else if (index == 14) return 0.4f;
else if (index == 15) return 0.5f;
else if (index == 16) return 0.6f;
else if (index == 17) return 0.7f;
else if (index == 18) return 0.8f;
else if (index == 19) return 0.9f;
else if (index == 20) return 1.0f;
}
float
osc_digisaw(float offset)
{
return osc_interpolate(offset,
digisaw((int)offset),
digisaw(osc_next_index(&OSC_digisaw, offset)));
}
float
osc_digisaw_next(float f, float offset)
{
return osc_next_offset(&OSC_digisaw, f, offset);
}
|