Dsp::oversampling factor

I’m a bit confused with the oversampling factor.
from the dsp::Oversampling constructor doc:

@param factor the processing will perform 2 ^ factor times oversampling

So I though that a factor of 4 would give me an oversampling factor of 16, but getOversamplingFactor() returns 256…
The following test asserts :

int factor = 4;
dsp::Oversampling<float> os (1, factor, dsp::Oversampling<float>::filterHalfBandFIREquiripple, false);
jassert (std::pow (2, factor) == (int) os.getOversamplingFactor());

Does oversampling factor have a different meaning in the constructor and in the getOversamplingFactor() method?

or it’s just a small bug no?
oversamplingFactor is multiplied by 2 every time an oversampling stage is added (which is fine), but it’s initialised to 2^factor before that in the constructor. shouldn’t it just be initialised to 1 there ?


Hello ! You are absolutely right, the line 547 is a typo, it should just be initialized to 1u instead.

Could you have a look @tom or @jules ? Thanks !

I’ll get that fixed. Thanks for reporting.

1 Like