Prevent distortion filter from introducing NaNs in the audio buffer.

(cherry picked from commit b6b97b86ab)
This commit is contained in:
Ellen Poe 2021-02-18 16:53:26 -08:00 committed by Rémi Verschelde
parent 4065fa0bcf
commit 9178f694ea
1 changed files with 2 additions and 2 deletions

View File

@ -61,8 +61,8 @@ void AudioEffectDistortionInstance::process(const AudioFrame *p_src_frames, Audi
switch (base->mode) {
case AudioEffectDistortion::MODE_CLIP: {
a = powf(a, 1.0001 - drive_f);
float a_sign = a < 0 ? -1.0f : 1.0f;
a = powf(abs(a), 1.0001 - drive_f) * a_sign;
if (a > 1.0)
a = 1.0;
else if (a < (-1.0))