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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
10 additions and
0 deletions
-
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) |
|
|
|