use crate::prelude::*;
pub(crate) struct Resample {
pub input: PathBuf,
pub output: PathBuf,
pub resample_rate: u32,
pub repeatable: bool,
pub sox: Ref<SoxFactory>,
}
impl Resample {
#[must_use]
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_info(self) -> CommandInfo {
let mut info = self.sox.create();
if self.repeatable {
info.args.push("-R".to_owned());
}
info.args.extend([
self.input.to_string_lossy().to_string(),
"-G".to_owned(),
"-b".to_owned(),
"16".to_owned(),
self.output.to_string_lossy().to_string(),
"rate".to_owned(),
"-v".to_owned(),
"-L".to_owned(),
self.resample_rate.to_string(),
"dither".to_owned(),
]);
info
}
}