41 template <
typename Type>
43 Type minusInfinityDb = Type (defaultMinusInfinitydB))
45 return decibels > minusInfinityDb ? std::pow (Type (10.0), decibels * Type (0.05))
55 template <
typename Type>
57 Type minusInfinityDb = Type (defaultMinusInfinitydB))
59 return gain > Type() ? jmax (minusInfinityDb,
static_cast<Type
> (std::log10 (gain)) * Type (20.0))
71 template <
typename Type>
73 int decimalPlaces = 2,
74 Type minusInfinityDb = Type (defaultMinusInfinitydB),
75 bool shouldIncludeSuffix =
true,
81 if (decibels <= minusInfinityDb)
83 if (customMinusInfinityString.isEmpty())
86 s << customMinusInfinityString;
90 if (decibels >= Type())
93 if (decimalPlaces <= 0)
94 s << roundToInt (decibels);
96 s << String (decibels, decimalPlaces);
99 if (shouldIncludeSuffix)
107 enum { defaultMinusInfinitydB = -100 };
static Type decibelsToGain(Type decibels, Type minusInfinityDb=Type(defaultMinusInfinitydB))
static Type gainToDecibels(Type gain, Type minusInfinityDb=Type(defaultMinusInfinitydB))
static String toString(Type decibels, int decimalPlaces=2, Type minusInfinityDb=Type(defaultMinusInfinitydB), bool shouldIncludeSuffix=true, StringRef customMinusInfinityString={})
void preallocateBytes(size_t numBytesNeeded)