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
| Signature | Name | Description |
|---|---|---|
CompressorEffect() | CompressorEffect | |
~CompressorEffect() override | ~CompressorEffect | |
CompressorEffect(const CompressorEffect&) = delete | CompressorEffect |
Public functions
| Returns | Name | Description |
|---|---|---|
CompressorEffect& | operator= | |
bool | Init | |
ma_node* | GetNode | |
float | GetThresholdDb | |
float | GetRatio | |
float | GetAttackMs | |
float | GetReleaseMs | |
float | GetKneeDb | |
float | GetMakeupDb | |
void | SetParams | |
void | SetSidechain | Sidechain: the detector reads another signal's level instead of this one's — ambience ducking under voices, music under dialogue. |
bool | HasSidechain | |
float | GetGainReductionDb | The gain reduction the last processed block ended on, in dB (>= 0). |
Function details
CompressorEffect
CompressorEffect()~CompressorEffect
~CompressorEffect() overrideCompressorEffect
CompressorEffect(const CompressorEffect&) = deleteoperator=
CompressorEffect& operator=(const CompressorEffect&) = deleteInit
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
ma_node* GetNode() overrideGetThresholdDb
float GetThresholdDb() constGetRatio
float GetRatio() constGetAttackMs
float GetAttackMs() constGetReleaseMs
float GetReleaseMs() constGetKneeDb
float GetKneeDb() constGetMakeupDb
float GetMakeupDb() constSetParams
void SetParams(float thresholdDb, float ratio, float attackMs, float releaseMs, float kneeDb, float makeupDb)SetSidechain
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
bool HasSidechain() constGetGainReductionDb
float GetGainReductionDb() constThe gain reduction the last processed block ended on, in dB (>= 0).