20 #ifndef MPD_PCM_UTILS_H
21 #define MPD_PCM_UTILS_H
36 template<SampleFormat F, class Traits=SampleTraits<F>>
38 static inline typename Traits::value_type
41 typedef typename Traits::value_type T;
43 typedef std::numeric_limits<T> limits;
44 static_assert(Traits::MIN >= limits::min(),
"out of range");
45 static_assert(Traits::MAX <= limits::max(),
"out of range");
48 return T(Traits::MIN);
51 return T(Traits::MAX);
This template describes the specified SampleFormat.
static gcc_const Traits::value_type PcmClamp(typename Traits::long_type x)
Check if the value is within the range of the provided bit size, and caps it if necessary.