Skip to content

String conversion/printing values

dB_to_string function

template <typename T>
std::string dB_to_string(const T &value,
                         double minimum = -140.0)

Converts dB value to string (uses oo for infinity symbol)

Source code
template <typename T>
std::string dB_to_string(const T& value, double minimum = -140.0)
{
    if (value <= minimum)
        return "-oo dB";
    return as_string(fmtwidth<0, 2>(value), " dB");
}

https://github.com/kfrlib/kfr/blob//include/kfr/io/tostring.hpp#L163

dB_to_utf8string function

template <typename T>
std::string dB_to_utf8string(const T &value,
                             double minimum = -140.0)

Converts dB value to string (uses infinity symbol in utf-8 encoding)

Source code
template <typename T>
std::string dB_to_utf8string(const T& value, double minimum = -140.0)
{
    if (value <= minimum)
        return "-\xE2\x88\x9E dB"; // infinity symbol
    return as_string(fmtwidth<0, 2>(value), " dB");
}

https://github.com/kfrlib/kfr/blob//include/kfr/io/tostring.hpp#L172


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/