16 for (
int i = 0; i < max_stages_; ++i) {
20 stages_.push_back(stage);
37 stages_[0]->useOutput(
output());
38 for (
int i = 1; i < max_stages_; ++i) {
40 stages_[i]->useOutput(
output());
50 for (
int i = 0; i < max_stages_; ++i)
51 stages_[i]->
reset(reset_mask);
70 while(input_sample_rate > output_sample_rate) {
72 input_sample_rate /= 2;
80 if (num_stages == 0) {
86 if (num_stages != num_stages_) {
87 for (
int i = 0; i < num_stages; ++i)
90 num_stages_ = num_stages;
93 for (
int i = 0; i < max_stages_; ++i) {
95 bool should_enable = i < num_stages;
96 stage->
enable(should_enable);
100 int oversample_amount = 1 << (num_stages - i - 1);
Decimator(int max_stages=1)
Constructs a Decimator with a specified maximum number of halfband stages.
Definition decimator.cpp:14
virtual void process(int num_samples) override
Main audio processing routine that checks required decimation stages and processes them.
Definition decimator.cpp:63
void reset(poly_mask reset_mask) override
Resets all decimator stages for specified voices.
Definition decimator.cpp:49
@ kAudio
The main audio input to be decimated.
Definition decimator.h:26
virtual ~Decimator()
Destructor. Cleans up decimator stages.
Definition decimator.cpp:27
void init() override
Initializes the Decimator, hooking up audio connections for each stage.
Definition decimator.cpp:35
An IIR-based half-band decimator for downsampling audio by a factor of 2.
Definition iir_halfband_decimator.h:17
force_inline void setSharpCutoff(bool sharp_cutoff)
Enables or disables the sharper 25-tap cutoff mode.
Definition iir_halfband_decimator.h:83
@ kAudio
Main audio input for decimation.
Definition iir_halfband_decimator.h:44
virtual void setOversampleAmount(int oversample)
Sets the oversampling amount and updates the effective sample rate.
Definition processor.h:293
force_inline Input * input(unsigned int index=0) const
Retrieves the Input pointer at a given index.
Definition processor.h:587
force_inline int getSampleRate() const
Retrieves the current (effective) sample rate.
Definition processor.h:326
force_inline Output * output(unsigned int index=0) const
Retrieves the Output pointer at a given index.
Definition processor.h:616
virtual void enable(bool enable)
Enables or disables this Processor.
Definition processor.h:318
A specialized Processor that manages a directed graph of Processors and ensures correct processing or...
Definition processor_router.h:34
virtual void process(int num_samples) override
Processes audio through all Processors managed by this router.
Definition processor_router.cpp:57
virtual void addProcessor(Processor *processor)
Adds a Processor to be managed by this router.
Definition processor_router.cpp:121
#define VITAL_ASSERT(x)
Definition common.h:11
const poly_mask kFullMask
A mask covering all lanes of a poly_float vector.
Definition synth_constants.h:257
force_inline void copyBuffer(mono_float *dest, const mono_float *source, int size)
Copies data from a source mono buffer to a destination mono buffer.
Definition poly_utils.h:586
Contains classes and functions used within the Vital synthesizer framework.
Processor * owner
Owning processor.
Definition processor.h:112
Represents a vector of integer values using SIMD instructions.
Definition poly_values.h:56