Nu:Tekt NTS-1 digital SDK
v1.1-0
|
Go to the documentation of this file.
69 phi0(0x80000000), w0(0)
79 inline __attribute__((optimize(
"Ofast"),always_inline))
88 inline __attribute__((optimize(
"Ofast"),always_inline))
100 inline __attribute__((optimize(
"Ofast"),always_inline))
101 void
setF0(const
float f0, const
float fsrecip)
103 w0 = f32_to_q31(2.f * f0 * fsrecip);
111 inline __attribute__((optimize(
"Ofast"),always_inline))
114 w0 = f32_to_q31(2.f * w);
122 inline __attribute__((optimize(
"Ofast"),always_inline))
125 const float phif = q31_to_f32(phi0);
126 return 4 * phif * (
si_fabsf(phif) - 1.f);
132 inline __attribute__((optimize(
"Ofast"),always_inline))
135 const float phif = q31_to_f32(phi0);
136 return 0.5f + 2 * phif * (
si_fabsf(phif) - 1.f);
144 inline __attribute__((optimize(
"Ofast"),always_inline))
147 const float phi = q31_to_f32(phi0 + f32_to_q31(2*offset));
148 return 4 * phi * (
si_fabsf(phi) - 1.f);
156 inline __attribute__((optimize(
"Ofast"),always_inline))
159 const float phi = q31_to_f32(phi0 + f32_to_q31(2*offset));
160 return 0.5f + 2 * phi * (
si_fabsf(phi) - 1.f);
167 inline __attribute__((optimize(
"Ofast"),always_inline))
170 return q31_to_f32(qsub(q31abs(phi0),0x40000000)<<1);
176 inline __attribute__((optimize(
"Ofast"),always_inline))
187 inline __attribute__((optimize(
"Ofast"),always_inline))
190 const q31_t phi = phi0 + f32_to_q31(2*offset);
191 return q31_to_f32(qsub(q31abs(phi),0x40000000)<<1);
199 inline __attribute__((optimize(
"Ofast"),always_inline))
202 const float phi = q31_to_f32(phi0 + f32_to_q31(2*offset));
210 inline __attribute__((optimize(
"Ofast"),always_inline))
213 return q31_to_f32(phi0);
219 inline __attribute__((optimize(
"Ofast"),always_inline))
222 return q31_to_f32(qadd((phi0>>1),0x40000000));
230 inline __attribute__((optimize(
"Ofast"),always_inline))
233 const q31_t phi = phi0 + (f32_to_q31(offset)<<1);
234 return q31_to_f32(phi);
242 inline __attribute__((optimize(
"Ofast"),always_inline))
245 q31_t phi = phi0 + (f32_to_q31(offset)<<1);
246 return 0.5f * phi + 0.5f;
248 return q31_to_f32(qadd(phi,0x40000000));
255 inline __attribute__((optimize(
"Ofast"),always_inline))
258 return (phi0 < 0) ? -1.f : 1.f;
264 inline __attribute__((optimize(
"Ofast"),always_inline))
267 return (phi0 < 0) ? 0.f : 1.f;
275 inline __attribute__((optimize(
"Ofast"),always_inline))
278 const q31_t phi = phi0 + (f32_to_q31(offset)<<1);
279 return (phi < 0) ? -1.f : 1.f;
287 inline __attribute__((optimize(
"Ofast"),always_inline))
290 const q31_t phi = phi0 + (f32_to_q31(offset)<<1);
291 return (phi < 0) ? 0.f : 1.f;
float square_uni_off(const float offset)
Get current value of positive unipolar square wave for phase with offset.
Fixed Point Math Utilities.
float triangle_bi(void)
Get current value of bipolar triangle wave for current phase.
void reset(void)
Reset phase.
float triangle_bi_off(const float offset)
Get current value of bipolar triangle wave for phase with offset.
void setW0(const float w)
Set LFO frequency in radians.
float sine_bi_off(const float offset)
Get current value of bipolar sine wave for phase with offset.
float triangle_uni_off(const float offset)
Get current value of positive unipolar triangle wave for phase with offset.
Floating Point Math Utilities.
float triangle_uni(void)
Get value of positive unipolar triangle wave for current phase.
float square_bi_off(const float offset)
Get current value of bipolar square wave for phase with offset.
void setF0(const float f0, const float fsrecip)
Set LFO frequency.
SimpleLFO(void)
Default constructor.
float saw_uni_off(const float offset)
Get current value of positive unipolar saw wave for phase with offset.
float saw_bi(void)
Get current value of bipolar saw wave for current phase.
float square_uni(void)
Get value of positive unipolar square wave for current phase.
float square_bi(void)
Get current value of bipolar square wave for current phase.
float sine_uni(void)
Get value of positive unipolar sine wave for current phase.
float sine_bi(void)
Get value of bipolar sine wave for current phase.
float saw_uni(void)
Get value of positive unipolar saw wave for current phase.
static float si_fabsf(float x)
Absolute value.
float sine_uni_off(const float offset)
Get current value of positive unipolar sine wave for phase with offset.
void cycle(void)
Step phase one cycle forward.
float saw_bi_off(const float offset)
Get current value of bipolar saw wave for phase with offset.