diff options
author | Chris Robinson <[email protected]> | 2017-05-08 16:23:16 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-05-08 16:23:16 -0700 |
commit | 4a4442ad91d34964b1d695381fafbdef07bb14ce (patch) | |
tree | 006874a670e67a1eff69dcd2293cb3bf987cd94c /OpenAL32/Include/alu.h | |
parent | f880f6704927488e0a29fdd576009cea0450fc58 (diff) |
Store the output limiter values as fixed-point integers
This helps keep the squared sum stable over larger updates, also avoiding the
need to keep recalculating it.
Diffstat (limited to 'OpenAL32/Include/alu.h')
-rw-r--r-- | OpenAL32/Include/alu.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 6fdbac6f..8ac25e35 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -299,9 +299,13 @@ void DeinitVoice(ALvoice *voice); #define LIMITER_WINDOW_SIZE (1<<7) /* 128 */ #define LIMITER_WINDOW_MASK (LIMITER_WINDOW_SIZE-1) +#define LIMITER_VALUE_MAX (UINT_MAX / LIMITER_WINDOW_SIZE) struct OutputLimiter { - /* RMS detection window and the next write pos. */ - alignas(16) ALfloat Window[LIMITER_WINDOW_SIZE]; + /* RMS detection window, sum of values in the window, and the next write + * pos. Values are 16.16 fixed-point. + */ + ALuint Window[LIMITER_WINDOW_SIZE]; + ALuint SquaredSum; ALsizei Pos; /* In milliseconds. */ |