class

CompressorEffect

Compressor — feedforward peak compressor with soft knee. Per-channel envelope detection is linked (envelope = max across channels) so stereo signals don't drift across the centre image.

Module
Audio
Header
#include "Audio/AudioEffect.h"
Namespace
Mowo

Parameter ranges: thresholdDb: -60..0 (level above which compression kicks in) ratio : 1..30 (1 = no compression, ∞ = limiter) attackMs : 0.1..200 releaseMs : 5..2000 kneeDb : 0..30 (soft knee width; 0 = hard knee) makeupDb : 0..24 (post-compression gain)

Constructors

SignatureNameDescription
CompressorEffect()CompressorEffect
~CompressorEffect() override~CompressorEffect
CompressorEffect(const CompressorEffect&) = deleteCompressorEffect

Public functions

ReturnsNameDescription
CompressorEffect&operator=
boolInit
ma_node*GetNode
floatGetThresholdDb
floatGetRatio
floatGetAttackMs
floatGetReleaseMs
floatGetKneeDb
floatGetMakeupDb
voidSetParams
voidSetSidechainSidechain: the detector reads another signal's level instead of this one's — ambience ducking under voices, music under dialogue.
boolHasSidechain
floatGetGainReductionDbThe gain reduction the last processed block ended on, in dB (>= 0).

Function details

CompressorEffect

C++
CompressorEffect()

~CompressorEffect

C++
~CompressorEffect() override

CompressorEffect

C++
CompressorEffect(const CompressorEffect&) = delete

operator=

C++
CompressorEffect& operator=(const CompressorEffect&) = delete

Init

C++
bool Init(ma_node_graph* graph, uint32_t channels, uint32_t sampleRate, float thresholdDb = -20.0f, float ratio = 4.0f, float attackMs = 10.0f, float releaseMs = 100.0f, float kneeDb = 6.0f, float makeupDb = 0.0f)

GetNode

C++
ma_node* GetNode() override

GetThresholdDb

C++
float GetThresholdDb() const

GetRatio

C++
float GetRatio() const

GetAttackMs

C++
float GetAttackMs() const

GetReleaseMs

C++
float GetReleaseMs() const

GetKneeDb

C++
float GetKneeDb() const

GetMakeupDb

C++
float GetMakeupDb() const

SetParams

C++
void SetParams(float thresholdDb, float ratio, float attackMs, float releaseMs, float kneeDb, float makeupDb)

SetSidechain

C++
void SetSidechain(Ref<class EnvelopeFollowerEffect> key)

Sidechain: the detector reads another signal's level instead of this one's — ambience ducking under voices, music under dialogue. The key is an envelope follower placed wherever that signal runs (a bus chain, a source); its smoothed peak drives the gain reduction here, one audio block behind. Null returns the compressor to its own input.

HasSidechain

C++
bool HasSidechain() const

GetGainReductionDb

C++
float GetGainReductionDb() const

The gain reduction the last processed block ended on, in dB (>= 0).

Generated from Audio/AudioEffect.h via audio.json · Oct 26, 2026Version 1.0.0