Request the device's sample type for SDL2
[openal-soft.git] / Alc / mastering.h
blob0a7b4901739bb7fdd0da782af5d87475a90261c2
1 #ifndef MASTERING_H
2 #define MASTERING_H
4 #include "AL/al.h"
6 /* For BUFFERSIZE. */
7 #include "alMain.h"
9 typedef struct Compressor {
10 ALfloat PreGain;
11 ALfloat PostGain;
12 ALboolean SummedLink;
13 ALfloat AttackMin;
14 ALfloat AttackMax;
15 ALfloat ReleaseMin;
16 ALfloat ReleaseMax;
17 ALfloat Ratio;
18 ALfloat Threshold;
19 ALfloat Knee;
20 ALuint SampleRate;
22 ALuint RmsSum;
23 ALuint *RmsWindow;
24 ALsizei RmsIndex;
25 ALfloat Envelope[BUFFERSIZE];
26 ALfloat EnvLast;
27 } Compressor;
29 /* The compressor requires the following information for proper
30 * initialization:
32 * PreGainDb - Gain applied before detection (in dB).
33 * PostGainDb - Gain applied after compression (in dB).
34 * SummedLink - Whether to use summed (true) or maxed (false) linking.
35 * RmsSensing - Whether to use RMS (true) or Peak (false) sensing.
36 * AttackTimeMin - Minimum attack time (in seconds).
37 * AttackTimeMax - Maximum attack time. Automates when min != max.
38 * ReleaseTimeMin - Minimum release time (in seconds).
39 * ReleaseTimeMax - Maximum release time. Automates when min != max.
40 * Ratio - Compression ratio (x:1). Set to 0 for true limiter.
41 * ThresholdDb - Triggering threshold (in dB).
42 * KneeDb - Knee width (below threshold; in dB).
43 * SampleRate - Sample rate to process.
45 Compressor *CompressorInit(const ALfloat PreGainDb, const ALfloat PostGainDb,
46 const ALboolean SummedLink, const ALboolean RmsSensing, const ALfloat AttackTimeMin,
47 const ALfloat AttackTimeMax, const ALfloat ReleaseTimeMin, const ALfloat ReleaseTimeMax,
48 const ALfloat Ratio, const ALfloat ThresholdDb, const ALfloat KneeDb,
49 const ALuint SampleRate);
51 void ApplyCompression(struct Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo,
52 ALfloat (*restrict OutBuffer)[BUFFERSIZE]);
54 inline ALuint GetCompressorSampleRate(const Compressor *Comp)
55 { return Comp->SampleRate; }
57 #endif /* MASTERING_H */