2 #include "AudioTools/AudioLibs/AudioFFT.h"
3 #include "AudioTools/Concurrency/LockGuard.h"
8 static FFTDisplay *selfFFTDisplay =
nullptr;
9 #if defined(USE_CONCURRENCY)
22 selfFFTDisplay =
this;
38 magnitudes.resize(p_fft->
size());
39 for (
int j = 0; j < p_fft->
size(); j++) {
51 if (idx >= magnitudes.size()) {
52 idx = magnitudes.size() - 1;
54 total += magnitudes[idx];
59 int getMagnitudeScaled(
int x,
int max) {
61 static_cast<float>(max));
63 LOGD(
"fft_max_magnitude too small: current value is %f",
getMagnitude(x))
66 return min(result, max);
71 selfFFTDisplay->loadMangnitudes();
78 void loadMangnitudes() {
80 #if defined(USE_CONCURRENCY)
81 LockGuard guard(fft_mux);
83 for (
int j = 0; j < p_fft->
size(); j++) {
85 magnitudes[j] = value;