11#ifndef MARVIN_LINEARSMOOTHEDVALUE_H
12#define MARVIN_LINEARSMOOTHEDVALUE_H
27 template <FloatType SampleType, SmoothingType Type>
44 void reset(
int stepsSamples,
bool skipRemaining =
true);
51 void reset(
double sampleRate,
double timeMs,
bool skipRemaining =
true);
90 int m_samplesRemaining{ 0 };
91 SampleType m_currentValue{
static_cast<SampleType
>(0.0) };
92 SampleType m_targetValue{
static_cast<SampleType
>(0.0) };
93 SampleType m_slew{
static_cast<SampleType
>(0.0) };
94 SampleType m_approxTarget{};
A utility class to smooth discrete values over a given period.
Definition marvin_SmoothedValue.h:28
bool isSmoothing() const noexcept
SampleType operator()() noexcept
void reset(int stepsSamples, bool skipRemaining=true)
int getRemainingSamples() const noexcept
void reset(double sampleRate, double timeMs, bool skipRemaining=true)
SampleType getTargetValue() const noexcept
void setCurrentAndTargetValue(SampleType newValue)
void setTargetValue(SampleType newValue)
Utility helper functions and classes.
Definition marvin_Utils.h:21
SmoothingType
Enum to configure SmoothedValue to either use linear smoothing, or exponential (lowpass) smoothing.
Definition marvin_SmoothedValue.h:18
@ Linear
Definition marvin_SmoothedValue.h:19
@ Exponential
Definition marvin_SmoothedValue.h:20