Fix filter processing order in DSP chain #1444
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 was applied after the gain of the volume envelope was applied to the signal. This could have caused audible clicks when a voice is turned off while its filter was using a high Q value, see #1427.
This PR fixes that by applying the filter on the interpolated signal but before the volEnv gain is applied. This also matches the processing order of the DSP chain closer to the diagram of section 9.1.8 in the sf2 specification.
fluid_iir_filter_apply()
which is actually meant to process an array of samples is now used to process only a single sample. One might consider to define this function in header file to allow the compiler to inline it...Fixes #1427