Make wave reading a bit clearer.

This commit is contained in:
Nolan Darilek 2022-02-01 14:22:41 -06:00
parent 3dada2fd8d
commit e053cfaa72

View File

@ -101,9 +101,11 @@ impl AssetLoader for BufferAssetLoader {
let reader = hound::WavReader::new(cursor);
if let Ok(mut reader) = reader {
let mut samples: Vec<i16> = vec![];
for sample in reader.samples::<i16>().flatten() {
for sample in reader.samples::<i16>() {
if let Ok(sample) = sample {
samples.push(sample);
}
}
Some(Buffer {
samples,
sample_rate: reader.spec().sample_rate as i32,