Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
datautils.cc
Go to the documentation of this file.
1 // This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
2#include "datautils.hh"
3#include "internal.hh"
4
5namespace Ase {
6
8
9float
10square_sum (uint n_values, const float *ivalues)
11{
12 float accu = 0.0;
13 for (uint i = 0; i < n_values; i++)
14 accu += ivalues[i] * ivalues[i];
15 return accu;
16}
17
18float
19square_max (uint n_values, const float *ivalues)
20{
21 float accu = 0.0;
22 for (uint i = 0; i < n_values; i++)
23 accu = std::max (accu, ivalues[i] * ivalues[i]);
24 return accu;
25}
26
27} // Ase
T max(T... args)
The Anklang C++ API namespace.
Definition api.hh:9
constexpr const uint AUDIO_BLOCK_FLOAT_ZEROS_SIZE
Maximum number of values in the const_float_zeros block.
Definition datautils.hh:10
float square_sum(uint n_values, const float *ivalues)
Calculate suqare sum of a block of floats.
Definition datautils.cc:10
float const_float_zeros[AUDIO_BLOCK_FLOAT_ZEROS_SIZE]
Block of const floats allof value 0.
Definition datautils.cc:7
float square_max(uint n_values, const float *ivalues)
Find the maximum suqared value in a block of floats.
Definition datautils.cc:19
uint32_t uint
Provide 'uint' as convenience type.
Definition cxxaux.hh:18