mirror of
https://github.com/RustAudio/rodio
synced 2024-12-13 21:52:38 +00:00
make sure buffer doesn't contain garbage
This commit is contained in:
parent
4ca81f7c5f
commit
dfed9be5ce
1 changed files with 6 additions and 6 deletions
|
@ -141,18 +141,18 @@ fn new_voice(endpoint: &Endpoint, events_loop: &Arc<EventLoop>)
|
|||
let future_to_exec = stream.for_each(move |mut buffer| -> Result<_, ()> {
|
||||
match buffer {
|
||||
UnknownTypeBuffer::U16(ref mut buffer) => {
|
||||
for (o, i) in buffer.iter_mut().zip(mixer_rx.by_ref()) {
|
||||
*o = i.to_u16();
|
||||
for d in buffer.iter_mut() {
|
||||
*d = mixer_rx.next().map(|s| s.to_u16()).unwrap_or(0u16);
|
||||
}
|
||||
},
|
||||
UnknownTypeBuffer::I16(ref mut buffer) => {
|
||||
for (o, i) in buffer.iter_mut().zip(mixer_rx.by_ref()) {
|
||||
*o = i.to_i16();
|
||||
for d in buffer.iter_mut() {
|
||||
*d = mixer_rx.next().map(|s| s.to_i16()).unwrap_or(0i16);
|
||||
}
|
||||
},
|
||||
UnknownTypeBuffer::F32(ref mut buffer) => {
|
||||
for (o, i) in buffer.iter_mut().zip(mixer_rx.by_ref()) {
|
||||
*o = i;
|
||||
for d in buffer.iter_mut() {
|
||||
*d = mixer_rx.next().unwrap_or(0f32);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue