From 048f319c38e34078d5d9b543728eaee8689a6bbb Mon Sep 17 00:00:00 2001 From: hogliux Date: Mon, 31 Jul 2017 15:51:21 +0100 Subject: [PATCH] DSP: Added a second reset method to flush the IIR filter to a specific value --- modules/juce_dsp/processors/juce_IIRFilter.h | 8 +++++++- modules/juce_dsp/processors/juce_IIRFilter_Impl.h | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/juce_dsp/processors/juce_IIRFilter.h b/modules/juce_dsp/processors/juce_IIRFilter.h index 49f6fd63c9..23bffa8144 100644 --- a/modules/juce_dsp/processors/juce_IIRFilter.h +++ b/modules/juce_dsp/processors/juce_IIRFilter.h @@ -86,7 +86,13 @@ namespace IIR Note that this clears the processing state, but the type of filter and its coefficients aren't changed. */ - void reset(); + void reset() { reset (SampleType {0}); } + + /** Resets the filter's processing pipeline to a specific value. + + See @reset + */ + void reset (SampleType resetToValue); //============================================================================== /** Called before processing starts. */ diff --git a/modules/juce_dsp/processors/juce_IIRFilter_Impl.h b/modules/juce_dsp/processors/juce_IIRFilter_Impl.h index a4939483ee..e7e620e80a 100644 --- a/modules/juce_dsp/processors/juce_IIRFilter_Impl.h +++ b/modules/juce_dsp/processors/juce_IIRFilter_Impl.h @@ -61,7 +61,7 @@ Filter::Filter (Coefficients::NumericTyp } template -void Filter::reset() +void Filter::reset (SampleType resetToValue) { auto newOrder = coefficients->getFilterOrder(); @@ -73,7 +73,7 @@ void Filter::reset() } for (size_t i = 0; i < order; ++i) - state[i] = SampleType {0}; + state[i] = resetToValue; } template