24#ifndef SBL_DSP_COMP_FADER_HPP_
25#define SBL_DSP_COMP_FADER_HPP_
47 if (su < 0.0f) su = 0.0f;
48 if (su > 1.0f) su = 1.0f;
50 target_gain_ = apply_taper(su);
57 target_gain_ = apply_taper(level_su_);
64 for (uint16_t i = 0; i < n; ++i) {
65 float g = smoother_.
process(target_gain_);
72 void process(
float* buf_l,
float* buf_r, uint16_t n) {
74 for (uint16_t i = 0; i < n; ++i) {
75 float g = smoother_.
process(target_gain_);
95 float level()
const {
return level_su_; }
101 target_gain_ = apply_taper(level_su_);
102 smoother_.
reset(target_gain_);
103 smoother_configured_ =
false;
107 float apply_taper(
float su)
const {
116 void ensure_smoother() {
117 if (!smoother_configured_) {
119 smoother_.
reset(target_gain_);
120 smoother_configured_ =
true;
125 float level_su_ = 1.0f;
126 float target_gain_ = 1.0f;
127 primitives::ParameterSmoother smoother_;
128 bool smoother_configured_ =
false;
static constexpr float kSettlingMs
float gain() const
Current smoothed gain value (after taper mapping + smoothing).
void reset()
Reset smoother state and level to defaults.
float level() const
Raw su level (before taper mapping).
void set_level_su(float su)
void process(float *buf_l, float *buf_r, uint16_t n)
void process(float *buf, uint16_t n)
void reset()
Reset to zero.
void set_time_ms(float ms, float rate_hz)
Compute coefficient from settling time in milliseconds.
float process_steps(float target, uint32_t n)
Advance n steps toward target in one call.
float process(float target)
Process one sample toward target.
float value() const
Current smoothed value.
Fixed-point constants and audio sample types.
Compositions: subcircuits of primitives.
One-pole parameter smoother.