Skip to content

Commit

Permalink
Add an enumerate example
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Sep 22, 2015
1 parent fee0f0e commit 8f11173
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/enumerate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extern crate cpal;

use cpal::*;

fn main() {
let endpoints = cpal::get_endpoints_list();

println!("Endpoints: ");
for (endpoint_index, endpoint) in endpoints.enumerate() {
println!("{}. Endpoint \"{}\" Audio formats: ", endpoint_index + 1, endpoint.get_name());
let formats = endpoint.get_supported_formats_list().unwrap();
for (format_index, format) in formats.enumerate() {
println!("{}.{}. {:?}", endpoint_index+1, format_index+1, format);
}
}
}

0 comments on commit 8f11173

Please sign in to comment.