124 {
125
126
127 const auto& bins = formantFft.raw();
128 const int n = static_cast<int>(bins.size());
129 if (n < 8) {
131 return;
132 }
133
134
141 }
142
143 float f1Peak = 0.0f, f1Sum = 0.0f;
144 int f1Count = 0;
145 float f2Peak = 0.0f, f2Sum = 0.0f;
146 int f2Count = 0;
147
148 for (int i = 0; i < n; ++i) {
149 const float mag = bins[i];
152 f1Sum += mag;
153 ++f1Count;
154 }
157 f2Sum += mag;
158 ++f2Count;
159 }
160 }
161
162 if (f1Count > 0 && f2Count > 0) {
163 float f1Avg = f1Sum / static_cast<float>(f1Count);
164 float f2Avg = f2Sum / static_cast<float>(f2Count);
165 if (f1Peak >= f1Avg * 1.5f && f2Peak >= f2Avg * 1.5f && f1Peak >= 1e-6f) {
167 } else {
169 }
170 } else {
172 }
173}
int mFormantCachedBinCount
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT