Skip to main content

sound_to_patch/cli/
render.rs

1//! The arguments of `render`.
2
3use std::path::PathBuf;
4
5use clap::Args;
6
7use super::analyze::parse_bpm;
8use crate::render::file::Backend;
9use crate::synth::SynthArg;
10use crate::units::Bpm;
11
12/// Arguments of `render`.
13#[derive(Debug, Args)]
14pub struct RenderArgs {
15    /// The preset to render
16    pub preset: PathBuf,
17    /// The MIDI file with the notes, read as `analyze --notes` reads it
18    #[arg(long, value_name = "FILE")]
19    pub midi: PathBuf,
20    /// The tempo of the MIDI file in beats per minute, 4 to 1000
21    #[arg(long, value_name = "BPM", value_parser = parse_bpm, allow_negative_numbers = true)]
22    pub bpm: Bpm,
23    /// The WAV file to write; the render record goes next to it with .json
24    #[arg(short, long, value_name = "WAV")]
25    pub out: PathBuf,
26    /// The synth's .vst3 bundle [default: the bundle in
27    /// /Library/Audio/Plug-Ins/VST3, else in the user's VST3 folder]
28    #[arg(long, value_name = "BUNDLE")]
29    pub plugin: Option<PathBuf>,
30    /// The target synth.
31    #[command(flatten)]
32    pub synth: SynthArg,
33    /// Replace an existing WAV or record file
34    #[arg(long)]
35    pub force: bool,
36    /// What renders; `fake` is for tests of the command
37    #[arg(long, value_enum, default_value_t = Backend::Plugin, hide = true)]
38    pub backend: Backend,
39}