Minor fixes

This commit is contained in:
Pierre Krieger 2014-12-15 16:06:37 +01:00
parent 5c6fa4384f
commit 9598f68d3c
2 changed files with 10 additions and 4 deletions

View File

@ -186,8 +186,13 @@ impl<'a, T> Buffer<'a, T> {
/// Iterator over the samples of the buffer.
impl<'a, 'b, T> Iterator<&'b mut T> for SamplesIter<'a, 'b, T> {
fn next(&mut self) -> Option<&'b mut T> {
*self.0 += 1;
self.1.next()
match self.1.next() {
Some(v) => {
*self.0 += 1;
Some(v)
},
None => None
}
}
}

View File

@ -4,6 +4,7 @@ extern crate winapi;
use std::{mem, ptr};
use std::c_vec::CVec;
// TODO: determine if should be NoSend or not
pub struct Channel {
audio_client: *mut winapi::IAudioClient,
render_client: *mut winapi::IAudioRenderClient,
@ -58,7 +59,7 @@ impl Channel {
if frames_available == 0 {
// TODO:
::std::io::timer::sleep(::std::time::duration::Duration::milliseconds(5));
::std::io::timer::sleep(::std::time::duration::Duration::milliseconds(1));
continue;
}
@ -116,7 +117,7 @@ impl<'a, T> Buffer<'a, T> {
// releasing buffer
unsafe {
let f = self.render_client.as_mut().unwrap().lpVtbl.as_ref().unwrap().ReleaseBuffer;
let hresult = f(self.render_client, self.frames, 0);
let hresult = f(self.render_client, elements_written as u32, 0);
check_result(hresult).unwrap();
if self.start_on_drop {