Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print defaults in devices.rs example. Add a hosts.rs example which displays the default host API, along with all available host APIs. #134

Merged
merged 2 commits into from
Apr 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ fn run() -> Result<(), pa::Error> {
let num_devices = try!(pa.device_count());
println!("Number of devices = {}", num_devices);

println!("Defualt input device: {:?}", pa.default_input_device());
println!("Defualt output device: {:?}", pa.default_output_device());

println!("All devices:");
for device in try!(pa.devices()) {
let (idx, info) = try!(device);
println!("--------------------------------------- {:?}", idx);
Expand Down
14 changes: 14 additions & 0 deletions examples/hosts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//! Prints all Host APIs that are available on the system and that this instance of PortAudio can
//! support.

extern crate portaudio as pa;

fn main() {
let pa = pa::PortAudio::new().unwrap();

println!("Default Host API: {:?}", pa.default_host_api());
println!("All Host APIs:");
for host in pa.host_apis() {
println!("{:#?}", host);
}
}