|
HART
0.2.0
High level Audio Regression and Testing
|
Handy functions and constants. More...
Classes | |
| class | WavWriter< SampleType > |
| Helper class for writing audio buffers to wav files. More... | |
Macros | |
| #define | HART_STR(...) (hart::Str() << __VA_ARGS__).toStdString() |
| A helper to construct strings using the "<<" syntax. | |
| #define | HART_DEFINE_GENERIC_REPRESENT(ClassName) |
| Defines a basic string representation of your class. | |
| #define | HART_DEPRECATED(msg) |
Enumerations | |
| enum | Channel { left = 0 , right = 1 } |
| Helper values for channel indices. More... | |
| enum | MidSideChannel { mid = 0 , side = 1 } |
| Helper values for mid-side channel indices. More... | |
| enum class | Loop { no , yes } |
| Helper values for something that could loop, like a Signal. More... | |
Functions | |
| template<typename FloatType > | |
| FloatType | nan () |
| Returns a quiet NaN value for the given floating-point type. | |
| template<typename NumericType > | |
| NumericType | clamp (const NumericType &value, const NumericType &low, const NumericType &high) |
std::clamp() replacement for C++11 | |
| template<typename SampleType > | |
| static SampleType | decibelsToRatio (SampleType valueDb) |
| Converts dB to linear value (ratio) | |
| template<typename SampleType > | |
| static SampleType | ratioToDecibels (SampleType valueLinear) |
| Converts linear value (ratio) to dB. | |
| template<typename SampleType > | |
| static SampleType | floatsEqual (SampleType a, SampleType b, SampleType epsilon=(SampleType) 1e-8) |
| Compares two floating point numbers within a given tolerance. | |
| template<typename SampleType > | |
| static SampleType | floatsNotEqual (SampleType a, SampleType b, SampleType epsilon=(SampleType) 1e-8) |
| Compares two floating point numbers within a given tolerance. | |
| template<typename SampleType > | |
| static size_t | roundToSizeT (SampleType x) |
Rounds a floating point value to a size_t value. | |
| template<typename SampleType > | |
| SampleType | wrapPhase (const SampleType phaseRadians) |
| Keeps phase in 0..twoPi range. | |
| static bool | isAbsolutePath (const std::string &path) |
| Checks if the provided file path is absolute. | |
| static std::string | toAbsolutePath (const std::string &path) |
| Converts path to absolute, if it's relative. | |
| template<typename KeyType , typename ValueType > | |
| static bool | contains (const std::unordered_map< KeyType, ValueType > &map, const KeyType &key) |
std::unordered_map::contains() replacement for C++11 | |
| template<typename ObjectType , typename... Args> | |
| std::unique_ptr< ObjectType > | make_unique (Args &&... args) |
std::make_unique() replacement for C++11 | |
Variables | |
| constexpr double | inf = std::numeric_limits<double>::infinity() |
| Infinity. | |
| constexpr double | oo = inf |
| Infinity. | |
| constexpr double | pi = 3.14159265358979323846 |
| pi | |
| constexpr double | twoPi = 2.0 * pi |
| 2 * pi | |
| constexpr double | halfPi = pi / 2.0 |
| pi / 2 | |
Handy functions and constants.
| #define HART_STR | ( | ... | ) | (hart::Str() << __VA_ARGS__).toStdString() |
A helper to construct strings using the "<<" syntax.
Usage: HART_STR ("Some text: " << someValue << "...")
Definition at line 35 of file hart_str.hpp.
| #define HART_DEFINE_GENERIC_REPRESENT | ( | ClassName | ) |
Defines a basic string representation of your class.
If your class takes ctor arguments, it's strongly encouraged to make a proper implementation of represent(), so that you get more detailed test failure reports. See hart::DSP::represent(), hart::Matcher::represent(), hart::Signal::represent() for the description.
Definition at line 174 of file hart_utils.hpp.
| #define HART_DEPRECATED | ( | msg | ) |
Definition at line 186 of file hart_utils.hpp.
Helper values for channel indices.
| Enumerator | |
|---|---|
| left | |
| right | |
Definition at line 36 of file hart_utils.hpp.
Helper values for mid-side channel indices.
| Enumerator | |
|---|---|
| mid | |
| side | |
Definition at line 43 of file hart_utils.hpp.
Helper values for something that could loop, like a Signal.
| Enumerator | |
|---|---|
| no | |
| yes | |
Definition at line 50 of file hart_utils.hpp.
Returns a quiet NaN value for the given floating-point type.
Definition at line 58 of file hart_utils.hpp.
| NumericType clamp | ( | const NumericType & | value, |
| const NumericType & | low, | ||
| const NumericType & | high | ||
| ) |
std::clamp() replacement for C++11
Definition at line 65 of file hart_utils.hpp.
|
inlinestatic |
Converts dB to linear value (ratio)
| valueDb | Value in decibels |
Definition at line 74 of file hart_utils.hpp.
|
inlinestatic |
Converts linear value (ratio) to dB.
| valueLinear | Value in linear domain |
Definition at line 86 of file hart_utils.hpp.
|
inlinestatic |
Compares two floating point numbers within a given tolerance.
Definition at line 96 of file hart_utils.hpp.
|
inlinestatic |
Compares two floating point numbers within a given tolerance.
Definition at line 103 of file hart_utils.hpp.
|
inlinestatic |
Rounds a floating point value to a size_t value.
Definition at line 110 of file hart_utils.hpp.
| SampleType wrapPhase | ( | const SampleType | phaseRadians | ) |
Keeps phase in 0..twoPi range.
Definition at line 117 of file hart_utils.hpp.
Checks if the provided file path is absolute.
Definition at line 128 of file hart_utils.hpp.
Converts path to absolute, if it's relative.
Relative paths are resolved based on a provided --data-root-path CLI argument
Definition at line 146 of file hart_utils.hpp.
|
inlinestatic |
std::unordered_map::contains() replacement for C++11
Definition at line 156 of file hart_utils.hpp.
| std::unique_ptr< ObjectType > make_unique | ( | Args &&... | args | ) |
std::make_unique() replacement for C++11
For C++11 compatibility only. If you're one C++14 or later, just use STL version.
Definition at line 164 of file hart_utils.hpp.
Infinity.
Definition at line 21 of file hart_utils.hpp.
Infinity.
Definition at line 24 of file hart_utils.hpp.
pi
Definition at line 27 of file hart_utils.hpp.
2 * pi
Definition at line 30 of file hart_utils.hpp.
pi / 2
Definition at line 33 of file hart_utils.hpp.