FastLED 3.9.15
Loading...
Searching...
No Matches

◆ float_to_fixed()

int16_t fl::wave_detail::float_to_fixed ( float f)

Definition at line 20 of file wave_simulation_real.cpp.

20 {
21 f = fl::clamp(f, -1.0f, 1.0f);
22 if (f < 0.0f) {
23 return (int16_t)(f * INT16_NEG);
24 } else {
25 return (int16_t)(f * INT16_POS); // Round to nearest
26 }
27}
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
Definition clamp.h:10
#define INT16_NEG
#define INT16_POS

References fl::clamp(), INT16_NEG, and INT16_POS.

Referenced by fl::WaveSimulation1D_Real::WaveSimulation1D_Real(), fl::WaveSimulation2D_Real::WaveSimulation2D_Real(), fl::WaveSimulation1D_Real::set(), fl::WaveSimulation2D::setf(), fl::WaveSimulation2D_Real::setf(), fl::WaveSimulation1D_Real::setSpeed(), and fl::WaveSimulation2D_Real::setSpeed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: