From 4870d0c148eb49ffeb5482ae55d9cc4c9cc89786 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 3 Jul 2017 17:20:35 +0200 Subject: Measure audio levels, add ensemble database WIP --- src/utils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/utils.cpp') diff --git a/src/utils.cpp b/src/utils.cpp index 3e741c9..d0c1273 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -29,6 +29,8 @@ #include "utils.hpp" #include +#include +#include #include using namespace std; @@ -229,3 +231,9 @@ std::string pnum_to_str(uint16_t Programme_Number) } } +int absolute_to_dB(int16_t value) +{ + const int16_t int16_max = std::numeric_limits::max(); + return value ? round(20*log10((double)value / int16_max)) : -90; +} + -- cgit v1.2.3