128 void setupFilter(
const FilterState& filter_state)
override;
135 virtual void process(
int num_samples)
override;
143 template<poly_
float(*tick)(poly_
float, Memory*, OnePoleFilter<>&, OnePoleFilter<>&,
144 poly_
float, poly_
float, poly_
float, poly_
float,
145 poly_
float, poly_
float, poly_
float)>
A Processor implementing a comb-based filter with multiple feedback styles.
Definition comb_filter.h:18
poly_float scale_
Scaling multiplier applied to the incoming audio or feedback path.
Definition comb_filter.h:246
static constexpr mono_float kInputScale
Scaling factor for the comb filter input signal.
Definition comb_filter.h:84
static constexpr int kNumFilterTypes
Total number of distinct filter types (FeedbackStyle x FilterStyle).
Definition comb_filter.h:64
poly_float getResonance()
Getter for the feedback parameter controlling comb/flange feedback amount.
Definition comb_filter.h:172
static constexpr mono_float kBandOctaveRange
Range of band spread in octaves.
Definition comb_filter.h:69
virtual void process(int num_samples) override
Processes a block of samples, choosing the appropriate feedback style to apply.
Definition comb_filter.cpp:301
poly_float filter2_midi_cutoff_
MIDI note value controlling the secondary filter’s cutoff frequency (in band-spread mode).
Definition comb_filter.h:256
poly_float feedback_
Current feedback amount for the comb/flange filter.
Definition comb_filter.h:221
std::unique_ptr< Memory > memory_
Pointer to the Memory buffer used for the comb delay line.
Definition comb_filter.h:206
poly_float getHighAmount()
Getter for the high-frequency gain used in filter blending.
Definition comb_filter.h:186
static constexpr mono_float kBandOctaveMin
Minimum band spread in octaves.
Definition comb_filter.h:74
poly_float max_period_
The computed maximum delay period based on input frequency and sample rate.
Definition comb_filter.h:216
void setupFilter(const FilterState &filter_state) override
Sets up the CombFilter state based on a FilterState struct.
Definition comb_filter.cpp:229
void hardReset() override
Resets the filter completely for all voices.
Definition comb_filter.cpp:220
FeedbackStyle feedback_style_
Current feedback style (comb, positive flange, negative flange).
Definition comb_filter.h:211
virtual Processor * clone() const override
Creates a clone of this filter by invoking the copy constructor.
Definition comb_filter.h:117
CombFilter(int size=kMinPeriod)
Constructs a CombFilter with a given memory buffer size.
Definition comb_filter.cpp:158
OnePoleFilter feedback_filter_
One-pole filter for the feedback path (first stage).
Definition comb_filter.h:261
static FilterStyle getFilterStyle(int style)
Converts an integer to a valid FilterStyle, taking advantage of the style integer layout.
Definition comb_filter.h:57
static constexpr mono_float kMaxFeedback
Maximum allowable feedback amount.
Definition comb_filter.h:89
poly_float getFilterMidiCutoff()
Getter for the primary filter MIDI cutoff.
Definition comb_filter.h:193
poly_float filter2_coefficient_
Secondary coefficient for the band-spread or second filter stage.
Definition comb_filter.h:231
poly_float filter_coefficient_
Coefficient for the one-pole feedback filter (low pass).
Definition comb_filter.h:226
poly_float getLowAmount()
Getter for the low-frequency gain used in filter blending.
Definition comb_filter.h:179
FilterStyle
Types of filter styles (blend of low/high, band spread).
Definition comb_filter.h:35
@ kLowHighBlend
Blend low and high output from filter.
Definition comb_filter.h:36
@ kBandSpread
Spread the band around center frequency.
Definition comb_filter.h:37
@ kNumFilterStyles
Definition comb_filter.h:38
static constexpr int kMinPeriod
Minimum period for the comb filter delay line.
Definition comb_filter.h:79
virtual ~CombFilter()
Destructor. Cleans up allocated memory.
Definition comb_filter.cpp:194
poly_float getFilter2MidiCutoff()
Getter for the secondary filter MIDI cutoff (used in band-spread style).
Definition comb_filter.h:200
poly_float filter_midi_cutoff_
MIDI note value controlling the main filter’s cutoff frequency.
Definition comb_filter.h:251
OnePoleFilter feedback_filter2_
One-pole filter for the feedback path (second stage in certain styles).
Definition comb_filter.h:266
FeedbackStyle
Types of feedback for the comb filter (comb, positive/negative flange).
Definition comb_filter.h:24
@ kComb
Standard comb filtering.
Definition comb_filter.h:25
@ kPositiveFlange
Positive flanging effect.
Definition comb_filter.h:26
@ kNegativeFlange
Negative flanging effect.
Definition comb_filter.h:27
@ kNumFeedbackStyles
Definition comb_filter.h:28
poly_float getDrive()
Getter for the drive (scale) parameter controlling input amplitude scaling.
Definition comb_filter.h:165
void reset(poly_mask reset_mask) override
Resets the filter state, clearing memory and reinitializing variables.
Definition comb_filter.cpp:201
poly_float high_gain_
Gain applied to the high output in the low/high blend mode.
Definition comb_filter.h:241
void processFilter(int num_samples)
A templated function to handle processing for each feedback style implementation.
Definition comb_filter.cpp:326
poly_float low_gain_
Gain applied to the low output in the low/high blend mode.
Definition comb_filter.h:236
static FeedbackStyle getFeedbackStyle(int style)
Converts an integer to a valid FeedbackStyle, wrapping around kNumFeedbackStyles.
Definition comb_filter.h:47
A one-pole filter implementation with optional nonlinear saturation.
Definition one_pole_filter.h:22
Base class for all signal-processing units in Vital.
Definition processor.h:212
Abstract base class for Vital’s synthesizer filters.
Definition synth_filter.h:19
Declares classes for time-domain memory storage and retrieval with cubic interpolation.
Contains classes and functions used within the Vital synthesizer framework.
float mono_float
Definition common.h:33
Declares the Processor class and related structures for handling audio processing in a polyphonic con...
Represents a vector of floating-point values using SIMD instructions.
Definition poly_values.h:600
Represents a vector of integer values using SIMD instructions.
Definition poly_values.h:56