🍑 nectarine
Audio synthesis tools for C23
Loading...
Searching...
No Matches
tgwaveforms.h
Go to the documentation of this file.
1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
7#pragma once
8#include "waveforms.h"
9
10#ifdef __cplusplus
11 #warning tgwaveforms.h uses C11's _Generic feature and should not be included in C++ files.
12#else
13
15#define nec_wrap(phase) _Generic((phase),\
16 long double : nec_wrapl,\
17 double : nec_wrap,\
18 float : nec_wrapf\
19)(phase)
20
22#define nec_fill_wrap(len, phase, output) _Generic((output),\
23 long double* : nec_fill_wrapl,\
24 double* : nec_fill_wrap,\
25 float* : nec_fill_wrapf\
26)((len), (phase), (output))
27
29#define nec_analog_sawtooth(phase) _Generic((phase),\
30 long double : nec_analog_sawtoothl,\
31 double : nec_analog_sawtooth,\
32 float : nec_analog_sawtoothf\
33)(phase)
34
36#define nec_fill_analog_sawtooth(len, phase, output) _Generic((output),\
37 long double* : nec_fill_analog_sawtoothl,\
38 double* : nec_fill_analog_sawtooth,\
39 float* : nec_fill_analog_sawtoothf\
40)((len), (phase), (output))
41
43#define nec_analog_square(phase, duty) _Generic((phase),\
44 long double : nec_analog_squarel,\
45 double : nec_analog_square,\
46 float : nec_analog_squaref\
47)((phase), (duty))
48
50#define nec_fill_analog_square(len, phase, duty, output) _Generic((output),\
51 long double* : nec_fill_analog_squarel,\
52 double* : nec_fill_analog_square,\
53 float* : nec_fill_analog_squaref\
54)((len), (phase), (duty), (output))
55
57#define nec_analog_triangle(phase) _Generic((phase),\
58 long double : nec_analog_trianglel,\
59 double : nec_analog_triangle,\
60 float : nec_analog_trianglef\
61)(phase)
62
64#define nec_fill_analog_triangle(len, phase, output) _Generic((output),\
65 long double* : nec_fill_analog_trianglel,\
66 double* : nec_fill_analog_triangle,\
67 float* : nec_fill_analog_trianglef\
68)((len), (phase), (output))
69
71#define nec_parabol(phase) _Generic((phase),\
72 long double : nec_paraboll,\
73 double : nec_parabol,\
74 float : nec_parabolf\
75)(phase)
76
78#define nec_fill_parabol(len, phase, output) _Generic((output),\
79 long double* : nec_fill_paraboll,\
80 double* : nec_fill_parabol,\
81 float* : nec_fill_parabolf\
82)((len), (phase), (output))
83
85#define nec_sin(phase) _Generic((phase),\
86 long double : nec_sinl,\
87 double : nec_sin,\
88 float : nec_sinf\
89)(phase)
90
92#define nec_fill_sin(len, phase, output) _Generic((output),\
93 long double* : nec_fill_sinl,\
94 double* : nec_fill_sin,\
95 float* : nec_fill_sinf\
96)((len), (phase), (output))
97
99#define nec_circle(phase) _Generic((phase),\
100 long double : nec_circlel,\
101 double : nec_circle,\
102 float : nec_circlef\
103)(phase)
104
106#define nec_fill_circle(len, phase, output) _Generic((output),\
107 long double* : nec_fill_circlel,\
108 double* : nec_fill_circle,\
109 float* : nec_fill_circlef\
110)((len), (phase), (output))
111
113#define nec_sawtooth(phase) _Generic((phase),\
114 long double : nec_sawtoothl,\
115 double : nec_sawtooth,\
116 float : nec_sawtoothf\
117)(phase)
118
120#define nec_fill_sawtooth(len, phase, output) _Generic((output),\
121 long double* : nec_fill_sawtoothl,\
122 double* : nec_fill_sawtooth,\
123 float* : nec_fill_sawtoothf\
124)((len), (phase), (output))
125
127#define nec_square(phase, duty) _Generic((phase),\
128 long double : nec_squarel,\
129 double : nec_square,\
130 float : nec_squaref\
131)((phase), (duty))
132
134#define nec_fill_square(len, phase, duty, output) _Generic((output),\
135 long double* : nec_fill_squarel,\
136 double* : nec_fill_square,\
137 float* : nec_fill_squaref\
138)((len), (phase), (duty), (output))
139
141#define nec_triangle(phase) _Generic((phase),\
142 long double : nec_trianglel,\
143 double : nec_triangle,\
144 float : nec_trianglef\
145)(phase)
146
148#define nec_fill_triangle(len, phase, output) _Generic((output),\
149 long double* : nec_fill_trianglel,\
150 double* : nec_fill_triangle,\
151 float* : nec_fill_trianglef\
152)((len), (phase), (output))
153
154#endif
Waveform functions.