History

wav: allow valid bits less than sample size

Nothing special action is required for files with number of valid bits less than the sample size. The reported precision will be incorrect, but that is less bad than refusing to process the file at all. If the specified valid bits is greater than the sample size, the file is rejected as per Microsoft recommendation.

Mans Rullgard committed 6 years ago

Commit 30f28d21 parent 909fad81 file · +3 −2Browse files

Unified · Split

src/wav.c+3−2
@@ -571,8 +571,9 @@ static int wav_read_fmt(sox_format_t *ft, uint32_t len) · 570 unmodified lines
571571 lsx_skipbytes(ft, 14);
572572 len -= 22;
573573
574− if (numberOfValidBits != wav->bitsPerSample) {
575− lsx_fail_errno(ft, SOX_EHDR, "WAVE file fmt with padded samples is not supported yet");
574+ if (numberOfValidBits > wav->bitsPerSample) {
575+ lsx_fail_errno(ft, SOX_EHDR,
576+ "wValidBitsPerSample > wBitsPerSample");
576577 return SOX_EOF;
577578 }
578579

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t