Merge pull request #146 from nchashch/sw_params_set_avail_min-fix

alsa: Pass period instead of buffer to snd_pcm_sw_params_set_avail_min
This commit is contained in:
tomaka 2017-02-04 08:46:57 +01:00 committed by GitHub
commit 80c008c0a0
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cpal" name = "cpal"
version = "0.4.3" version = "0.4.4"
authors = ["The CPAL contributors", "Pierre Krieger <pierre.krieger1708@gmail.com>"] authors = ["The CPAL contributors", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Low-level cross-platform audio playing library in pure Rust." description = "Low-level cross-platform audio playing library in pure Rust."
repository = "https://github.com/tomaka/cpal" repository = "https://github.com/tomaka/cpal"

View File

@ -586,7 +586,7 @@ impl Voice {
let mut period = mem::uninitialized(); let mut period = mem::uninitialized();
check_errors(alsa::snd_pcm_get_params(playback_handle, &mut buffer, &mut period)).expect("could not initialize buffer"); check_errors(alsa::snd_pcm_get_params(playback_handle, &mut buffer, &mut period)).expect("could not initialize buffer");
assert!(buffer != 0); assert!(buffer != 0);
check_errors(alsa::snd_pcm_sw_params_set_avail_min(playback_handle, sw_params, buffer)).unwrap(); check_errors(alsa::snd_pcm_sw_params_set_avail_min(playback_handle, sw_params, period)).unwrap();
let buffer = buffer as usize * format.channels.len(); let buffer = buffer as usize * format.channels.len();
let period = period as usize * format.channels.len(); let period = period as usize * format.channels.len();
(buffer, period) (buffer, period)