:)
Loading...
Searching...
No Matches
RustyCompressor Class Reference

Dynamic level compression DSP unit. More...

#include <RustyCompressor.hpp>

Inheritance diagram for RustyCompressor:
RustyProcessor

Public Member Functions

 RustyCompressor (float threshold, float knee, float ratio, float attack, float release, float makeupGain)
 Constructor for RustyCompressor.
 
void process (float *sample) override
 Performs DSP on an audio sample.
 
void setModulatorForParameter (std::string parameter, RustyModulator *modulator) override
 Binds a RustyModulator to a RustyProcessor instance parameter.
 
void setParameter (std::string parameter, std::string value) override
 Sets RustyProcessor parameter to new value.
 
virtual std::string getProcessorType () override
 Function to get processor type.
 
virtual std::string getParams () override
 Function to get processor params.
 
- Public Member Functions inherited from RustyProcessor
virtual void process (float *sample)=0
 Performs DSP on an audio sample.
 
virtual void setModulatorForParameter (std::string parameter, RustyModulator *modulator)=0
 Binds a RustyModulator to a RustyProcessor instance parameter.
 
virtual void setParameter (std::string parameter, std::string value)=0
 Sets RustyProcessor parameter to new value.
 
bool isNumeric (const std::string &str)
 Function to test if value contains numeric characters.
 
virtual std::string getProcessorType ()=0
 Function to get processor type.
 
virtual std::string getParams ()=0
 Function to get processor params.
 

Private Attributes

RustyRingBuffer _lookAheadBuffer {32}
 
float _threshold
 Compression threshold.
 
float _kneeWidth = 4
 Compression knee.
 
float _ratio
 Compression reduction ratio.
 
float _attack
 Compressor attack speed.
 
float _release
 Compressor release speed.
 
float _makeupGain
 Gain makeup variable.
 
float x_g
 dB input sample
 
float y_g
 Gain Computation output.
 
float x_l
 Gain computation post sum.
 
float y_l_dB
 Gain reduction with smoothing in dB.
 
float y_l
 Gain reduction with smoothing in linear value.
 
float y_l_prev = 0.001
 Previous compressor sidechain output.
 
float cv = 0
 Compressor multiplier.
 
float * read_ptr = new float
 Read pointer for RingBuffer.
 

Additional Inherited Members

- Public Attributes inherited from RustyProcessor
std::map< std::string, RustyModulator * > _modulators
 Map of processors affecting derived RustyProcessor.
 

Detailed Description

Dynamic level compression DSP unit.

Log-domain feedback compressor, that is able to dynamically reduce audio signals.

Inherited from RustyProcessor.

Definition at line 23 of file RustyCompressor.hpp.

Constructor & Destructor Documentation

◆ RustyCompressor()

RustyCompressor::RustyCompressor ( float  threshold,
float  knee,
float  ratio,
float  attack,
float  release,
float  makeupGain 
)

Constructor for RustyCompressor.


Takes initial parameters for RustyCompressor and preps the compressor for sample processing.

Parameters
thresholdFloat of threshold in dB.
kneeFloat of knee curve in dB.
ratioFloat of compression ratio.
attackFloat of attack speed in Ms.
releaseFloat of release speed in ms.
makeupGainFloat of gain makeup in dB.

Definition at line 3 of file RustyCompressor.cpp.

Member Function Documentation

◆ process()

void RustyCompressor::process ( float *  sample)
overridevirtual

Performs DSP on an audio sample.


This pure virtual function performs DSP algorithms on a sample by sample basis. A pointer to a 32bitFloat audio sample is passed as an argument and this will be the value used as the input to the DSP function f(x).

Parameters
samplePointer to a 32bitFloat audio sample value.

Implements RustyProcessor.

Definition at line 12 of file RustyCompressor.cpp.

◆ setModulatorForParameter()

void RustyCompressor::setModulatorForParameter ( std::string  parameter,
RustyModulator *  modulator 
)
overridevirtual

Binds a RustyModulator to a RustyProcessor instance parameter.


This is pure virtual function assigns modulator manipulation to parameters within the DSP unit. Each RustyProcessor derived DSP unit will check the parameter name against suitable parameters, if there is a match the modulator will affect the parameter.

Parameters
parameterString of the parameter to affect.
modulatorPointer to instance of RustyModulator.
See also
setParameter()

Implements RustyProcessor.

Definition at line 61 of file RustyCompressor.cpp.

◆ setParameter()

void RustyCompressor::setParameter ( std::string  parameter,
std::string  value 
)
overridevirtual

Sets RustyProcessor parameter to new value.


This is pure virtual function that assigns a new value to a parameter of RustyProcessor derived DSP units. This function is used at runtime from CLI interaction.

Parameters
parameterString of the parameter to affect.
modulatorPointer to instance of RustyModulator.
See also
setModulatorForParameter()

Implements RustyProcessor.

Definition at line 72 of file RustyCompressor.cpp.

◆ getProcessorType()

std::string RustyCompressor::getProcessorType ( )
overridevirtual

Function to get processor type.


Simple function allows CLI to test Processor types for user interaction.

Returns
Returns string of RustyProcessor child type.

Implements RustyProcessor.

Definition at line 152 of file RustyCompressor.cpp.

◆ getParams()

std::string RustyCompressor::getParams ( )
overridevirtual

Function to get processor params.


Simple function allows CLI to get available params for RustyProcessor child.

Returns
Returns string of parameters available for RustyProcessor child.

Implements RustyProcessor.

Definition at line 157 of file RustyCompressor.cpp.

Member Data Documentation

◆ _lookAheadBuffer

RustyRingBuffer RustyCompressor::_lookAheadBuffer {32}
private

Definition at line 51 of file RustyCompressor.hpp.

◆ _threshold

float RustyCompressor::_threshold
private

Compression threshold.

Definition at line 53 of file RustyCompressor.hpp.

◆ _kneeWidth

float RustyCompressor::_kneeWidth = 4
private

Compression knee.

Definition at line 54 of file RustyCompressor.hpp.

◆ _ratio

float RustyCompressor::_ratio
private

Compression reduction ratio.

Definition at line 55 of file RustyCompressor.hpp.

◆ _attack

float RustyCompressor::_attack
private

Compressor attack speed.

Definition at line 56 of file RustyCompressor.hpp.

◆ _release

float RustyCompressor::_release
private

Compressor release speed.

Definition at line 57 of file RustyCompressor.hpp.

◆ _makeupGain

float RustyCompressor::_makeupGain
private

Gain makeup variable.

Definition at line 58 of file RustyCompressor.hpp.

◆ x_g

float RustyCompressor::x_g
private

dB input sample

Definition at line 60 of file RustyCompressor.hpp.

◆ y_g

float RustyCompressor::y_g
private

Gain Computation output.

Definition at line 61 of file RustyCompressor.hpp.

◆ x_l

float RustyCompressor::x_l
private

Gain computation post sum.

Definition at line 62 of file RustyCompressor.hpp.

◆ y_l_dB

float RustyCompressor::y_l_dB
private

Gain reduction with smoothing in dB.

Definition at line 63 of file RustyCompressor.hpp.

◆ y_l

float RustyCompressor::y_l
private

Gain reduction with smoothing in linear value.

Definition at line 64 of file RustyCompressor.hpp.

◆ y_l_prev

float RustyCompressor::y_l_prev = 0.001
private

Previous compressor sidechain output.

Definition at line 65 of file RustyCompressor.hpp.

◆ cv

float RustyCompressor::cv = 0
private

Compressor multiplier.

Definition at line 66 of file RustyCompressor.hpp.

◆ read_ptr

float* RustyCompressor::read_ptr = new float
private

Read pointer for RingBuffer.

Definition at line 68 of file RustyCompressor.hpp.


The documentation for this class was generated from the following files: