Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Classes | Namespaces
pot.hpp File Reference

Potentiometer component — smoothed ADC with deadband + change detection. More...

#include <cstdint>
#include <sbl/components/cv/input.hpp>
#include <sbl/dsp/warp.hpp>
Include dependency graph for pot.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sbl::components::control::PotConfig
 
class  sbl::components::control::Pot
 Potentiometer with EWMA smoothing, deadband, and change detection. More...
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs functionality.
 
namespace  sbl::components
 Mid-level functional components.
 
namespace  sbl::components::control
 Physical control components.
 

Detailed Description

Potentiometer component — smoothed ADC with deadband + change detection.

Pot wraps CvInput (EWMA smoothing) and adds deadband suppression so that small ADC noise doesn't register as parameter changes. After EWMA filtering, the stable value only updates when the smoothed reading moves past the deadband threshold.

Pickup mode

For multi-mode control mappings where the same knob controls different parameters depending on held buttons, call set_pickup(target) on mode switch. The output freezes at target until the physical knob crosses that value, then resumes normal tracking. This prevents parameter jumps.

Usage: sbl::components::control::Pot knob; knob.update(raw_adc_value); int32_t freq = knob.scaled(20, 20000); if (knob.changed()) { ... value moved past deadband ... }

// On mode switch: knob.set_pickup(saved_position); // freeze until knob catches up if (!knob.picked_up()) { ... show LED feedback ... }

Definition in file pot.hpp.