readMaxLevels bug?

In using AudioFormatReader::readMaxLevels I am getting strange output. When I run it across the entire file (first two inputs are 0 and AudioFormatReader::lengthInSamples) I receive very low values (roughly 4 e-005). However I know there are samples of higher magnitude and when I run readMaxLevels on just that sample (first two inputs are and 1) I get the correct value.

Is this a bug or intended? How can I get the true max level over the entire file?

Maybe some of your samples contain NAN floating point values or something? That could mess things up, I guess…

I read the wav file into matlab and checked it. There are no NaN values and matlab finds the absolute minimum and maximum. I’m really stumped as to why this is happening.

Here is the file that I am using.

Thanks, I’ll take a look soon.

reading the max levels of only 100 samples at a time and then taking the max of all those local maxima resulted in the correct value.

Ah… There’s an incredibly dumb mistake in there that must have crept in recently. I’ve checked in a fix - thanks for letting me know!