aboutsummaryrefslogtreecommitdiffstats
path: root/alc/mastering.h
diff options
context:
space:
mode:
Diffstat (limited to 'alc/mastering.h')
-rw-r--r--alc/mastering.h100
1 files changed, 51 insertions, 49 deletions
diff --git a/alc/mastering.h b/alc/mastering.h
index 851381e9..92c25fee 100644
--- a/alc/mastering.h
+++ b/alc/mastering.h
@@ -23,7 +23,7 @@ struct SlidingHold;
* http://c4dm.eecs.qmul.ac.uk/audioengineering/compressors/
*/
struct Compressor {
- ALuint mNumChans{0u};
+ size_t mNumChans{0u};
struct {
bool Knee : 1;
@@ -35,31 +35,31 @@ struct Compressor {
ALuint mLookAhead{0};
- ALfloat mPreGain{0.0f};
- ALfloat mPostGain{0.0f};
+ float mPreGain{0.0f};
+ float mPostGain{0.0f};
- ALfloat mThreshold{0.0f};
- ALfloat mSlope{0.0f};
- ALfloat mKnee{0.0f};
+ float mThreshold{0.0f};
+ float mSlope{0.0f};
+ float mKnee{0.0f};
- ALfloat mAttack{0.0f};
- ALfloat mRelease{0.0f};
+ float mAttack{0.0f};
+ float mRelease{0.0f};
- alignas(16) ALfloat mSideChain[2*BUFFERSIZE]{};
- alignas(16) ALfloat mCrestFactor[BUFFERSIZE]{};
+ alignas(16) float mSideChain[2*BUFFERSIZE]{};
+ alignas(16) float mCrestFactor[BUFFERSIZE]{};
SlidingHold *mHold{nullptr};
FloatBufferLine *mDelay{nullptr};
- ALfloat mCrestCoeff{0.0f};
- ALfloat mGainEstimate{0.0f};
- ALfloat mAdaptCoeff{0.0f};
+ float mCrestCoeff{0.0f};
+ float mGainEstimate{0.0f};
+ float mAdaptCoeff{0.0f};
- ALfloat mLastPeakSq{0.0f};
- ALfloat mLastRmsSq{0.0f};
- ALfloat mLastRelease{0.0f};
- ALfloat mLastAttack{0.0f};
- ALfloat mLastGainDev{0.0f};
+ float mLastPeakSq{0.0f};
+ float mLastRmsSq{0.0f};
+ float mLastRelease{0.0f};
+ float mLastAttack{0.0f};
+ float mLastGainDev{0.0f};
~Compressor();
@@ -67,37 +67,39 @@ struct Compressor {
ALsizei getLookAhead() const noexcept { return static_cast<ALsizei>(mLookAhead); }
DEF_PLACE_NEWDEL()
-};
-/* The compressor is initialized with the following settings:
- *
- * NumChans - Number of channels to process.
- * SampleRate - Sample rate to process.
- * AutoKnee - Whether to automate the knee width parameter.
- * AutoAttack - Whether to automate the attack time parameter.
- * AutoRelease - Whether to automate the release time parameter.
- * AutoPostGain - Whether to automate the make-up (post) gain parameter.
- * AutoDeclip - Whether to automate clipping reduction. Ignored when
- * not automating make-up gain.
- * LookAheadTime - Look-ahead time (in seconds).
- * HoldTime - Peak hold-time (in seconds).
- * PreGainDb - Gain applied before detection (in dB).
- * PostGainDb - Make-up gain applied after compression (in dB).
- * ThresholdDb - Triggering threshold (in dB).
- * Ratio - Compression ratio (x:1). Set to INFINIFTY for true
- * limiting. Ignored when automating knee width.
- * KneeDb - Knee width (in dB). Ignored when automating knee
- * width.
- * AttackTimeMin - Attack time (in seconds). Acts as a maximum when
- * automating attack time.
- * ReleaseTimeMin - Release time (in seconds). Acts as a maximum when
- * automating release time.
- */
-std::unique_ptr<Compressor> CompressorInit(const ALuint NumChans, const ALfloat SampleRate,
- const ALboolean AutoKnee, const ALboolean AutoAttack, const ALboolean AutoRelease,
- const ALboolean AutoPostGain, const ALboolean AutoDeclip, const ALfloat LookAheadTime,
- const ALfloat HoldTime, const ALfloat PreGainDb, const ALfloat PostGainDb,
- const ALfloat ThresholdDb, const ALfloat Ratio, const ALfloat KneeDb, const ALfloat AttackTime,
- const ALfloat ReleaseTime);
+ /**
+ * The compressor is initialized with the following settings:
+ *
+ * \param NumChans Number of channels to process.
+ * \param SampleRate Sample rate to process.
+ * \param AutoKnee Whether to automate the knee width parameter.
+ * \param AutoAttack Whether to automate the attack time parameter.
+ * \param AutoRelease Whether to automate the release time parameter.
+ * \param AutoPostGain Whether to automate the make-up (post) gain
+ * parameter.
+ * \param AutoDeclip Whether to automate clipping reduction. Ignored
+ * when not automating make-up gain.
+ * \param LookAheadTime Look-ahead time (in seconds).
+ * \param HoldTime Peak hold-time (in seconds).
+ * \param PreGainDb Gain applied before detection (in dB).
+ * \param PostGainDb Make-up gain applied after compression (in dB).
+ * \param ThresholdDb Triggering threshold (in dB).
+ * \param Ratio Compression ratio (x:1). Set to INFINIFTY for true
+ * limiting. Ignored when automating knee width.
+ * \param KneeDb Knee width (in dB). Ignored when automating knee
+ * width.
+ * \param AttackTime Attack time (in seconds). Acts as a maximum when
+ * automating attack time.
+ * \param ReleaseTime Release time (in seconds). Acts as a maximum when
+ * automating release time.
+ */
+ static std::unique_ptr<Compressor> Create(const size_t NumChans, const float SampleRate,
+ const bool AutoKnee, const bool AutoAttack, const bool AutoRelease,
+ const bool AutoPostGain, const bool AutoDeclip, const float LookAheadTime,
+ const float HoldTime, const float PreGainDb, const float PostGainDb,
+ const float ThresholdDb, const float Ratio, const float KneeDb, const float AttackTime,
+ const float ReleaseTime);
+};
#endif /* MASTERING_H */