21template<
class S,
class D>
inline void convert_samples (
size_t n, S *src, D *dst,
uint16 byte_order);
24template<
class S,
class D>
inline void convert_clip_samples (
size_t n, S *src, D *dst,
uint16 byte_order);
30 for (
size_t i = 0; i < n; i++)
38 static_assert (
sizeof (
float) == 4,
"");
39 static_assert (
sizeof (wchar_t) == 4,
"");
40 wmemcpy ((
wchar_t*) d, (
const wchar_t*) s, n);
47 static_assert (
sizeof (
uint32_t) == 4,
"");
48 static_assert (
sizeof (wchar_t) == 4,
"");
49 wmemcpy ((
wchar_t*) d, (
const wchar_t*) s, n);
54convert_samples (
size_t n,
const int16_t *src,
float *dst,
uint16 byte_order)
57 const auto bound = dst + n;
59 *dst++ = *src++ * (1. / 32768.);
63convert_clip_samples (
size_t n,
const float *src, int16_t *dst,
uint16 byte_order)
66 static_assert (
int16_t (0.99999990F * 32768.F) == 32767);
67 const auto bound = src + n;
#define ASE_ASSERT_RETURN(expr,...)
Return from the current function if expr evaluates to false and issue an assertion warning.
The Anklang C++ API namespace.
constexpr const uint AUDIO_BLOCK_FLOAT_ZEROS_SIZE
Maximum number of values in the const_float_zeros block.
float square_sum(uint n_values, const float *ivalues)
Calculate suqare sum of a block of floats.
void floatfill(float *dst, float f, size_t n)
Fill n values of dst with f.
float const_float_zeros[AUDIO_BLOCK_FLOAT_ZEROS_SIZE]
Block of const floats allof value 0.
float square_max(uint n_values, const float *ivalues)
Find the maximum suqared value in a block of floats.
uint16_t uint16
A 16-bit unsigned integer.
uint32_t uint
Provide 'uint' as convenience type.
void fast_copy(size_t n, float *d, const float *s)
Copy a block of floats.