8 /* For FloatBufferLine/BUFFERSIZE. */
15 /* General topology and basic automation was based on the following paper:
17 * D. Giannoulis, M. Massberg and J. D. Reiss,
18 * "Parameter Automation in a Dynamic Range Compressor,"
19 * Journal of the Audio Engineering Society, v61 (10), Oct. 2013
21 * Available (along with supplemental reading) at:
23 * http://c4dm.eecs.qmul.ac.uk/audioengineering/compressors/
39 float mPostGain
{0.0f
};
41 float mThreshold
{0.0f
};
48 alignas(16) float mSideChain
[2*BUFFERSIZE
]{};
49 alignas(16) float mCrestFactor
[BUFFERSIZE
]{};
51 SlidingHold
*mHold
{nullptr};
52 FloatBufferLine
*mDelay
{nullptr};
54 float mCrestCoeff
{0.0f
};
55 float mGainEstimate
{0.0f
};
56 float mAdaptCoeff
{0.0f
};
58 float mLastPeakSq
{0.0f
};
59 float mLastRmsSq
{0.0f
};
60 float mLastRelease
{0.0f
};
61 float mLastAttack
{0.0f
};
62 float mLastGainDev
{0.0f
};
66 void process(const ALuint SamplesToDo
, FloatBufferLine
*OutBuffer
);
67 ALsizei
getLookAhead() const noexcept
{ return static_cast<ALsizei
>(mLookAhead
); }
72 * The compressor is initialized with the following settings:
74 * \param NumChans Number of channels to process.
75 * \param SampleRate Sample rate to process.
76 * \param AutoKnee Whether to automate the knee width parameter.
77 * \param AutoAttack Whether to automate the attack time parameter.
78 * \param AutoRelease Whether to automate the release time parameter.
79 * \param AutoPostGain Whether to automate the make-up (post) gain
81 * \param AutoDeclip Whether to automate clipping reduction. Ignored
82 * when not automating make-up gain.
83 * \param LookAheadTime Look-ahead time (in seconds).
84 * \param HoldTime Peak hold-time (in seconds).
85 * \param PreGainDb Gain applied before detection (in dB).
86 * \param PostGainDb Make-up gain applied after compression (in dB).
87 * \param ThresholdDb Triggering threshold (in dB).
88 * \param Ratio Compression ratio (x:1). Set to INFINIFTY for true
89 * limiting. Ignored when automating knee width.
90 * \param KneeDb Knee width (in dB). Ignored when automating knee
92 * \param AttackTime Attack time (in seconds). Acts as a maximum when
93 * automating attack time.
94 * \param ReleaseTime Release time (in seconds). Acts as a maximum when
95 * automating release time.
97 static std::unique_ptr
<Compressor
> Create(const size_t NumChans
, const float SampleRate
,
98 const bool AutoKnee
, const bool AutoAttack
, const bool AutoRelease
,
99 const bool AutoPostGain
, const bool AutoDeclip
, const float LookAheadTime
,
100 const float HoldTime
, const float PreGainDb
, const float PostGainDb
,
101 const float ThresholdDb
, const float Ratio
, const float KneeDb
, const float AttackTime
,
102 const float ReleaseTime
);
105 #endif /* MASTERING_H */