|
Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Smoothed CV input with EWMA filtering and range scaling. More...
#include <input.hpp>
Public Member Functions | |
| CvInput (const CvInputConfig &config={}) | |
| CvInput (Smoothing smoothing) | |
| void | update (uint16_t raw) |
| Feed a new raw ADC sample. | |
| uint16_t | raw () const |
| Last raw (unfiltered) value. | |
| uint16_t | value () const |
| Current smoothed value (0–65535) | |
| int32_t | scaled (int32_t min, int32_t max) const |
| Map smoothed value to an output range (linear) | |
| int32_t | scaled_curved (int32_t min, int32_t max, uint16_t curve=dsp::curve::Log) const |
| Map smoothed value with curve shaping. | |
| void | reset () |
| Reset filter state. | |
Smoothed CV input with EWMA filtering and range scaling.
|
inlineexplicit |
|
inlineexplicit |
|
inline |
Last raw (unfiltered) value.
Definition at line 66 of file input.hpp.
Referenced by sbl::components::control::Pot::raw(), sbl::components::cv::VoctInput::raw(), and update().
|
inline |
Reset filter state.
Definition at line 106 of file input.hpp.
References sbl::primitives::math::Ewma::reset().
Referenced by sbl::components::control::Pot::reset(), and sbl::components::cv::VoctInput::reset().
|
inline |
Map smoothed value to an output range (linear)
Linear interpolation from [0, 65535] → [min, max]. Uses int64_t intermediate to avoid overflow. For non-linear mapping (frequency, filter cutoff), see scaled_curved().
| min | Output minimum (inclusive) |
| max | Output maximum (inclusive) |
Definition at line 82 of file input.hpp.
References sbl::primitives::math::Ewma::value().
|
inline |
Map smoothed value with curve shaping.
Applies ExpCurveWarp::warp() before scaling, useful for knob-friendly non-linear mapping (frequency, filter cutoff, gain).
| min | Output minimum (inclusive) |
| max | Output maximum (inclusive) |
| curve | Shape preset or arbitrary value (see sbl::dsp::curve) |
Definition at line 98 of file input.hpp.
References sbl::primitives::math::Ewma::value(), and sbl::dsp::ExpCurveWarp::warp().
|
inline |
Feed a new raw ADC sample.
Definition at line 60 of file input.hpp.
References raw(), and sbl::primitives::math::Ewma::update().
Referenced by sbl::cv::read(), sbl::cv::read_dma(), sbl::components::control::Pot::update(), and sbl::components::cv::VoctInput::update().
|
inline |
Current smoothed value (0–65535)
Definition at line 69 of file input.hpp.
References sbl::primitives::math::Ewma::value().
Referenced by sbl::cv::read(), sbl::cv::read_dma(), sbl::components::cv::VoctInput::semitones(), sbl::components::control::Pot::set_pickup(), sbl::components::control::Pot::update(), and sbl::components::cv::VoctInput::value().