From ec0bd9ebbcd6099e17842f97c68774d0fa0bf3e8 Mon Sep 17 00:00:00 2001 From: tomaka Date: Fri, 15 Jan 2016 18:05:29 +0100 Subject: [PATCH] Improve error reporting in beep example --- examples/beep.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/beep.rs b/examples/beep.rs index 83b52b2..3c9272c 100644 --- a/examples/beep.rs +++ b/examples/beep.rs @@ -1,9 +1,9 @@ extern crate cpal; fn main() { - let endpoint = cpal::get_default_endpoint().unwrap(); - let format = endpoint.get_supported_formats_list().unwrap().next().unwrap(); - let mut channel = cpal::Voice::new(&endpoint, &format).unwrap(); + let endpoint = cpal::get_default_endpoint().expect("Failed to get default endpoint"); + let format = endpoint.get_supported_formats_list().unwrap().next().expect("Failed to get endpoint format"); + let mut channel = cpal::Voice::new(&endpoint, &format).expect("Failed to create a channel"); // Produce a sinusoid of maximum amplitude. let mut data_source = (0u64..).map(|t| t as f32 * 440.0 * 2.0 * 3.141592 / format.samples_rate.0 as f32) // 440 Hz