2018-11-09 20:58:43 +00:00
|
|
|
use std::io::BufReader;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_wav_encodings() {
|
|
|
|
// 16 bit wav file exported from Audacity (1 channel)
|
2022-03-26 19:15:18 +00:00
|
|
|
let file = std::fs::File::open("assets/audacity16bit.wav").unwrap();
|
2018-11-09 20:58:43 +00:00
|
|
|
let mut decoder = rodio::Decoder::new(BufReader::new(file)).unwrap();
|
|
|
|
assert!(decoder.any(|x| x != 0)); // Assert not all zeros
|
|
|
|
|
|
|
|
// 16 bit wav file exported from LMMS (2 channels)
|
2022-03-26 19:15:18 +00:00
|
|
|
let file = std::fs::File::open("assets/lmms16bit.wav").unwrap();
|
2018-11-09 20:58:43 +00:00
|
|
|
let mut decoder = rodio::Decoder::new(BufReader::new(file)).unwrap();
|
|
|
|
assert!(decoder.any(|x| x != 0));
|
|
|
|
|
|
|
|
// 24 bit wav file exported from LMMS (2 channels)
|
2022-03-26 19:15:18 +00:00
|
|
|
let file = std::fs::File::open("assets/lmms24bit.wav").unwrap();
|
2018-11-09 20:58:43 +00:00
|
|
|
let mut decoder = rodio::Decoder::new(BufReader::new(file)).unwrap();
|
|
|
|
assert!(decoder.any(|x| x != 0));
|
|
|
|
|
|
|
|
// 32 bit wav file exported from Audacity (1 channel)
|
2022-03-26 19:15:18 +00:00
|
|
|
let file = std::fs::File::open("assets/audacity32bit.wav").unwrap();
|
2018-11-09 20:58:43 +00:00
|
|
|
let mut decoder = rodio::Decoder::new(BufReader::new(file)).unwrap();
|
|
|
|
assert!(decoder.any(|x| x != 0));
|
|
|
|
|
2020-01-31 00:15:41 +00:00
|
|
|
// 32 bit wav file exported from LMMS (2 channels)
|
2022-03-26 19:15:18 +00:00
|
|
|
let file = std::fs::File::open("assets/lmms32bit.wav").unwrap();
|
2018-11-09 20:58:43 +00:00
|
|
|
let mut decoder = rodio::Decoder::new(BufReader::new(file)).unwrap();
|
|
|
|
assert!(decoder.any(|x| x != 0));
|
2021-09-27 15:45:21 +00:00
|
|
|
|
|
|
|
// 32 bit signed integer wav file exported from Audacity (1 channel).
|
2022-03-26 19:15:18 +00:00
|
|
|
let file = std::fs::File::open("assets/audacity32bit_int.wav").unwrap();
|
2021-09-27 15:45:21 +00:00
|
|
|
let mut decoder = rodio::Decoder::new(BufReader::new(file)).unwrap();
|
|
|
|
assert!(decoder.any(|x| x != 0));
|
2018-11-09 20:58:43 +00:00
|
|
|
}
|