summaryrefslogtreecommitdiff
path: root/apps/replaygain.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/replaygain.c')
-rw-r--r--apps/replaygain.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/replaygain.c b/apps/replaygain.c
index 3b47974d58..02be033657 100644
--- a/apps/replaygain.c
+++ b/apps/replaygain.c
@@ -35,6 +35,8 @@
35 35
36#define FP_BITS (12) 36#define FP_BITS (12)
37#define FP_ONE (1 << FP_BITS) 37#define FP_ONE (1 << FP_BITS)
38#define FP_MIN (-48 * FP_ONE)
39#define FP_MAX ( 17 * FP_ONE)
38 40
39void replaygain_itoa(char* buffer, int length, long int_gain) 41void replaygain_itoa(char* buffer, int length, long int_gain)
40{ 42{
@@ -121,10 +123,10 @@ long convert_gain(long gain)
121 /* Don't allow unreasonably low or high gain changes. 123 /* Don't allow unreasonably low or high gain changes.
122 * Our math code can't handle it properly anyway. :) 124 * Our math code can't handle it properly anyway. :)
123 */ 125 */
124 gain = MAX(gain,-48 * FP_ONE); 126 gain = MAX(gain, FP_MIN);
125 gain = MIN(gain, 17 * FP_ONE); 127 gain = MIN(gain, FP_MAX);
126 128
127 return (gain) ? fp_factor(gain, FP_BITS) << (24 - FP_BITS) : 0; 129 return fp_factor(gain, FP_BITS) << (24 - FP_BITS);
128} 130}
129 131
130/* Get the sample scale factor in Q19.12 format from a gain value. Returns 0 132/* Get the sample scale factor in Q19.12 format from a gain value. Returns 0