Add SupportedFormat (#168)

This commit is contained in:
tomaka 2017-10-20 21:18:40 +02:00 • committed by GitHub
parent 393206bde9
commit 87949d859b
9 changed files with 75 additions and 30 deletions

View file

@ -7,6 +7,7 @@ use CreationError;
use Format;
use FormatsEnumerationError;
use Sample;
use SupportedFormat;
use UnknownTypeBuffer;
extern {
@ -182,9 +183,10 @@ impl Endpoint {
// TODO: right now cpal's API doesn't allow flexibility here
// "44100" and "2" (channels) have also been hard-coded in the rest of the code ; if
// this ever becomes more flexible, don't forget to change that
Ok(vec![Format {
Ok(vec![SupportedFormat {
channels: vec![::ChannelPosition::BackLeft, ::ChannelPosition::BackRight],
samples_rate: ::SamplesRate(44100),
min_samples_rate: ::SamplesRate(44100),
max_samples_rate: ::SamplesRate(44100),
data_type: ::SampleFormat::F32,
}].into_iter())
}
@ -195,7 +197,7 @@ impl Endpoint {
}
}
pub type SupportedFormatsIterator = ::std::vec::IntoIter<Format>;
pub type SupportedFormatsIterator = ::std::vec::IntoIter<SupportedFormat>;
pub struct Buffer<'a, T: 'a> where T: Sample {
temporary_buffer: Vec<T>,