mirror of
https://github.com/lightsoutgames/bevy_openal.git
synced 2024-11-24 02:05:57 +00:00
Make wave reading a bit clearer.
This commit is contained in:
parent
3dada2fd8d
commit
e053cfaa72
|
@ -101,9 +101,11 @@ impl AssetLoader for BufferAssetLoader {
|
||||||
let reader = hound::WavReader::new(cursor);
|
let reader = hound::WavReader::new(cursor);
|
||||||
if let Ok(mut reader) = reader {
|
if let Ok(mut reader) = reader {
|
||||||
let mut samples: Vec<i16> = vec![];
|
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);
|
samples.push(sample);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Some(Buffer {
|
Some(Buffer {
|
||||||
samples,
|
samples,
|
||||||
sample_rate: reader.spec().sample_rate as i32,
|
sample_rate: reader.spec().sample_rate as i32,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user