Class thl::dsp::utils::LinearRamp#

class LinearRamp#

Lightweight linear ramp generator for block-based DSP interpolation.

LinearRamp emits size evenly spaced values from start towards target when next() is called once per sample. It does not mutate external state.

Public Functions

inline LinearRamp(float start, float target, size_t size) noexcept#

Create a ramp from start to target over size steps.

When size is 0, the increment is 0 and the ramp remains at start.

inline float next() noexcept#

Advance by one step and return the new value.

The first call returns start + increment, the n-th call returns target. This matches the original stmlib pre-increment convention.

inline float at_offset(float t) const noexcept#

Return a value at a fractional offset from the current ramp position.

Parameters:

t – Fractional sample offset relative to the current position.

inline float current_value() const noexcept#

Get the current internal ramp position.

inline float final_value() const noexcept#

Get the target value provided at construction time.

inline float increment() const noexcept#

Get the per-step increment.