You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
336 B
C++
14 lines
336 B
C++
3 years ago
|
Sample *process_data(Samples samples)
|
||
![]()
3 years ago
|
{
|
||
|
constexpr float alpha = 0.7;
|
||
|
|
||
3 years ago
|
static Sample prev = 2048;
|
||
![]()
3 years ago
|
|
||
|
samples[0] = (1 - alpha) * samples[0] + alpha * prev;
|
||
3 years ago
|
for (unsigned int i = 1; i < samples.size(); i++)
|
||
![]()
3 years ago
|
samples[i] = (1 - alpha) * samples[i] + alpha * samples[i - 1];
|
||
3 years ago
|
prev = samples[samples.size() - 1];
|
||
![]()
3 years ago
|
|
||
3 years ago
|
return samples.data();
|
||
![]()
3 years ago
|
}
|