diff --git a/src/lib.rs b/src/lib.rs index 6a04f26..adb57a3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,9 +51,6 @@ If you have the possibility, you should try to match the format of the voice. #![feature(unsafe_destructor)] #![unstable] -#[cfg(all(not(windows), not(unix)))] -use this_platform_is_not_supported; - pub use samples_formats::{SampleFormat, Sample}; use std::ops::{Deref, DerefMut}; @@ -68,6 +65,10 @@ mod cpal_impl; #[path="wasapi/mod.rs"] mod cpal_impl; +#[cfg(all(not(windows), not(unix)))] +#[path="null/mod.rs"] +mod cpal_impl; + /// Controls a sound output. A typical application has one `Voice` for each sound /// it wants to output. /// diff --git a/src/null/mod.rs b/src/null/mod.rs new file mode 100644 index 0000000..ecec3a0 --- /dev/null +++ b/src/null/mod.rs @@ -0,0 +1,39 @@ +pub struct Voice; +pub struct Buffer<'a, T>; + +impl Voice { + pub fn new() -> Voice { + Voice + } + + pub fn get_channels(&self) -> ::ChannelsCount { + 2 + } + + pub fn get_samples_rate(&self) -> ::SamplesRate { + ::SamplesRate(44100) + } + + pub fn get_samples_format(&self) -> ::SampleFormat { + ::SampleFormat::U16 + } + + pub fn append_data<'a, T>(&'a mut self, _: uint) -> Buffer<'a, T> { + Buffer + } + + pub fn play(&mut self) { + } + + pub fn pause(&mut self) { + } +} + +impl<'a, T> Buffer<'a, T> { + pub fn get_buffer<'b>(&'b mut self) -> &'b mut [T] { + [].as_mut_slice() + } + + pub fn finish(self) { + } +}