Fix period not being taken into account

This commit is contained in:
Pierre Krieger 2015-09-27 13:06:34 +02:00
parent d3a554b146
commit 8503bc2f8a
2 changed files with 3 additions and 1 deletions

View file

@ -9,7 +9,7 @@ repository = "https://github.com/tomaka/rodio"
documentation = "http://tomaka.github.io/rodio/rodio/index.html"
[dependencies]
cpal = "0.2.5"
cpal = "0.2.7"
hound = "1.0.0"
lazy_static = "0.1.12"
time = "0.1.32"

View file

@ -1,3 +1,4 @@
use std::cmp;
use std::mem;
use std::collections::HashMap;
use std::io::{Read, Seek};
@ -251,6 +252,7 @@ fn background(rx: Receiver<Command>) {
let mut buffer = {
let samples_to_write = voice.get_samples_rate().0 * voice.get_channels() as u32 * FIXED_STEP_MS / 1000;
let samples_to_write = cmp::max(samples_to_write, voice.get_period() as u32);
voice.append_data(samples_to_write as usize)
};