25template <is::constant C>
26struct InvertedConstant
28 static constexpr double value = 1.0 / double (C::value);
32template <is::constant C>
33struct Log10ToLog2Constant
35 static constexpr double value = double (C::value) / gcem::log2 (10.0);
38template <is::constant C>
39struct InvertedLog10ToLog2Constant
41 static constexpr double value = gcem::log2 (10.0) / double (C::value);
46namespace vctr::expressions
49template <
size_t extent,
class SrcType,
class DecibelConstant,
class MinDb>
50using MagToDb = ClampByConstant<extent,
51 MultiplyVecByConstant<extent,
52 Log10<extent, SrcType>,
57template <
size_t extent,
class SrcType,
class DecibelConstant>
58using DBToMag = PowConstantBase<extent,
59 MultiplyVecByConstant<extent,
61 ::vctr::detail::InvertedConstant<DecibelConstant>>,
65template <
size_t extent,
class SrcType,
class DecibelConstant,
class MinDb>
66using FastMagToDb = ClampByConstant<extent,
67 MultiplyVecByConstant<extent,
68 FastLog2<extent, SrcType>,
69 ::vctr::detail::Log10ToLog2Constant<DecibelConstant>>,
73template <
size_t extent,
class SrcType,
class DecibelConstant>
74using FastDbToMag = FastExp2<extent,
75 MultiplyVecByConstant<extent,
77 ::vctr::detail::InvertedLog10ToLog2Constant<DecibelConstant>>>;
113template <
is::constant DecibelConstant,
auto minDb = -100>
125template <is::constant DecibelConstant>
141template <
is::constant DecibelConstant,
auto minDb = -100>
156template <is::constant DecibelConstant>
Constrains the type to be a class that defines a static const value field.
Definition: GenericConcepts.h:114
constexpr ExpressionChainBuilderWithRuntimeArgs< expressions::MagToDb, detail::RuntimeArgChain< std::tuple<>, std::tuple<>, std::tuple<> >, DecibelConstant, Constant< minDb > > magToDb
Converts the source magnitude into a decibel representation.
Definition: Decibels.h:114
constexpr ExpressionChainBuilderWithRuntimeArgs< expressions::DBToMag, detail::RuntimeArgChain< std::tuple<>, std::tuple<>, std::tuple<> >, DecibelConstant > dbToMag
Converts the source decibel values into their magnitude representation.
Definition: Decibels.h:126
The main namespace of the VCTR project.
Definition: Array.h:24
A helper struct to pass a constant as argument wrapped in a struct with a single public static conste...
Definition: ExpressionChainBuilder.h:104
An expression chain builder is an object which supplies various operator<< overloads which build chai...
Definition: ExpressionChainBuilder.h:157
Decibel constant dbFS to be passed to dbToMag or magToDb.
Definition: Decibels.h:89
Decibel constant dbPower to be passed to dbToMag or magToDb.
Definition: Decibels.h:101
Decibel constant dbVoltage to be passed to dbToMag or magToDb.
Definition: Decibels.h:95