mirror of
https://github.com/RustAudio/rodio
synced 2024-11-10 22:24:15 +00:00
d20a3c661e
* Read 32 bit float and 24 bit int encoded files correctly. Before, we were assuming that all WAV files are encoded as 16 bit integers. This is not true, WAVs can actually also be encoded as 32 bit floats and 24 bit integers. Hound returns `Err` when we attempt to read files as the wrong encoding, which was getting `unwrap_or`'d to just zero. This explains why the file would load but not play any sound. We fix this by first checking for the appropriate encoding, and then converting to an i16. This might cause some slight dither issues but hopefully it is quiet enough that it doesn't matter. Fixes #195. * Add tests of reading wav files different encodings * Use `.map()` instead of control flow & unwrapping. This makes things slightly cleaner to read. Also remove extraneous print statement.
295 KiB
295 KiB