More refactoring

This commit is contained in:
Dandaedre 2023-04-20 18:22:02 +02:00
parent 4cdb40ae4f
commit 0fb4185ecf
4 changed files with 12 additions and 6 deletions

View File

@ -12,6 +12,7 @@ actix-web = "4.3.1"
reqwest = { version = "0.11.16", features = ["blocking"] }
base64 = "0.21.0"
lazy_static = "1.4.0"
toml = "0.7.3"
[[bin]]
name = "rusty_midicommander"
@ -19,4 +20,4 @@ path = "src/main.rs"
[[bin]]
name = "webtest"
path = "src/webtest.rs"
path = "src/webtest.rs"

View File

@ -18,8 +18,6 @@ use midir::MidiOutputConnection;
pub mod midi;
mod projector;
#[macro_use]
mod utils;
/// Simple program to greet a person
@ -29,6 +27,7 @@ struct Args {
/// The midi interface to select
midi_input: Option<usize>,
midi_output: Option<usize>,
config: Option<String>,
}
fn main() {
@ -38,6 +37,7 @@ fn main() {
Args {
midi_input: None,
midi_output: None,
config: _,
} => {
midi::print_midi_interfaces(&"No interface selected, please select one:".into());
return;
@ -45,10 +45,12 @@ fn main() {
Args {
midi_input: Some(_),
midi_output: Some(_),
config: _,
} => {}
Args {
midi_input: _,
midi_output: None,
config: _,
} => {
midi::print_midi_interfaces(&"No interface selected, please select one:".into());
return;
@ -56,6 +58,7 @@ fn main() {
_ => {}
}
// let config_text = &args.config;
println!("[INFO] Connecting with args: {:?}", args);
let proj = Arc::new(Mutex::new(projector::Projector::new(
"127.0.0.1:8080",

View File

@ -127,9 +127,7 @@ pub fn create_output_interface(
}
let output_port = &output_interface.ports()[port.unwrap()];
Arc::new(Mutex::new(
output_interface
.connect(output_port, "Rusty MIDI Commander Output")
.unwrap(),
output_interface.connect(output_port, name).unwrap(),
))
}
@ -139,6 +137,9 @@ pub fn cleanup(
// for message in messages.iter() {
// co.send(message).unwrap();
// }
// out_port
// .send(&[0xF0, 0x47, 0x7F, 0x29, 0x60, 0x00, 0x40, 0x08, 0x00, 0xF7])
// .unwrap();
for n in 0..=71 {
send_note_on(out_port, n, 0);
}

View File

@ -1,6 +1,7 @@
// The utils module should provide utility functions that are used throughout the program.
// These functions could include functions to convert MIDI messages to and from human-readable formats, or to handle errors.
#[macro_export]
macro_rules! list_actions {
($proj:ident, $($id:literal, $action:ident),+ ) => {
{