Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::components::cv::CvInput Class Reference

Smoothed CV input emitting normalized signal units. More...

Detailed Description

Smoothed CV input emitting normalized signal units.

Note
update()/update_dma() are ISR-safe (pure state machine, atomic 32-bit EWMA state on Cortex-M). Call update from exactly one context; getters are safe from another.

Definition at line 93 of file input.hpp.

#include <input.hpp>

Public Member Functions

 CvInput (const CvInputConfig &config={})
 
 CvInput (Smoothing smoothing)
 
void update (uint16_t raw)
 Feed a new raw ADC sample.
 
void update_dma (const uint16_t *buffer, uint8_t channel_index)
 Read one channel from a DMA scan buffer and update.
 
uint16_t raw () const
 Last raw (unfiltered) ADC count — for calibration routines.
 
float value () const
 Smoothed output in signal units, per the configured mapping.
 
void set_mapping (CvMapping mapping)
 Set the jack's musical role (structural; runtime-remappable)
 
CvMapping mapping () const
 
void set_conditioning (const CvConditioning &cond)
 Set the analog front-end description (once at init, typically)
 
const CvConditioning & conditioning () const
 
void set_smoothing (Smoothing smoothing)
 Change smoothing level without resetting filter state.
 
void reset ()
 Reset filter state.
 

Static Public Attributes

static constexpr float kSuPerVolt = 0.125f
 Pitch-su convention: 1.0 su spans 8 octaves (MIDI 24–120), 1 V/oct.
 

Constructor & Destructor Documentation

◆ CvInput() [1/2]

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

Definition at line 98 of file input.hpp.

◆ CvInput() [2/2]

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

Definition at line 101 of file input.hpp.

Member Function Documentation

◆ update()

void sbl::components::cv::CvInput::update ( uint16_t  raw)
inline

Feed a new raw ADC sample.

Definition at line 105 of file input.hpp.

References raw(), and sbl::primitives::math::Ewma::update().

Referenced by update_dma().

◆ update_dma()

void sbl::components::cv::CvInput::update_dma ( const uint16_t *  buffer,
uint8_t  channel_index 
)
inline

Read one channel from a DMA scan buffer and update.

Volatile cast forces a real memory read — DMA updates the buffer asynchronously. ISR-safe, non-blocking.

Definition at line 116 of file input.hpp.

References update().

◆ raw()

uint16_t sbl::components::cv::CvInput::raw ( ) const
inline

Last raw (unfiltered) ADC count — for calibration routines.

Definition at line 121 of file input.hpp.

Referenced by update().

◆ value()

float sbl::components::cv::CvInput::value ( ) const
inline

Smoothed output in signal units, per the configured mapping.

Definition at line 124 of file input.hpp.

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

◆ set_mapping()

void sbl::components::cv::CvInput::set_mapping ( CvMapping  mapping)
inline

Set the jack's musical role (structural; runtime-remappable)

Definition at line 127 of file input.hpp.

References mapping().

◆ mapping()

CvMapping sbl::components::cv::CvInput::mapping ( ) const
inline

Definition at line 129 of file input.hpp.

Referenced by set_mapping().

◆ set_conditioning()

void sbl::components::cv::CvInput::set_conditioning ( const CvConditioning &  cond)
inline

Set the analog front-end description (once at init, typically)

Definition at line 132 of file input.hpp.

◆ conditioning()

const CvConditioning & sbl::components::cv::CvInput::conditioning ( ) const
inline

Definition at line 134 of file input.hpp.

◆ set_smoothing()

void sbl::components::cv::CvInput::set_smoothing ( Smoothing  smoothing)
inline

Change smoothing level without resetting filter state.

Definition at line 137 of file input.hpp.

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

◆ reset()

void sbl::components::cv::CvInput::reset ( )
inline

Reset filter state.

Definition at line 142 of file input.hpp.

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

Member Data Documentation

◆ kSuPerVolt

constexpr float sbl::components::cv::CvInput::kSuPerVolt = 0.125f
staticconstexpr

Pitch-su convention: 1.0 su spans 8 octaves (MIDI 24–120), 1 V/oct.

Definition at line 96 of file input.hpp.


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