Fix undefined behavior causing WAV files to be unrecognized #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
gcc (GCC) 11.2.0
produced a binary which treated even valid .wav files asInput file in unsupported format : "WAVEfmt" block missing !
. This change fixes that.This is the minimum work necessary to make the project build and run; it seems to work in practice. There's still some compiler warnings left, and maybe UB-type bugs in the code as well (I didn't test valgrind/asan yet). Also, IIRC the BRR decoder is incorrect and causes the encoder to generate incorrect BRR files in some edge cases, which decode properly in brr_decoder but not in accurate emulators (in rare circumstances, eg. when Gaussian filtering or resampling produces internal values beyond ±32k), probably related to #13.