2022-02-13 18:14:52 +01:00
|
|
|
#![windows_subsystem = "windows"]
|
|
|
|
|
2022-04-10 15:33:51 +02:00
|
|
|
extern crate clap;
|
2016-11-23 23:37:39 +01:00
|
|
|
extern crate hound;
|
2016-11-25 00:54:42 +01:00
|
|
|
extern crate image;
|
2022-04-10 15:33:51 +02:00
|
|
|
extern crate indicatif;
|
2022-02-09 17:41:04 +01:00
|
|
|
extern crate rfd;
|
2022-02-20 20:36:21 +01:00
|
|
|
extern crate thiserror;
|
2016-11-23 23:37:39 +01:00
|
|
|
|
2022-04-10 15:33:51 +02:00
|
|
|
#[cfg(feature = "ui")]
|
|
|
|
extern crate eframe;
|
|
|
|
|
2016-11-24 19:40:22 +01:00
|
|
|
mod amdemod;
|
2016-11-26 00:12:10 +01:00
|
|
|
mod aptsyncer;
|
2022-04-10 15:33:51 +02:00
|
|
|
mod cli;
|
2022-02-09 21:28:26 +01:00
|
|
|
mod decoder;
|
2022-02-20 20:36:21 +01:00
|
|
|
mod errors;
|
2022-02-09 17:41:04 +01:00
|
|
|
mod firfilter;
|
|
|
|
mod resamplers;
|
|
|
|
mod utils;
|
2016-11-24 02:05:10 +01:00
|
|
|
|
2022-04-10 15:33:51 +02:00
|
|
|
use clap::{arg, command};
|
|
|
|
|
|
|
|
#[cfg(not(feature = "ui"))]
|
|
|
|
fn main() {
|
|
|
|
let matches = command!()
|
2023-08-02 20:31:11 +02:00
|
|
|
.arg(arg!([wavfile] "Input wav file with 48kHz samplingrate").required(true))
|
|
|
|
.arg(arg!([pngfile] "Output png file").default_value("output.png"))
|
2022-04-10 15:33:51 +02:00
|
|
|
.get_matches();
|
|
|
|
|
|
|
|
let input_file = matches
|
2023-08-02 20:31:11 +02:00
|
|
|
.get_one::<String>("wavfile")
|
|
|
|
.expect("No input file given");
|
|
|
|
|
2022-04-10 15:33:51 +02:00
|
|
|
let output_file = matches
|
2023-08-02 20:31:11 +02:00
|
|
|
.get_one::<String>("pngfile")
|
|
|
|
.expect("No output file given");
|
2022-04-10 15:33:51 +02:00
|
|
|
|
2023-08-02 20:31:11 +02:00
|
|
|
cli::decode(&input_file, &output_file);
|
2022-04-10 15:33:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "ui")]
|
|
|
|
mod ui;
|
|
|
|
|
|
|
|
#[cfg(feature = "ui")]
|
2022-02-09 21:28:26 +01:00
|
|
|
use ui::DecoderApp;
|
2016-11-28 10:59:32 +01:00
|
|
|
|
2022-04-10 15:33:51 +02:00
|
|
|
#[cfg(feature = "ui")]
|
2022-02-09 17:41:04 +01:00
|
|
|
fn main() {
|
2022-04-10 15:33:51 +02:00
|
|
|
let matches = command!()
|
2023-08-02 20:31:11 +02:00
|
|
|
.arg(arg!([wavfile] "Input wav file with 48kHz samplingrate").default_value("input.wav"))
|
|
|
|
.arg(arg!([pngfile] "Output png file").default_value("output.png"))
|
|
|
|
.arg(arg!(-n --nogui "Disable gui and run in command line mode"))
|
2022-04-10 15:33:51 +02:00
|
|
|
.get_matches();
|
2022-02-09 17:41:04 +01:00
|
|
|
|
2022-04-10 15:33:51 +02:00
|
|
|
let input_file = matches
|
2023-08-02 20:31:11 +02:00
|
|
|
.get_one::<String>("wavfile")
|
2022-04-10 15:33:51 +02:00
|
|
|
.expect("No input file given")
|
2022-06-15 20:43:37 +02:00
|
|
|
.to_string();
|
2022-04-10 15:33:51 +02:00
|
|
|
let output_file = matches
|
2023-08-02 20:31:11 +02:00
|
|
|
.get_one::<String>("pngfile")
|
2022-04-10 15:33:51 +02:00
|
|
|
.expect("No output file given")
|
2022-06-15 20:43:37 +02:00
|
|
|
.to_string();
|
2022-02-09 17:41:04 +01:00
|
|
|
|
2023-08-02 20:31:11 +02:00
|
|
|
if matches.get_flag("nogui") {
|
2022-06-15 20:43:37 +02:00
|
|
|
cli::decode(&input_file, &output_file);
|
2022-04-10 15:33:51 +02:00
|
|
|
} else {
|
|
|
|
let native_options = eframe::NativeOptions::default();
|
2022-06-15 20:43:37 +02:00
|
|
|
|
|
|
|
eframe::run_native(
|
|
|
|
"APT-Decoder",
|
|
|
|
native_options,
|
|
|
|
Box::new(move |_cc| Box::new(DecoderApp::new(&input_file, &output_file))),
|
|
|
|
);
|
2022-02-09 21:28:26 +01:00
|
|
|
}
|
2016-11-23 23:37:39 +01:00
|
|
|
}
|