From d3e4d9cc563ecec0a767862b8916f2a4b0fd7cda 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 1c2ca8b7ff..82203dc49f 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 daadd09c79..55b3189087 100644 --- a/modules/juce_dsp/processors/juce_IIRFilter_Impl.h +++ b/modules/juce_dsp/processors/juce_IIRFilter_Impl.h @@ -60,7 +60,7 @@ Filter::Filter (Coefficients::NumericTyp } template -void Filter::reset() +void Filter::reset (SampleType resetToValue) { auto newOrder = coefficients->getFilterOrder(); @@ -72,7 +72,7 @@ void Filter::reset() } for (size_t i = 0; i < order; ++i) - state[i] = SampleType {0}; + state[i] = resetToValue; } template