aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mastering.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-01-11 06:50:53 -0800
committerChris Robinson <[email protected]>2018-01-11 06:50:53 -0800
commit9b9ec2c21a7f0992a6ca64ac9cb2a03838e11cd7 (patch)
tree94a959806234d4b3699eb8c676732021c0718cf7 /Alc/mastering.c
parentf3c9bc114cb1d136fce4e790d6d2721430eb30dc (diff)
Move the compressor/limiter declarations to their own header
Diffstat (limited to 'Alc/mastering.c')
-rw-r--r--Alc/mastering.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/Alc/mastering.c b/Alc/mastering.c
index 9de5fd5f..91267d83 100644
--- a/Alc/mastering.c
+++ b/Alc/mastering.c
@@ -2,37 +2,19 @@
#include <math.h>
+#include "mastering.h"
#include "alu.h"
#include "almalloc.h"
+
+extern inline ALuint GetCompressorSampleRate(const Compressor *Comp);
+
#define RMS_WINDOW_SIZE (1<<7)
#define RMS_WINDOW_MASK (RMS_WINDOW_SIZE-1)
#define RMS_VALUE_MAX (1<<24)
-#define LOOKAHEAD_SIZE (1<<13)
-#define LOOKAHEAD_MASK (LOOKAHEAD_SIZE-1)
-
static_assert(RMS_VALUE_MAX < (UINT_MAX / RMS_WINDOW_SIZE), "RMS_VALUE_MAX is too big");
-typedef struct Compressor {
- ALfloat PreGain;
- ALfloat PostGain;
- ALboolean SummedLink;
- ALfloat AttackMin;
- ALfloat AttackMax;
- ALfloat ReleaseMin;
- ALfloat ReleaseMax;
- ALfloat Ratio;
- ALfloat Threshold;
- ALfloat Knee;
- ALuint SampleRate;
-
- ALuint RmsSum;
- ALuint *RmsWindow;
- ALsizei RmsIndex;
- ALfloat Envelope[BUFFERSIZE];
- ALfloat EnvLast;
-} Compressor;
/* Multichannel compression is linked via one of two modes:
*
@@ -209,11 +191,6 @@ Compressor *CompressorInit(const ALfloat PreGainDb, const ALfloat PostGainDb,
return Comp;
}
-ALuint GetCompressorSampleRate(const Compressor *Comp)
-{
- return Comp->SampleRate;
-}
-
void ApplyCompression(Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo,
ALfloat (*restrict OutBuffer)[BUFFERSIZE])
{