Some of the samples returned from AudioReader->readSamples are null

Hi, I'm find that some of audio samples being returned are NULL. Is this normal? The audiofile is just a .wav of music.

These are floating point numbers - of course they can be zero (?).

(But referring to floating points as "NULL" makes little sense.. Perhaps you're not explaining yourself very well here?)

I'm seeing something similar right now.

I have a program that uses AudioFormatReader::searchForLevel to scan mp3s to look for appropriate points to initiate crossfades. When I scan thousands of files, I eventually run into an Unhandled Exception and it breaks on the line

dst[j] = ((uint32) *src) << 16;

in juce_WindowsMediaAudioFormat.cpp/readSamples because src is pointing at ???.

I don't think it's the files themselves because if I scan the file that it threw the exception on individually the code runs fine. It's only when I'm iterating through a directory of files that this issue comes up. On different runs it will throw the exception on different files.

Could I just be using searchForLevel incorrectly?

my call looks like this

int64 length = reader->lengthInSamples;

int64 outro_1 = reader->searchForLevel(length, -length, 0.09, 1.0, 0);

I seemed to have solved my own issue.

 

my scan function, which was calling the searchForLevel, was inside a useTimeSlice. One each time slice I would get the next file out of a directory iterator and then scan the file. When I had the return value for useTimeSlice set to 50 I would get intermittent exceptions like I described above. But when I set it 10 and below everything worked just fine (my UI became totally unresponsive at that point, but that's a secondary concern right now)

Not sure if that helps you at all, daithibowzy. But I wish you luck!