Minor fixes
This commit is contained in:
parent
5c6fa4384f
commit
9598f68d3c
|
@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue