25 #ifndef JUCE_DECIBELS_H_INCLUDED 26 #define JUCE_DECIBELS_H_INCLUDED 42 template <
typename Type>
44 const Type minusInfinityDb = (Type) defaultMinusInfinitydB)
46 return decibels > minusInfinityDb ? std::pow ((Type) 10.0, decibels * (Type) 0.05)
56 template <
typename Type>
58 const Type minusInfinityDb = (Type) defaultMinusInfinitydB)
60 return gain > Type() ?
jmax (minusInfinityDb, (Type) std::log10 (gain) * (Type) 20.0)
69 template <
typename Type>
71 const int decimalPlaces = 2,
72 const Type minusInfinityDb = (Type) defaultMinusInfinitydB)
76 if (decibels <= minusInfinityDb)
82 if (decibels >= Type())
85 s <<
String (decibels, decimalPlaces) <<
" dB";
96 defaultMinusInfinitydB = -100
104 #endif // JUCE_DECIBELS_H_INCLUDED Definition: juce_Decibels.h:33
static Type decibelsToGain(const Type decibels, const Type minusInfinityDb=(Type) defaultMinusInfinitydB)
Definition: juce_Decibels.h:43
Definition: juce_String.h:43
Type jmax(const Type a, const Type b)
Definition: juce_core.h:101
static Type gainToDecibels(const Type gain, const Type minusInfinityDb=(Type) defaultMinusInfinitydB)
Definition: juce_Decibels.h:57
static String toString(const Type decibels, const int decimalPlaces=2, const Type minusInfinityDb=(Type) defaultMinusInfinitydB)
Definition: juce_Decibels.h:70