π nectarine
Audio synthesis tools for C23
Loading...
Searching...
No Matches
tgwaveforms.h
Go to the documentation of this file.
1
/*
2
* π nectarine - tgwaveforms.h
3
* Copyright (c) 2026 Fawn <rubiefawn@gmail.com>
4
*
5
* Permission to use, copy, modify, and distribute this software for any
6
* purpose with or without fee is hereby granted, provided that the above
7
* copyright notice and this permission notice appear in all copies.
8
*
9
* THE SOFTWARE IS PROVIDED βAS ISβ AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
*/
17
20
#pragma once
21
#include "
waveforms.h
"
22
23
#ifdef __cplusplus
24
#warning tgwaveforms.h uses C11's _Generic feature and should not be included in C++ files.
25
#else
26
28
#define nec_wrap(phase) _Generic((phase),\
29
long double : nec_wrapl,\
30
double : nec_wrap,\
31
float : nec_wrapf\
32
)(phase)
33
35
#define nec_fill_wrap(len, phase, output) _Generic((output),\
36
long double* : nec_fill_wrapl,\
37
double* : nec_fill_wrap,\
38
float* : nec_fill_wrapf\
39
)((len), (phase), (output))
40
42
#define nec_analog_sawtooth(phase) _Generic((phase),\
43
long double : nec_analog_sawtoothl,\
44
double : nec_analog_sawtooth,\
45
float : nec_analog_sawtoothf\
46
)(phase)
47
49
#define nec_fill_analog_sawtooth(len, phase, output) _Generic((output),\
50
long double* : nec_fill_analog_sawtoothl,\
51
double* : nec_fill_analog_sawtooth,\
52
float* : nec_fill_analog_sawtoothf\
53
)((len), (phase), (output))
54
56
#define nec_analog_square(phase, duty) _Generic((phase),\
57
long double : nec_analog_squarel,\
58
double : nec_analog_square,\
59
float : nec_analog_squaref\
60
)((phase), (duty))
61
63
#define nec_fill_analog_square(len, phase, duty, output) _Generic((output),\
64
long double* : nec_fill_analog_squarel,\
65
double* : nec_fill_analog_square,\
66
float* : nec_fill_analog_squaref\
67
)((len), (phase), (duty), (output))
68
70
#define nec_analog_triangle(phase) _Generic((phase),\
71
long double : nec_analog_trianglel,\
72
double : nec_analog_triangle,\
73
float : nec_analog_trianglef\
74
)(phase)
75
77
#define nec_fill_analog_triangle(len, phase, output) _Generic((output),\
78
long double* : nec_fill_analog_trianglel,\
79
double* : nec_fill_analog_triangle,\
80
float* : nec_fill_analog_trianglef\
81
)((len), (phase), (output))
82
84
#define nec_parabol(phase) _Generic((phase),\
85
long double : nec_paraboll,\
86
double : nec_parabol,\
87
float : nec_parabolf\
88
)(phase)
89
91
#define nec_fill_parabol(len, phase, output) _Generic((output),\
92
long double* : nec_fill_paraboll,\
93
double* : nec_fill_parabol,\
94
float* : nec_fill_parabolf\
95
)((len), (phase), (output))
96
98
#define nec_sin(phase) _Generic((phase),\
99
long double : nec_sinl,\
100
double : nec_sin,\
101
float : nec_sinf\
102
)(phase)
103
105
#define nec_fill_sin(len, phase, output) _Generic((output),\
106
long double* : nec_fill_sinl,\
107
double* : nec_fill_sin,\
108
float* : nec_fill_sinf\
109
)((len), (phase), (output))
110
112
#define nec_circle(phase) _Generic((phase),\
113
long double : nec_circlel,\
114
double : nec_circle,\
115
float : nec_circlef\
116
)(phase)
117
119
#define nec_fill_circle(len, phase, output) _Generic((output),\
120
long double* : nec_fill_circlel,\
121
double* : nec_fill_circle,\
122
float* : nec_fill_circlef\
123
)((len), (phase), (output))
124
126
#define nec_sawtooth(phase) _Generic((phase),\
127
long double : nec_sawtoothl,\
128
double : nec_sawtooth,\
129
float : nec_sawtoothf\
130
)(phase)
131
133
#define nec_fill_sawtooth(len, phase, output) _Generic((output),\
134
long double* : nec_fill_sawtoothl,\
135
double* : nec_fill_sawtooth,\
136
float* : nec_fill_sawtoothf\
137
)((len), (phase), (output))
138
140
#define nec_square(phase, duty) _Generic((phase),\
141
long double : nec_squarel,\
142
double : nec_square,\
143
float : nec_squaref\
144
)((phase), (duty))
145
147
#define nec_fill_square(len, phase, duty, output) _Generic((output),\
148
long double* : nec_fill_squarel,\
149
double* : nec_fill_square,\
150
float* : nec_fill_squaref\
151
)((len), (phase), (duty), (output))
152
154
#define nec_triangle(phase) _Generic((phase),\
155
long double : nec_trianglel,\
156
double : nec_triangle,\
157
float : nec_trianglef\
158
)(phase)
159
161
#define nec_fill_triangle(len, phase, output) _Generic((output),\
162
long double* : nec_fill_trianglel,\
163
double* : nec_fill_triangle,\
164
float* : nec_fill_trianglef\
165
)((len), (phase), (output))
166
167
#endif
waveforms.h
Waveform functions.
tgwaveforms.h
Generated by
1.16.1