From 2ef06de7cefaa571382badb55042916d375349e3 Mon Sep 17 00:00:00 2001 From: LunarCoffee Date: Mon, 29 Mar 2021 15:51:25 -0400 Subject: [PATCH] cleanup 3 --- Cargo.toml | 2 +- src/audio.rs | 2 +- src/gui.rs | 8 ++++---- src/main.rs | 3 --- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0a61ce8..82b2d76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ gui = ["druid"] [dependencies] clap = "2.33.3" -dasp = { version = "0.11.0", features = ["signal", "interpolate", "interpolate-floor", "interpolate-linear"] } +dasp = { version = "0.11.0", features = ["signal", "interpolate", "interpolate-linear"] } lame = "0.1.3" minimp3 = "0.5.1" diff --git a/src/audio.rs b/src/audio.rs index 7ddd4e3..9206ec8 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -85,7 +85,7 @@ fn stretch(src: impl Read, dest: &mut impl Write, rate: f64) -> Result<()> { dest.write_all(&buf[..written]).or(Err(AudioStretchError::DestinationIoError)) } -// Resamples dual channel PCM `samples` by a factor of `rate` in parallel with `threads` worker threads. +// Resamples dual channel PCM `samples` by a factor of `rate` in parallel with `n_threads` worker threads. fn resample_parallel(samples: Vec, rate: f64, n_threads: usize) -> (Vec, Vec) { // Split the samples into equally sized chunks and spawn a thread to process each. let n_chunks = (samples.len() as f64 / n_threads as f64).ceil() as usize; diff --git a/src/gui.rs b/src/gui.rs index 2258eef..c999efc 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -14,7 +14,7 @@ use crate::util; pub fn run_gui() -> ! { let main_window = WindowDesc::new(make_ui).title("osurate | osu! Rate Generator").resizable(false); - let data = AppData { rates_str: Arc::new(String::new()), files: vec![], log: "Info: started\n".to_string() }; + let data = AppData { rates_str: Arc::new(String::new()), files: vec![], log: "[Info] started\n".to_string() }; AppLauncher::with_window(main_window) .delegate(Delegate {}) @@ -82,7 +82,7 @@ fn make_ui() -> impl Widget { let rates = match rates_iter.collect::, _>>() { Ok(r) if r.iter().all(|&r| r >= 0.01) => r, _ => { - data.log += "Error: invalid rate(s) specified\n"; + data.log += "[Error] invalid rate(s) specified\n"; return; } }; @@ -90,8 +90,8 @@ fn make_ui() -> impl Widget { // Unlike the CLI version, press on after encountering errors. for file in &data.files { data.log += &match crate::generate_rates(file, &rates) { - Err(e) => format!("Error: {}\n", e), - Ok(map_name) => format!("Info: generated rate(s) for {}\n", map_name), + Err(e) => format!("[Error] {}\n", e), + Ok(map_name) => format!("[Info] generated rate(s) for {}\n", map_name), }; } }) diff --git a/src/main.rs b/src/main.rs index 19669ff..d944c70 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,4 @@ #![feature(available_concurrency)] -#![feature(box_syntax)] -#![feature(pub_macro_rules)] -#![feature(slice_as_chunks)] #![feature(try_trait)] use std::fs::File;