(Fatal) bug: Resetting dsp::IIR::Filter<SIMDRegister<float>> leads to random initialization


When using dsp::IIR::Filter<> with SIMDRegister<float> as SampleType, calling the reset() method results in a very much different and also fatal behavior than using float as SampleType.

/** Resets the filter's processing pipeline, ready to start a new stream of data.

            Note that this clears the processing state, but the type of filter and
            its coefficients aren't changed.
        void reset()            { reset (SampleType {}); }

When using float: SampleType{} will return 0.0f, however with SIMDRegister<float> it returns just random values:

(juce::dsp::SIMDRegister<float>) $0 = {
  value = (2.75261417E+19, 0.0000000000000000000000000000000000000000459163468, 0.0000000000000000000000000000000000000203168547, 0.00000000000000000000000000000000000000000000140129846)

So the internal state would possibly set to very high values (2.75261417E+19).

Simple workaround would be just calling reset(SIMDRegister<float>(0.0f));
However, I guess fixing that would be better and more save (especially as the documentation says it clears the processing state). Maybe something like that?
void reset() { reset (SampleType {0.0}); }


Sorry for pushing this but I think its worth :slight_smile:
The above mentioned workaround is quite simple but I think one might want to expect the same behavior when calling reset() on a float and a SIMDRegister<float> filter.



Thank you for reporting - I’ve pushed the fix to the develop branch.