2#ifndef __ASE_DATAUTILS_HH__
3#define __ASE_DATAUTILS_HH__
22template<
class S,
class D>
inline void convert_samples (
size_t n, S *src, D *dst,
uint16 byte_order);
25template<
class S,
class D>
inline void convert_clip_samples (
size_t n, S *src, D *dst,
uint16 byte_order);
31 for (
size_t i = 0; i < n; i++)
39 static_assert (
sizeof (
float) == 4,
"");
40 static_assert (
sizeof (wchar_t) == 4,
"");
41 wmemcpy ((
wchar_t*) d, (
const wchar_t*) s, n);
48 static_assert (
sizeof (
uint32_t) == 4,
"");
49 static_assert (
sizeof (wchar_t) == 4,
"");
50 wmemcpy ((
wchar_t*) d, (
const wchar_t*) s, n);
55convert_samples (
size_t n,
const int16_t *src,
float *dst,
uint16 byte_order)
58 const auto bound = dst + n;
60 *dst++ = *src++ * (1. / 32768.);
64convert_clip_samples (
size_t n,
const float *src, int16_t *dst,
uint16 byte_order)
67 static_assert (
int16_t (0.99999990F * 32768.F) == 32767);
68 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.