Fix IIR filter Q becoming negative #1476
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, the IIR filter wasn't clearing its previous Q interpolation, causing it to inherit the step factor from an older filter state (after calling e.g.
fluid_iir_filter_reset()
). This may have caused messing around with the Q, potentially becoming negative, and therefore causing a bunch ofinf
andnan
s to be generated whenever Q was passed tolog()
orsqrt()
. This in turn would lead to very high audio gain output. It is not quite clear to me though, why this affected only some audio drivers, when either reverb or chorus was active, and why most notably the file renderer was completely unimpressed by this issue.This PR properly clears the Q interpolation upon filter startup. Additionally, it was found that calling
fluid_sec2tc
with zero would have also raised a SIGFPE. This has been fixed as well.Fixes #1464