VISR  0.11.8
Versatile Interactive Scene Renderer
db_linear_conversion.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
9 #ifndef VISR_LIBEFL_DB_LINEAR_CONVERSION_HPP_INCLUDED
10 #define VISR_LIBEFL_DB_LINEAR_CONVERSION_HPP_INCLUDED
11 
12 #include <cmath>
13 
14 namespace visr
15 {
16 namespace efl
17 {
18 
19 template< typename T >
20 T linear2dB( T lin )
21 {
22  return static_cast<T>(20.0)*std::log10( lin );
23 }
24 
25 template< typename T >
26 T dB2linear( T dB )
27 {
28  return std::pow( static_cast<T>(10.0), static_cast<T>(0.05)*dB );
29 }
30 
31 } // namespace efl
32 } // namespace visr
33 
34 #endif // #ifndef VISR_LIBEFL_DB_LINEAR_CONVERSION_HPP_INCLUDED
T linear2dB(T lin)
Definition: db_linear_conversion.hpp:20
Definition: options.cpp:10
T dB2linear(T dB)
Definition: db_linear_conversion.hpp:26