diff --git a/examples/demo.rs b/examples/demo.rs index 78063a3..4c417ce 100644 --- a/examples/demo.rs +++ b/examples/demo.rs @@ -12,7 +12,8 @@ fn main() -> Result<(), Box> { let config = device.default_input_config()?; let sample_format = config.sample_format(); let config: cpal::StreamConfig = config.into(); - let (plot, plot_ingest) = Plot::new_and_ingestor(config.sample_rate.0, config.channels as usize); + let (plot, plot_ingest) = + Plot::new_and_ingestor(config.sample_rate.0, config.channels as usize); match sample_format { cpal::SampleFormat::F32 => run_audio::(device, config, plot_ingest)?, cpal::SampleFormat::I16 => run_audio::(device, config, plot_ingest)?, @@ -36,12 +37,18 @@ fn main() -> Result<(), Box> { fn err_fn(err: cpal::StreamError) { eprintln!("Virhe äänilaitteen kanssa: {}", err); } -fn run_audio(device: cpal::Device, config: cpal::StreamConfig, mut plot_ingest: PlotIngest) -> Result<(), Box> { +fn run_audio( + device: cpal::Device, + config: cpal::StreamConfig, + mut plot_ingest: PlotIngest, +) -> Result<(), Box> { let audio_cb = move |data: &[T], _: &cpal::InputCallbackInfo| { plot_ingest.process(data); }; std::thread::spawn(move || { - let input_stream = device.build_input_stream(&config, audio_cb, err_fn).unwrap(); + let input_stream = device + .build_input_stream(&config, audio_cb, err_fn) + .unwrap(); input_stream.play().unwrap(); std::thread::park(); });