23 T
lfo_impl(
double pos,
double period_length,
double speed,
double phase, T min, T max,
26 period_length /= std::abs( speed );
27 pos += phase * period_length;
28 pos = std::fmod( pos, period_length ) / period_length;
31 pos = std::fmod( 1 - pos, period_length ) - std::numeric_limits< double >::epsilon();
58 return 0.5 * ( max + min + ( max - min ) * value );
62 T
lfo( std::size_t pulse_count, std::size_t pulses_per_quarter_note,
int speed,
int phase,
65 const auto period_length = 4 * pulses_per_quarter_note * 128;
66 pulse_count %= std::size_t( period_length );
67 return lfo_impl< T >( pulse_count, period_length, speed, phase / 128.0, min, max, mode );
T lfo_impl(double pos, double period_length, double speed, double phase, T min, T max, lfo_mode mode)
Definition: lfo.hpp:23
T lfo(std::size_t pulse_count, std::size_t pulses_per_quarter_note, int speed, int phase, T min, T max, lfo_mode mode)
Definition: lfo.hpp:62
lfo_mode
Definition: lfo.hpp:11