Remove old .rustfmt.toml config. Run default cargo fmt on repo.
Seeing as a few large refactors have landed recently, I thought I'd take this opportunity to do a `cargo fmt` run and standardise on the default rustfmt settings.
This commit is contained in:
parent
95cda0dbe8
commit
aab0d90add
20 changed files with 458 additions and 530 deletions
|
|
@ -1,5 +1,5 @@
|
|||
extern crate cpal;
|
||||
extern crate anyhow;
|
||||
extern crate cpal;
|
||||
|
||||
use cpal::traits::{DeviceTrait, HostTrait};
|
||||
|
||||
|
|
@ -30,12 +30,17 @@ fn main() -> Result<(), anyhow::Error> {
|
|||
Err(e) => {
|
||||
println!("Error: {:?}", e);
|
||||
continue;
|
||||
},
|
||||
}
|
||||
};
|
||||
if input_formats.peek().is_some() {
|
||||
println!(" All supported input stream formats:");
|
||||
for (format_index, format) in input_formats.enumerate() {
|
||||
println!(" {}.{}. {:?}", device_index + 1, format_index + 1, format);
|
||||
println!(
|
||||
" {}.{}. {:?}",
|
||||
device_index + 1,
|
||||
format_index + 1,
|
||||
format
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -48,12 +53,17 @@ fn main() -> Result<(), anyhow::Error> {
|
|||
Err(e) => {
|
||||
println!("Error: {:?}", e);
|
||||
continue;
|
||||
},
|
||||
}
|
||||
};
|
||||
if output_formats.peek().is_some() {
|
||||
println!(" All supported output stream formats:");
|
||||
for (format_index, format) in output_formats.enumerate() {
|
||||
println!(" {}.{}. {:?}", device_index + 1, format_index + 1, format);
|
||||
println!(
|
||||
" {}.{}. {:?}",
|
||||
device_index + 1,
|
||||
format_index + 1,
|
||||
format
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,11 +69,14 @@ fn main() -> Result<(), anyhow::Error> {
|
|||
Err(err) => {
|
||||
input_fell_behind = Some(err);
|
||||
0.0
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
if let Some(err) = input_fell_behind {
|
||||
eprintln!("input stream fell behind: {:?}: try increasing latency", err);
|
||||
eprintln!(
|
||||
"input stream fell behind: {:?}: try increasing latency",
|
||||
err
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ extern crate cpal;
|
|||
extern crate hound;
|
||||
|
||||
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::fs::File;
|
||||
use std::io::BufWriter;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
fn main() -> Result<(), anyhow::Error> {
|
||||
// Use the default host for working with audio devices.
|
||||
|
|
@ -40,12 +40,10 @@ fn main() -> Result<(), anyhow::Error> {
|
|||
eprintln!("an error occurred on stream: {}", err);
|
||||
};
|
||||
|
||||
let data_fn = move |data: &cpal::Data| {
|
||||
match data.sample_format() {
|
||||
cpal::SampleFormat::F32 => write_input_data::<f32, f32>(data, &writer_2),
|
||||
cpal::SampleFormat::I16 => write_input_data::<i16, i16>(data, &writer_2),
|
||||
cpal::SampleFormat::U16 => write_input_data::<u16, i16>(data, &writer_2),
|
||||
}
|
||||
let data_fn = move |data: &cpal::Data| match data.sample_format() {
|
||||
cpal::SampleFormat::F32 => write_input_data::<f32, f32>(data, &writer_2),
|
||||
cpal::SampleFormat::I16 => write_input_data::<i16, i16>(data, &writer_2),
|
||||
cpal::SampleFormat::U16 => write_input_data::<u16, i16>(data, &writer_2),
|
||||
};
|
||||
|
||||
let stream = device.build_input_stream(&format, data_fn, err_fn)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue