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. /// Iterator over the samples of the buffer.
impl<'a, 'b, T> Iterator<&'b mut T> for SamplesIter<'a, 'b, T> { impl<'a, 'b, T> Iterator<&'b mut T> for SamplesIter<'a, 'b, T> {
fn next(&mut self) -> Option<&'b mut T> { fn next(&mut self) -> Option<&'b mut T> {
*self.0 += 1; match self.1.next() {
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::{mem, ptr};
use std::c_vec::CVec; use std::c_vec::CVec;
// TODO: determine if should be NoSend or not
pub struct Channel { pub struct Channel {
audio_client: *mut winapi::IAudioClient, audio_client: *mut winapi::IAudioClient,
render_client: *mut winapi::IAudioRenderClient, render_client: *mut winapi::IAudioRenderClient,
@ -58,7 +59,7 @@ impl Channel {
if frames_available == 0 { if frames_available == 0 {
// TODO: // TODO:
::std::io::timer::sleep(::std::time::duration::Duration::milliseconds(5)); ::std::io::timer::sleep(::std::time::duration::Duration::milliseconds(1));
continue; continue;
} }
@ -116,7 +117,7 @@ impl<'a, T> Buffer<'a, T> {
// releasing buffer // releasing buffer
unsafe { unsafe {
let f = self.render_client.as_mut().unwrap().lpVtbl.as_ref().unwrap().ReleaseBuffer; 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(); check_result(hresult).unwrap();
if self.start_on_drop { if self.start_on_drop {