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

Added "NoDevice" to the list of Portaudio errors #160

Merged
merged 1 commit into from
Oct 2, 2017
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
7 changes: 6 additions & 1 deletion examples/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ const INTERLEAVED: bool = true;


fn main() {
run().unwrap()
match run() {
Ok(_) => {},
e => {
eprintln!("Example failed with the following: {:?}", e);
}
}
}

fn run() -> Result<(), pa::Error> {
Expand Down
7 changes: 6 additions & 1 deletion examples/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const STANDARD_SAMPLE_RATES: [f64; 13] = [


fn main() {
run().unwrap()
match run() {
Ok(_) => {},
e => {
eprintln!("Example failed with the following: {:?}", e);
}
}
}


Expand Down
13 changes: 12 additions & 1 deletion examples/hosts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@
extern crate portaudio as pa;

fn main() {
let pa = pa::PortAudio::new().unwrap();
match run() {
Ok(_) => {},
e => {
eprintln!("Example failed with the following: {:?}", e);
}
}
}

fn run() -> Result<(), pa::Error> {
let pa = try!(pa::PortAudio::new());

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

Ok(())
}
7 changes: 6 additions & 1 deletion examples/non_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ const INTERLEAVED: bool = true;


fn main() {
run().unwrap()
match run() {
Ok(_) => {},
e => {
eprintln!("Example failed with the following: {:?}", e);
}
}
}

fn run() -> Result<(), pa::Error> {
Expand Down
7 changes: 6 additions & 1 deletion examples/saw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const SAMPLE_RATE: f64 = 44_100.0;
const FRAMES_PER_BUFFER: u32 = 64;

fn main() {
run().unwrap()
match run() {
Ok(_) => {},
e => {
eprintln!("Example failed with the following: {:?}", e);
}
}
}


Expand Down
7 changes: 6 additions & 1 deletion examples/sine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ const TABLE_SIZE: usize = 200;


fn main() {
run().unwrap()
match run() {
Ok(_) => {},
e => {
eprintln!("Example failed with the following: {:?}", e);
}
}
}


Expand Down
4 changes: 4 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pub enum Error {
/// No Error
NoError =
ffi::PaErrorCode_paNoError,
/// No audio devices
NoDevice =
ffi::PA_NO_DEVICE,
/// Portaudio not initialized
NotInitialized =
ffi::PaErrorCode_paNotInitialized,
Expand Down Expand Up @@ -113,6 +116,7 @@ impl ::std::error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::NoError => "No Error",
Error::NoDevice => "No Device",
Error::NotInitialized => "PortAudio not initialized",
Error::UnanticipatedHostError => "Unanticipated error from the host",
Error::InvalidChannelCount => "Invalid number of channels",
Expand Down