22 #ifndef EDSP_PEAK2RMS_HPP 23 #define EDSP_PEAK2RMS_HPP 26 #include <edsp/meta/iterator.hpp> 30 namespace edsp {
inline namespace converter {
44 template <
typename ForwardIt>
45 constexpr meta::value_type_t<ForwardIt>
peak2rms(ForwardIt first, ForwardIt last) {
46 const auto pair = std::minmax_element(first, last);
47 const auto max_abs =
std::max(std::abs(pair.first), std::abs(pair.second));
52 #endif // EDSP_PEAK2RMS_HPP constexpr meta::value_type_t< ForwardIt > max(ForwardIt first, ForwardIt last)
Computes the maximum value of the range [first, last)
Definition: max.hpp:38
constexpr meta::value_type_t< ForwardIt > rms(ForwardIt first, ForwardIt last)
Computes the root-mean-square (RMS) value of the range [first, last)
Definition: rms.hpp:44
constexpr meta::value_type_t< ForwardIt > peak2rms(ForwardIt first, ForwardIt last)
Maximum Peak-magnitude-to-RMS ratio in the range [first, last)
Definition: peak2rms.hpp:45
Definition: amplifier.hpp:29