Received reports by two users shortly ofter we updated our plugin to juce 9. Some wav files don’t load anymore.
Edit:
Example wav file:
SomeWave.wav.zip (12.1 KB)
The problem is related to following change:
where the code is more restrictive about malformed chunks instead of just ignoring them, directly returns.
It would be great to get the old behaviour back where we continue the import also when a chunk is malformed, instead of skipping the whole loading process.
It looks like is common that some DAW’s and tools write malformed wav file chunks and people can’t read them anymore after this change. Edit: Such malformed wav files can also be found on older sample CD’s.
Edit: Other audio tools can load this files. I think we should also be able to do this.
Something like this restores the behaviour and fixes the problem:
if (numBytesAvailable >= 0 && snappedLength > numBytesAvailable)
{
// Malformed chunk, its length is longer than the stream itself
// return;
snappedLength = numBytesAvailable;
length = (uint32) numBytesAvailable;
}