SuperpoweredSDK  v2.0.2
Superpowered Audio SDK
Superpowered::Compressor Class Reference

Compressor with 0 latency. More...

#include "SuperpoweredCompressor.h"

Inheritance diagram for Superpowered::Compressor:
Collaboration diagram for Superpowered::Compressor:

Public Member Functions

 Compressor (unsigned int samplerate)
 Constructor. More...
 
 ~Compressor ()
 
float getGainReductionDb ()
 
bool process (float *input, float *output, unsigned int numberOfFrames)
 Processes the audio. More...
 

Public Attributes

float attackSec
 Attack in seconds (not milliseconds!). Limited between 0.0001 and 1. Default: 0.003 (3 ms). More...
 
bool enabled = false
 Turns the effect on/off. The actual switch will happen on the next process() call for smooth, audio-artifact free operation. More...
 
float hpCutOffHz
 Key highpass filter frequency, limited between 1 and 10000. Default: 1. More...
 
float inputGainDb
 Input gain in decibels, limited between -24 and 24. Default: 0. More...
 
float outputGainDb
 Output gain in decibels, limited between -24 and 24. Default: 0. More...
 
float ratio
 Ratio, rounded to 1.5, 2.0, 3.0, 4.0, 5.0 or 10. Default: 3. More...
 
float releaseSec
 Release in seconds (not milliseconds!). Limited between 0.1 and 4. Default: 0.3 (300 ms). More...
 
unsigned int samplerate = 0
 Sample rate in Hz. More...
 
float thresholdDb
 Threshold in decibels, limited between 0 and -40. Default: 0. More...
 
float wet
 Dry/wet ratio, limited between 0 (completely dry) and 1 (completely wet). Default: 1. More...
 

Private Member Functions

 Compressor (const Compressor &)
 
Compressoroperator= (const Compressor &)
 

Private Attributes

compressorInternals * internals
 

Detailed Description

Compressor with 0 latency.

It doesn't allocate any internal buffers and needs less than 1 kb of memory.

Constructor & Destructor Documentation

◆ Compressor() [1/2]

Superpowered::Compressor::Compressor ( unsigned int  samplerate)

Constructor.

Enabled is false by default.

Parameters
samplerateThe initial sample rate in Hz.

◆ ~Compressor()

Superpowered::Compressor::~Compressor ( )

◆ Compressor() [2/2]

Superpowered::Compressor::Compressor ( const Compressor )
private

Member Function Documentation

◆ getGainReductionDb()

float Superpowered::Compressor::getGainReductionDb ( )
Returns
Returns the maximum gain reduction in decibels since the last getGainReductionDb() call.

◆ operator=()

Compressor& Superpowered::Compressor::operator= ( const Compressor )
private

◆ process()

bool Superpowered::Compressor::process ( float *  input,
float *  output,
unsigned int  numberOfFrames 
)
virtual

Processes the audio.

Always call it in the audio processing callback, regardless if the effect is enabled or not for smooth, audio-artifact free operation. It's never blocking for real-time usage. You can change all properties and call getGainReductionDb() on any thread, concurrently with process(). If process() returns with true, the contents of output are replaced with the audio output. If process() returns with false, the contents of output are not changed.

Parameters
inputPointer to floating point numbers. 32-bit interleaved stereo input.
outputPointer to floating point numbers. 32-bit interleaved stereo output. Can point to the same location with input (in-place processing).
numberOfFramesNumber of frames to process. Recommendations for best performance: multiply of 4, minimum 64.

Implements Superpowered::FX.

Member Data Documentation

◆ attackSec

float Superpowered::Compressor::attackSec

Attack in seconds (not milliseconds!). Limited between 0.0001 and 1. Default: 0.003 (3 ms).

◆ enabled

bool Superpowered::FX::enabled = false
inherited

Turns the effect on/off. The actual switch will happen on the next process() call for smooth, audio-artifact free operation.

◆ hpCutOffHz

float Superpowered::Compressor::hpCutOffHz

Key highpass filter frequency, limited between 1 and 10000. Default: 1.

◆ inputGainDb

float Superpowered::Compressor::inputGainDb

Input gain in decibels, limited between -24 and 24. Default: 0.

◆ internals

compressorInternals* Superpowered::Compressor::internals
private

◆ outputGainDb

float Superpowered::Compressor::outputGainDb

Output gain in decibels, limited between -24 and 24. Default: 0.

◆ ratio

float Superpowered::Compressor::ratio

Ratio, rounded to 1.5, 2.0, 3.0, 4.0, 5.0 or 10. Default: 3.

◆ releaseSec

float Superpowered::Compressor::releaseSec

Release in seconds (not milliseconds!). Limited between 0.1 and 4. Default: 0.3 (300 ms).

◆ samplerate

unsigned int Superpowered::FX::samplerate = 0
inherited

Sample rate in Hz.

◆ thresholdDb

float Superpowered::Compressor::thresholdDb

Threshold in decibels, limited between 0 and -40. Default: 0.

◆ wet

float Superpowered::Compressor::wet

Dry/wet ratio, limited between 0 (completely dry) and 1 (completely wet). Default: 1.


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