16 #include "mozzi_fixmath.h"
68 long out = ((((((long)in - (last_out>>8)) * a))>>8) + last_out);
105 unsigned int last_out;
124 uint8_t
next(uint8_t in)
126 unsigned int out = (((((int)in - (last_out>>8)) * a)) + last_out);
128 return (uint8_t)(out>>8);
181 int8_t
next(int8_t in)
183 int out = (((((int)in - (last_out>>8)) * a)) + last_out);
185 return (int8_t)(out>>8);
238 float out = last_out + a * (in - last_out);
273 template<
int8_t NI,
int8_t NF>
277 typedef UFix<NI, NF> internal_type;
278 internal_type last_out;
309 internal_type
next(internal_type in)
311 internal_type out = last_out + a * (in - last_out);
331 a=internal_type(1.f-smoothness);
342 a = UFix<1,0>(1) - smoothness;
351 template<
int8_t NI,
int8_t NF>
355 typedef SFix<NI, NF> internal_type;
356 internal_type last_out;
387 internal_type
next(internal_type in)
389 internal_type out = last_out + a * (in - last_out);
409 a=internal_type(1.f-smoothness);
420 a = UFix<1,0>(1) - smoothness;
void setSmoothness(float smoothness)
Sets how much smoothing the filter will apply to its input.
internal_type next(internal_type in)
Filters the input and returns the filtered value.
void setSmoothness(UFix< 0, _NF > smoothness)
Sets how much smoothing the filter will apply to its input.
Smooth(T smoothness)
Constructor.
void setSmoothness(UFix< 0, _NF > smoothness)
Sets how much smoothing the filter will apply to its input.
internal_type next(internal_type in)
Filters the input and returns the filtered value.
Smooth(T smoothness)
Constructor.
void setSmoothness(float smoothness)
Sets how much smoothing the filter will apply to its input.
A simple infinite impulse response low pass filter for smoothing control or audio signals.
T operator()(T n)
Filters the input and returns the filtered value.
void setSmoothness(float smoothness)
Sets how much smoothing the filter will apply to its input.
T next(T in)
Filters the input and returns the filtered value.
Smooth(float smoothness)
Constructor.
Q0n8 float_to_Q0n8(float a)
Convert float to Q0n8 fix.
uint8_t Q0n8
unsigned fractional number using 8 fractional bits, represents 0.0 to 0.996
uint16_t Q0n16
unsigned fractional number using 16 fractional bits, represents 0.0 to 0.999
Q0n16 float_to_Q0n16(float a)
Convert float to Q0n16 fix.