The attached wave-file loads and plays in all applications I have tested (Windows platform), but PWLib fails to open it, because of the presence of an 'unexpected' JUNK chunk.
In PWAVFile::ProcessHeader(), I would suggest to replace :
// Read the known part of the FORMAT chunk.
if (!ReadAndCheck(*this, &wavFmtChunk, sizeof(wavFmtChunk)))
return FALSE;
// check if labels are correct
if (strncmp(wavFmtChunk.hdr.tag, WAVLabelFMT_, sizeof(WAVLabelFMT_)) != 0) {
PTRACE(1,"WAV\tProcessHeader: Not FMT");
return (FALSE);
}
by :
// ignore chunks until we see a FORMAT chunk
for (;;) {
if (!ReadAndCheck(*this, &wavFmtChunk, sizeof(wavFmtChunk)))
return FALSE;
if (strncmp(wavFmtChunk.hdr.tag, WAVLabelFMT_, sizeof(WAVLabelFMT_)) == 0)
break;
if (!PFile::SetPosition(PFile::GetPosition() - sizeof(wavFmtChunk) + sizeof(wavFmtChunk.hdr) + wavFmtChunk.hdr.len)) {
PTRACE(1,"WAV\tProcessHeader: Cannot set new position");
return FALSE;
}
}
-- nando