1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
use structopt;
use structopt::clap::arg_enum;
#[derive(StructOpt, Debug)]
/// A command-line tool to manipulate PulseAudio's equalizers
pub struct Cli {
#[structopt(long, short, parse(from_occurrences))]
/// Pass many times for more log output
///
/// By default, it'll only report errors and warnings. Passing `-v` one time
/// also prints infos, `-vv` enables debug logging, and `-vvv` trace.
pub verbose: u8,
#[structopt(subcommand)]
pub cmd: Command,
}
#[derive(StructOpt, Debug)]
pub enum Command {
#[cfg(feature = "pa-eq")]
#[structopt(name = "pa-eq")]
/// PulseAudio equalizer related commands
///
/// Warning: the PulseAudio equalizer has been deprecated for a while,
/// and is known to sometimes cause crashes, latency or audible
/// artifacts
PaEq(pa_eq::Command),
#[cfg(feature = "pa-effects")]
#[structopt(name = "pa-effects")]
/// PulseEffects equalizer related commands
PaEffects(pa_effects::Command),
}
arg_enum! {
#[derive(Debug)]
pub enum EqualizerConfFormat {
EqualizerAPO
}
}
#[cfg(feature = "pa-eq")]
pub mod pa_eq {
use super::EqualizerConfFormat;
#[derive(StructOpt, Debug)]
pub enum Command {
#[structopt(name = "load")]
/// Load and switch to a given equalizer configuration
Load(LoadCli),
#[structopt(name = "reset")]
/// Switch to a neutral equalizer
Reset(ResetCli),
}
#[derive(StructOpt, Debug)]
pub struct LoadCli {
#[structopt(default_value = "-")]
/// The file from which to load the equalizer configuration
///
/// If "-" is given, read the configuration from the command-line.
pub file: String,
#[structopt(
short = "f",
long = "format",
possible_values = &EqualizerConfFormat::variants(),
case_insensitive = true,
default_value = "EqualizerAPO"
)]
/// The file format of the equalizer configuration
pub format: EqualizerConfFormat,
#[structopt(short = "s", long = "sink")]
/// Use the given sink.
///
/// By default it will use the last equalized sink it finds
pub sink: Option<String>,
}
#[derive(StructOpt, Debug)]
pub struct ResetCli {
#[structopt(short = "s", long = "sink")]
/// Use the given sink.
///
/// By default it will use the last equalized sink it finds
pub sink: Option<String>,
}
}
#[cfg(feature = "pa-effects")]
pub mod pa_effects {
use super::EqualizerConfFormat;
#[derive(StructOpt, Debug)]
pub enum Command {
#[structopt(name = "export-preset")]
/// Export a PulseEffects preset
ExportPreset(ExportPresetCli),
}
#[derive(StructOpt, Debug)]
pub struct ExportPresetCli {
#[structopt(default_value = "-")]
/// The file from which to load the equalizer configuration
///
/// If "-" is given, read the configuration from the command-line.
pub file: String,
#[structopt(
short = "f",
long = "format",
possible_values = &EqualizerConfFormat::variants(),
case_insensitive = true,
default_value = "EqualizerAPO"
)]
/// The file format of the equalizer configuration
pub format: EqualizerConfFormat,
#[structopt(short = "p", long = "base-preset")]
/// Use a given file as a base for PulseEffects preset instead of the
/// default one.
///
/// If "-" is given, read the base preset from the command-line.
pub base_preset: Option<String>,
#[structopt(short = "o", long = "output")]
/// Write the preset to the given file instead of the standard output
pub output: Option<String>,
}
}
|