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
clamp.hpp File Reference

Clamping. More...

Detailed Description

Clamping.

One clamp for the library, for any ordered type. For floating point a NaN lands on the low bound, so a bad signal is a quiet one, not a loud one.

Definition in file clamp.hpp.

Go to the source code of this file.

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::math
 Domain-neutral math: constants, clamp, interpolation.
 

Functions

template<typename T >
constexpr T sbl::math::clamp (T x, T lo, T hi)
 x held to [lo, hi]; a NaN goes to lo.
 
template<typename T >
constexpr T sbl::math::clamp01 (T x)
 x held to [0, 1]; a NaN goes to 0.