summaryrefslogtreecommitdiffstats
path: root/src/StatsServer.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-25 12:29:06 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-25 12:29:06 +0200
commit4ee503b1accf3a344b3a27353cb038acdf46c159 (patch)
treeb684dfa0770ab6e4c90ad3a4c9b9c257df4e54cd /src/StatsServer.cpp
parent7333eae3c7e236a4df59aec66dfbbd1994def848 (diff)
downloaddabmux-4ee503b1accf3a344b3a27353cb038acdf46c159.tar.gz
dabmux-4ee503b1accf3a344b3a27353cb038acdf46c159.tar.bz2
dabmux-4ee503b1accf3a344b3a27353cb038acdf46c159.zip
Use limits instead of stdint.h
C++, sometimes you bother me
Diffstat (limited to 'src/StatsServer.cpp')
-rw-r--r--src/StatsServer.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/StatsServer.cpp b/src/StatsServer.cpp
index ffe8623..c7cbc9d 100644
--- a/src/StatsServer.cpp
+++ b/src/StatsServer.cpp
@@ -30,6 +30,7 @@
#include <string.h>
#include <math.h>
#include <stdint.h>
+#include <limits>
#include <sstream>
#include "StatsServer.h"
#include "Log.h"
@@ -275,9 +276,11 @@ std::string InputStat::encodeJSON()
{
std::ostringstream ss;
+ const int16_t int16_max = std::numeric_limits<int16_t>::max();
+
/* convert to dB */
- int dB_l = peak_left ? round(20*log10((double)peak_left / INT16_MAX)) : -90;
- int dB_r = peak_right ? round(20*log10((double)peak_right / INT16_MAX)) : -90;
+ int dB_l = peak_left ? round(20*log10((double)peak_left / int16_max)) : -90;
+ int dB_r = peak_right ? round(20*log10((double)peak_right / int16_max)) : -90;
ss <<
"{ \"inputstat\" : {"