Browse Source

DSP: Added a second reset method to flush the IIR filter to a specific value

tags/2021-05-28
hogliux 8 years ago
parent
commit
048f319c38
2 changed files with 9 additions and 3 deletions
  1. +7
    -1
      modules/juce_dsp/processors/juce_IIRFilter.h
  2. +2
    -2
      modules/juce_dsp/processors/juce_IIRFilter_Impl.h

+ 7
- 1
modules/juce_dsp/processors/juce_IIRFilter.h View File

@@ -86,7 +86,13 @@ namespace IIR
Note that this clears the processing state, but the type of filter and Note that this clears the processing state, but the type of filter and
its coefficients aren't changed. 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. */ /** Called before processing starts. */


+ 2
- 2
modules/juce_dsp/processors/juce_IIRFilter_Impl.h View File

@@ -61,7 +61,7 @@ Filter<SampleType>::Filter (Coefficients<typename Filter<SampleType>::NumericTyp
} }
template <typename SampleType> template <typename SampleType>
void Filter<SampleType>::reset()
void Filter<SampleType>::reset (SampleType resetToValue)
{ {
auto newOrder = coefficients->getFilterOrder(); auto newOrder = coefficients->getFilterOrder();
@@ -73,7 +73,7 @@ void Filter<SampleType>::reset()
} }
for (size_t i = 0; i < order; ++i) for (size_t i = 0; i < order; ++i)
state[i] = SampleType {0};
state[i] = resetToValue;
} }
template <typename SampleType> template <typename SampleType>


Loading…
Cancel
Save