74 virtual void process(
int num_samples)
override;
261 virtual void process(
int num_samples)
override;
A dynamic range compressor Processor that operates on a single band of audio.
Definition compressor.h:16
poly_float base_release_ms_
Base release time in ms for the current voice.
Definition compressor.h:165
virtual ~Compressor()
Default destructor.
Definition compressor.h:60
poly_float input_mean_squared_
Rolling mean squared value of the input signal.
Definition compressor.h:135
Compressor(mono_float base_attack_ms_first, mono_float base_release_ms_first, mono_float base_attack_ms_second, mono_float base_release_ms_second)
Constructs a Compressor Processor with given base attack and release times.
Definition compressor.cpp:60
@ kNumOutputs
Total number of outputs.
Definition compressor.h:41
@ kAudioOut
Compressed audio output.
Definition compressor.h:40
poly_float high_enveloped_mean_squared_
Internal high enveloped mean squared value for upper threshold detection.
Definition compressor.h:145
void processRms(const poly_float *audio_in, int num_samples)
Processes RMS for the input buffer and applies compression gain.
Definition compressor.cpp:110
void scaleOutput(const poly_float *audio_input, int num_samples)
Applies the final output scaling and dry/wet mix to the processed audio.
Definition compressor.cpp:192
poly_float computeMeanSquared(const poly_float *audio_in, int num_samples, poly_float mean_squared)
Computes the mean squared value over a buffer of samples.
Definition compressor.cpp:239
poly_float output_mean_squared_
Rolling mean squared value of the output signal.
Definition compressor.h:140
poly_float low_enveloped_mean_squared_
Internal low enveloped mean squared value for lower threshold detection.
Definition compressor.h:150
poly_float base_attack_ms_
Base attack time in ms for the current voice.
Definition compressor.h:160
void reset(poly_mask reset_mask) override
Resets internal states and envelopes.
Definition compressor.cpp:222
force_inline poly_float getOutputMeanSquared()
Retrieves the current output RMS value (mean squared).
Definition compressor.h:119
virtual void processWithInput(const poly_float *audio_in, int num_samples) override
Processes audio using the provided input buffer and writes to output.
Definition compressor.cpp:95
poly_float mix_
The current dry/wet mix (0.0 = fully dry, 1.0 = fully wet).
Definition compressor.h:155
virtual Processor * clone() const override
Creates a clone of this Processor. (Not implemented for Compressor).
Definition compressor.h:67
@ kMix
Dry/Wet mix.
Definition compressor.h:31
@ kUpperRatio
Upper ratio (compression ratio above upper threshold)
Definition compressor.h:26
@ kAudio
Input audio signal.
Definition compressor.h:23
@ kUpperThreshold
Upper threshold in dB.
Definition compressor.h:24
@ kLowerThreshold
Lower threshold in dB.
Definition compressor.h:25
@ kRelease
Release time control (0.0 to 1.0 maps to exponential range)
Definition compressor.h:30
@ kAttack
Attack time control (0.0 to 1.0 maps to exponential range)
Definition compressor.h:29
@ kOutputGain
Output gain (dB)
Definition compressor.h:28
@ kLowerRatio
Lower ratio (expansion ratio below lower threshold)
Definition compressor.h:27
@ kNumInputs
Total number of inputs.
Definition compressor.h:32
virtual void process(int num_samples) override
Processes audio using the input audio buffer, modifying output buffer in-place.
Definition compressor.cpp:83
poly_float output_mult_
Current multiplier for output gain (converted from dB).
Definition compressor.h:170
force_inline poly_float getInputMeanSquared()
Retrieves the current input RMS value (mean squared).
Definition compressor.h:112
A Linkwitz-Riley crossover filter splitting audio into low and high bands.
Definition linkwitz_riley_filter.h:17
A Processor implementing multiband compression using multiple Compressor instances.
Definition compressor.h:182
LinkwitzRileyFilter band_high_filter_
A Linkwitz-Riley filter splitting audio into band and high bands.
Definition compressor.h:368
OutputType
Definition compressor.h:228
@ kNumOutputs
Total number of outputs.
Definition compressor.h:236
@ kHighOutputMeanSquared
High band output mean squared.
Definition compressor.h:235
@ kLowOutputMeanSquared
Low band output mean squared.
Definition compressor.h:233
@ kBandOutputMeanSquared
Band output mean squared.
Definition compressor.h:234
@ kLowInputMeanSquared
Low band input mean squared.
Definition compressor.h:230
@ kBandInputMeanSquared
Band input mean squared.
Definition compressor.h:231
@ kAudioOut
Combined compressed output.
Definition compressor.h:229
@ kHighInputMeanSquared
High band input mean squared.
Definition compressor.h:232
cr::Output low_band_upper_threshold_
Definition compressor.h:349
@ kHighUpperThreshold
Upper threshold (dB) for high band.
Definition compressor.h:198
@ kLowLowerThreshold
Lower threshold (dB) for low band.
Definition compressor.h:199
@ kEnabledBands
Enabled bands (see BandOptions)
Definition compressor.h:207
@ kHighUpperRatio
Upper ratio for high band.
Definition compressor.h:192
@ kLowUpperThreshold
Upper threshold (dB) for low band.
Definition compressor.h:196
@ kHighLowerThreshold
Lower threshold (dB) for high band.
Definition compressor.h:201
@ kBandUpperRatio
Upper ratio for band.
Definition compressor.h:191
@ kHighOutputGain
Output gain (dB) for high band.
Definition compressor.h:204
@ kBandLowerThreshold
Lower threshold (dB) for band.
Definition compressor.h:200
@ kAttack
Global attack control.
Definition compressor.h:205
@ kLowLowerRatio
Lower ratio for low band.
Definition compressor.h:193
@ kNumInputs
Total number of inputs.
Definition compressor.h:209
@ kRelease
Global release control.
Definition compressor.h:206
@ kMix
Dry/wet mix for all bands.
Definition compressor.h:208
@ kBandUpperThreshold
Upper threshold (dB) for band.
Definition compressor.h:197
@ kAudio
Input audio signal.
Definition compressor.h:189
@ kBandOutputGain
Output gain (dB) for band.
Definition compressor.h:203
@ kLowUpperRatio
Upper ratio for low band.
Definition compressor.h:190
@ kHighLowerRatio
Lower ratio for high band.
Definition compressor.h:195
@ kLowOutputGain
Output gain (dB) for low band.
Definition compressor.h:202
@ kBandLowerRatio
Lower ratio for band.
Definition compressor.h:194
MultibandCompressor()
Constructs a MultibandCompressor, creating internal compressors and filters.
Definition compressor.cpp:264
void setOversampleAmount(int oversample) override
Sets the amount of oversampling for the internal filters and compressors.
Definition compressor.cpp:299
void setSampleRate(int sample_rate) override
Sets the current sample rate for the internal filters and compressors.
Definition compressor.cpp:312
bool was_high_enabled_
Whether the high band was enabled on the previous process() call.
Definition compressor.h:337
virtual Processor * clone() const override
Creates a clone of this Processor. (Not implemented for MultibandCompressor).
Definition compressor.h:254
cr::Output band_high_upper_ratio_
Definition compressor.h:346
Compressor band_high_compressor_
Compressor handling band + high, or high only if configured.
Definition compressor.h:378
void packLowBandCompressor(int num_samples, poly_float *dest)
Combines band filter outputs into a single buffer for the low band compressor.
Definition compressor.cpp:375
cr::Output band_high_upper_threshold_
Definition compressor.h:350
virtual void processWithInput(const poly_float *audio_in, int num_samples) override
Processes audio using the given input buffer and writes to output.
Definition compressor.cpp:433
cr::Output low_band_upper_ratio_
Outputs for the low/band compressor thresholds and ratios.
Definition compressor.h:345
void writeCompressorOutputs(Compressor *compressor, int num_samples, poly_float *dest)
Writes a single compressor’s output to a buffer when only one band is active.
Definition compressor.cpp:415
LinkwitzRileyFilter low_band_filter_
A Linkwitz-Riley filter splitting audio into low band and the rest (band + high).
Definition compressor.h:363
void writeAllCompressorOutputs(int num_samples, poly_float *dest)
Writes the combined output of both compressors to a buffer.
Definition compressor.cpp:394
virtual void process(int num_samples) override
Processes audio using the input audio buffer.
Definition compressor.cpp:345
Compressor low_band_compressor_
Compressor handling the low band.
Definition compressor.h:373
bool was_low_enabled_
Whether the low band was enabled on the previous process() call.
Definition compressor.h:332
cr::Output band_high_lower_ratio_
Definition compressor.h:348
cr::Output low_band_lower_ratio_
Definition compressor.h:347
void packFilterOutput(LinkwitzRileyFilter *filter, int num_samples, poly_float *dest)
Extracts the LinkwitzRileyFilter’s output into a combined buffer for further processing.
Definition compressor.cpp:358
void reset(poly_mask reset_mask) override
Resets internal states and filters.
Definition compressor.cpp:325
virtual ~MultibandCompressor()
Default destructor.
Definition compressor.h:247
cr::Output low_band_lower_threshold_
Definition compressor.h:351
cr::Output low_band_output_gain_
Gain controls for low and band/high compressors.
Definition compressor.h:357
cr::Output band_high_output_gain_
Definition compressor.h:358
cr::Output band_high_lower_threshold_
Definition compressor.h:352
BandOptions
Identifies which subset of bands are active in the MultibandCompressor.
Definition compressor.h:216
@ kHighBand
Only high band active.
Definition compressor.h:219
@ kLowBand
Only low band active.
Definition compressor.h:218
@ kSingleBand
Single band (compressor passes audio directly)
Definition compressor.h:220
@ kNumBandOptions
Definition compressor.h:221
@ kMultiband
All three bands active.
Definition compressor.h:217
Base class for all signal-processing units in Vital.
Definition processor.h:212
#define VITAL_ASSERT(x)
Definition common.h:11
#define force_inline
Definition common.h:23
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...
A specialized Output that always runs at control rate (buffer_size = 1).
Definition processor.h:189
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