Update the null implementation

This commit is contained in:
Pierre Krieger 2016-08-03 13:05:51 +02:00
parent c2f89d8b2d
commit 6060582aa0
1 changed files with 29 additions and 19 deletions

View File

@ -2,9 +2,22 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use futures::Poll;
use futures::Task;
use futures::stream::Stream;
use CreationError; use CreationError;
use Format; use Format;
use FormatsEnumerationError; use FormatsEnumerationError;
use UnknownTypeBuffer;
pub struct EventLoop;
impl EventLoop {
#[inline]
pub fn new() -> EventLoop { EventLoop }
#[inline]
pub fn run(&self) { loop { /* TODO: don't spin */ } }
}
#[derive(Default)] #[derive(Default)]
pub struct EndpointsIterator; pub struct EndpointsIterator;
@ -52,18 +65,16 @@ impl Iterator for SupportedFormatsIterator {
} }
pub struct Voice; pub struct Voice;
pub struct SamplesStream;
impl Voice { impl Voice {
#[inline] #[inline]
pub fn new(_: &Endpoint, _: &Format) -> Result<Voice, CreationError> { pub fn new(_: &Endpoint, _: &Format, _: &EventLoop)
-> Result<(Voice, SamplesStream), CreationError>
{
Err(CreationError::DeviceNotAvailable) Err(CreationError::DeviceNotAvailable)
} }
#[inline]
pub fn append_data<'a, T>(&'a mut self, _: usize) -> Buffer<'a, T> {
unreachable!()
}
#[inline] #[inline]
pub fn play(&mut self) { pub fn play(&mut self) {
} }
@ -71,30 +82,29 @@ impl Voice {
#[inline] #[inline]
pub fn pause(&mut self) { pub fn pause(&mut self) {
} }
}
impl Stream for SamplesStream {
type Item = UnknownTypeBuffer;
type Error = ();
#[inline] #[inline]
pub fn get_period(&self) -> usize { fn poll(&mut self, _: &mut Task) -> Poll<Option<Self::Item>, Self::Error> {
0 Poll::NotReady
} }
#[inline] #[inline]
pub fn get_pending_samples(&self) -> usize { fn schedule(&mut self, _: &mut Task) {
unreachable!() }
} }
pub struct Buffer<T> {
marker: PhantomData<T>,
}
impl<T> Buffer<T> {
#[inline] #[inline]
pub fn underflowed(&self) -> bool { pub fn get_buffer(&mut self) -> &mut [T] {
false
}
}
pub struct Buffer<'a, T: 'a> {
marker: PhantomData<&'a T>,
}
impl<'a, T> Buffer<'a, T> {
#[inline]
pub fn get_buffer<'b>(&'b mut self) -> &'b mut [T] {
unreachable!() unreachable!()
} }