summaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-12-22 17:45:26 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-12-22 17:45:26 +0100
commit7caf4423145b5b2629502f8d227dc348bd232887 (patch)
treed65211c57149b4dfea0366b69dfc69ee6b7df41e /src/utils.c
parentab2442bd9f1139b2abe8e26a593785703b78d58c (diff)
downloadODR-AudioEnc-7caf4423145b5b2629502f8d227dc348bd232887.tar.gz
ODR-AudioEnc-7caf4423145b5b2629502f8d227dc348bd232887.tar.bz2
ODR-AudioEnc-7caf4423145b5b2629502f8d227dc348bd232887.zip
Fix level indication in mono
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/utils.c b/src/utils.c
index a9aefbe..0168a23 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -4,7 +4,7 @@
#include <math.h>
/* Taken from sox */
-const char* level(int channel, int* peak)
+const char* level(int channel, int peak)
{
static char const * const text[][2] = {
/* White: 2dB steps */
@@ -17,7 +17,7 @@ const char* level(int channel, int* peak)
};
int const red = 1, white = NUMOF(text) - red;
- double linear = (double)(*peak) / INT16_MAX;
+ double linear = ((double)peak) / INT16_MAX;
int vu_dB = linear ? floor(2 * white + red + linear_to_dB(linear)) : 0;
@@ -25,9 +25,6 @@ const char* level(int channel, int* peak)
MAX(vu_dB / 2, 0) :
MIN(vu_dB - white, red + white - 1);
- *peak = 0;
-
return text[index][channel];
-
}