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
|
#[macro_use]
extern crate log;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate structopt;
#[macro_use]
extern crate lalrpop_util;
#[cfg(feature = "pa-eq")]
extern crate dbus;
#[cfg(feature = "pa-effects")]
#[macro_use]
extern crate serde_json;
mod cli;
mod parsing;
mod utils;
#[cfg(feature = "pa-effects")]
mod pa_effects;
use crate::cli::*;
use failure::Error;
use structopt::StructOpt;
#[derive(Debug)]
pub struct Filter {
preamp: f64,
frequencies: Vec<u32>,
coefficients: Vec<f64>,
}
fn main() {
match start() {
Ok(()) => (),
Err(err) => {
error!("{}", err);
for cause in err.iter_causes() {
error!("Caused by: {}", cause);
}
std::process::exit(-1);
}
}
}
fn start() -> Result<(), Error> {
let args = Cli::from_args();
pretty_env_logger::formatted_builder()
.filter(
None,
match args.verbose {
0 => log::LevelFilter::Warn,
1 => log::LevelFilter::Info,
2 => log::LevelFilter::Debug,
_ => log::LevelFilter::Trace,
},
)
.try_init()?;
use crate::Command::*;
match args.cmd {
#[cfg(feature = "pa-eq")]
PaEq(args) => pa_eq::main(args),
#[cfg(feature = "pa-effects")]
PaEffects(args) => pa_effects::main(args),
}
}
|