Restore the null implementation and compile it every time

This commit is contained in:
Pierre Krieger 2015-09-10 18:37:37 +02:00
parent 52e6e8231f
commit d9eae23023
2 changed files with 59 additions and 12 deletions

View File

@ -42,10 +42,14 @@ extern crate lazy_static;
pub use samples_formats::{SampleFormat, Sample};
#[cfg(all(not(windows), not(unix)))]
use null as cpal_impl;
use std::fmt;
use std::error::Error;
use std::ops::{Deref, DerefMut};
mod null;
mod samples_formats;
#[cfg(target_os = "linux")]
@ -60,10 +64,6 @@ mod cpal_impl;
#[path="coreaudio/mod.rs"]
mod cpal_impl;
#[cfg(all(not(windows), not(unix)))]
#[path="null/mod.rs"]
mod cpal_impl;
/// An iterator for the list of formats that are supported by the backend.
pub struct EndpointsIterator(cpal_impl::EndpointsIterator);

View File

@ -1,25 +1,68 @@
#![allow(dead_code)]
use std::marker::PhantomData;
use CreationError;
use Format;
use FormatsEnumerationError;
#[derive(Default)]
pub struct EndpointsIterator;
impl Iterator for EndpointsIterator {
type Item = Endpoint;
fn next(&mut self) -> Option<Endpoint> {
None
}
}
pub fn get_default_endpoint() -> Option<Endpoint> {
None
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Endpoint;
impl Endpoint {
pub fn get_supported_formats_list(&self)
-> Result<SupportedFormatsIterator, FormatsEnumerationError>
{
unreachable!()
}
}
pub struct SupportedFormatsIterator;
impl Iterator for SupportedFormatsIterator {
type Item = Format;
fn next(&mut self) -> Option<Format> {
None
}
}
pub struct Voice;
pub struct Buffer<'a, T>;
impl Voice {
pub fn new() -> Voice {
Voice
pub fn new(_: &Endpoint, _: &Format) -> Result<Voice, CreationError> {
Err(CreationError::DeviceNotAvailable)
}
pub fn get_channels(&self) -> ::ChannelsCount {
2
unreachable!()
}
pub fn get_samples_rate(&self) -> ::SamplesRate {
::SamplesRate(44100)
unreachable!()
}
pub fn get_samples_format(&self) -> ::SampleFormat {
::SampleFormat::U16
unreachable!()
}
pub fn append_data<'a, T>(&'a mut self, _: usize) -> Buffer<'a, T> {
Buffer
unreachable!()
}
pub fn play(&mut self) {
@ -29,9 +72,13 @@ impl Voice {
}
}
pub struct Buffer<'a, T: 'a> {
marker: PhantomData<&'a T>,
}
impl<'a, T> Buffer<'a, T> {
pub fn get_buffer<'b>(&'b mut self) -> &'b mut [T] {
[].as_mut_slice()
unreachable!()
}
pub fn finish(self) {