Add supported formats enumeration

This commit is contained in:
Pierre Krieger 2015-09-01 13:53:54 +02:00
parent 47f966bf75
commit 1985c346ac
5 changed files with 185 additions and 44 deletions

View file

@ -1,7 +1,9 @@
extern crate cpal;
fn main() {
let mut channel = cpal::Voice::new(&cpal::get_default_endpoint().unwrap()).unwrap();
let endpoint = cpal::get_default_endpoint().unwrap();
let format = endpoint.get_supported_formats_list().next().unwrap();
let mut channel = cpal::Voice::new(&endpoint, &format).unwrap();
// Produce a sinusoid of maximum amplitude.
let mut data_source = (0u64..).map(|t| t as f32 * 0.03)