Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::components::cv::CvInput Class Reference

Smoothed CV input with EWMA filtering and range scaling. More...

#include <input.hpp>

Collaboration diagram for sbl::components::cv::CvInput:

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.
 

Detailed Description

Smoothed CV input with EWMA filtering and range scaling.

Note
All public methods are ISR-safe — pure state machine with no hardware I/O.

Definition at line 51 of file input.hpp.

Constructor & Destructor Documentation

◆ CvInput() [1/2]

sbl::components::cv::CvInput::CvInput ( const CvInputConfig config = {})
inlineexplicit

Definition at line 53 of file input.hpp.

◆ CvInput() [2/2]

sbl::components::cv::CvInput::CvInput ( Smoothing  smoothing)
inlineexplicit

Definition at line 56 of file input.hpp.

Member Function Documentation

◆ raw()

uint16_t sbl::components::cv::CvInput::raw ( ) const
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().

Here is the caller graph for this function:

◆ reset()

void sbl::components::cv::CvInput::reset ( )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scaled()

int32_t sbl::components::cv::CvInput::scaled ( int32_t  min,
int32_t  max 
) const
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().

Parameters
minOutput minimum (inclusive)
maxOutput maximum (inclusive)
Returns
Scaled value in [min, max]

Definition at line 82 of file input.hpp.

References sbl::primitives::math::Ewma::value().

Here is the call graph for this function:

◆ scaled_curved()

int32_t sbl::components::cv::CvInput::scaled_curved ( int32_t  min,
int32_t  max,
uint16_t  curve = dsp::curve::Log 
) const
inline

Map smoothed value with curve shaping.

Applies ExpCurveWarp::warp() before scaling, useful for knob-friendly non-linear mapping (frequency, filter cutoff, gain).

Parameters
minOutput minimum (inclusive)
maxOutput maximum (inclusive)
curveShape preset or arbitrary value (see sbl::dsp::curve)
Returns
Scaled value in [min, max]

Definition at line 98 of file input.hpp.

References sbl::primitives::math::Ewma::value(), and sbl::dsp::ExpCurveWarp::warp().

Here is the call graph for this function:

◆ update()

void sbl::components::cv::CvInput::update ( uint16_t  raw)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ value()

uint16_t sbl::components::cv::CvInput::value ( ) const
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().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: