Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
constants.hpp
Go to the documentation of this file.
1/**
2 * @file constants.hpp
3 * @brief The numbers every layer reaches for
4 * @ingroup math
5 *
6 * One definition of pi for the library, so no header carries its own literal
7 * (style guide: no magic numbers).
8 */
9
10#ifndef SBL_MATH_CONSTANTS_HPP_
11#define SBL_MATH_CONSTANTS_HPP_
12
13#include <cstdint>
14
15namespace sbl::math {
16
17inline constexpr float PI = 3.14159265358979323846f; /**< pi */
18inline constexpr float TWO_PI = 2.0f * PI; /**< 2 pi */
19inline constexpr float HALF_PI = 0.5f * PI; /**< pi / 2 */
20
21inline constexpr float MS_PER_SECOND = 1000.0f; /**< Milliseconds in a second */
22inline constexpr float SECONDS_PER_MS = 0.001f; /**< Seconds in a millisecond */
23inline constexpr float SECONDS_PER_MINUTE = 60.0f; /**< Seconds in a minute */
24
25/** @brief The full scale of a 16-bit unsigned blend factor. */
26inline constexpr uint16_t U16_MAX = 65535;
27
28} // namespace sbl::math
29
30#endif // SBL_MATH_CONSTANTS_HPP_
Domain-neutral math: constants, clamp, interpolation.
Definition clamp.hpp:13
constexpr float SECONDS_PER_MINUTE
Definition constants.hpp:23
constexpr float HALF_PI
Definition constants.hpp:19
constexpr float PI
Definition constants.hpp:17
constexpr float SECONDS_PER_MS
Definition constants.hpp:22
constexpr uint16_t U16_MAX
The full scale of a 16-bit unsigned blend factor.
Definition constants.hpp:26
constexpr float MS_PER_SECOND
Definition constants.hpp:21
constexpr float TWO_PI
Definition constants.hpp:18