6#ifndef SBL_DSP_SMOOTHING_RAMP_HPP_
7#define SBL_DSP_SMOOTHING_RAMP_HPP_
39 void set_length(uint16_t frames) { length_ = frames == 0 ? 1 : frames; }
54 increment_ = (target_ - value_) /
static_cast<float>(length_);
93 if (--remaining_ == 0) {
101 float value()
const {
return value_; }
105 bool ramping()
const {
return remaining_ > 0; }
110 float increment_ = 0.0f;
111 uint16_t length_ = 1;
112 uint16_t remaining_ = 0;
A linear ramp to a target over a fixed number of frames.
float target() const
The value the ramp heads for.
void set(float target)
Head for a target from the current value.
Ramp(float value=0.0f)
A ramp at rest at a value, with a length of 1 frame.
void head(float target)
set(), except that the first value given since construction, by head() or jump(), is arrived at at on...
float value() const
The current value.
void jump(float value)
Arrive at a value at once.
void set_length(uint16_t frames)
Set how many frames a ramp takes.
bool ramping() const
True while a ramp is in progress.