Browse Source

Merge pull request #386 from Windoze345/master

Fix reading of Wave-Files with odd Chunk-Lengths
pull/367/merge
Mark Heath 7 years ago
committed by GitHub
parent
commit
7e469878f4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      NAudio/FileFormats/Wav/WaveFileChunkReader.cs

10
NAudio/FileFormats/Wav/WaveFileChunkReader.cs

@ -94,6 +94,16 @@ namespace NAudio.FileFormats.Wav
}
stream.Position += chunkLength;
}
// All Chunks have to be word aligned.
// https://www.tactilemedia.com/info/MCI_Control_Info.html
// "If the chunk size is an odd number of bytes, a pad byte with value zero is
// written after ckData. Word aligning improves access speed (for chunks resident in memory)
// and maintains compatibility with EA IFF. The ckSize value does not include the pad byte."
if (((chunkLength % 2) != 0) && (br.PeekChar() == 0))
{
stream.Position++;
}
}
if (waveFormat == null)

Loading…
Cancel
Save