hopefully a fix for the linux crash

This commit is contained in:
AlexandreRouma
2022-06-22 04:58:03 +02:00
parent b943e6e869
commit f2b8418a25
4 changed files with 14 additions and 7 deletions

View File

@@ -89,17 +89,17 @@ namespace dsp::loop {
float maxAmp = 0;
for (int j = i; j < count; j++) {
if constexpr (std::is_same_v<T, complex_t>) {
inAmp = in[i].amplitude();
inAmp = in[j].amplitude();
}
if constexpr (std::is_same_v<T, float>) {
inAmp = fabsf(in[i]);
inAmp = fabsf(in[j]);
}
if (inAmp > maxAmp) { maxAmp = inAmp; }
}
amp = maxAmp;
gain = _setPoint / maxAmp;
gain = std::min<float>(_setPoint / amp, _maxGain);
}
// Scale output by gain
out[i] = in[i] * gain;
}