Merge pull request #64 from tomaka/underflowed
Add an underflow() method to Voice
This commit is contained in:
commit
d3e610a614
|
@ -112,6 +112,10 @@ impl Voice {
|
|||
pub fn pause(&mut self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn underflowed(&self) -> bool {
|
||||
false // TODO:
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for Voice {}
|
||||
|
|
|
@ -359,6 +359,12 @@ impl Voice {
|
|||
pub fn pause(&mut self) {
|
||||
self.0.pause()
|
||||
}
|
||||
|
||||
/// Returns true if the voice has finished reading all the data you sent to it.
|
||||
#[inline]
|
||||
pub fn underflowed(&self) -> bool {
|
||||
self.0.underflowed()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Deref for Buffer<'a, T> where T: Sample {
|
||||
|
|
|
@ -81,6 +81,10 @@ impl Voice {
|
|||
#[inline]
|
||||
pub fn pause(&mut self) {
|
||||
}
|
||||
|
||||
pub fn underflowed(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Buffer<'a, T: 'a> {
|
||||
|
|
|
@ -301,6 +301,16 @@ impl Voice {
|
|||
|
||||
self.playing = false;
|
||||
}
|
||||
|
||||
pub fn underflowed(&self) -> bool {
|
||||
unsafe {
|
||||
let mut padding = mem::uninitialized();
|
||||
let hresult = (*self.audio_client).GetCurrentPadding(&mut padding);
|
||||
check_result(hresult).unwrap();
|
||||
|
||||
padding == 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Voice {
|
||||
|
|
Loading…
Reference in New Issue