diff --git a/Cargo.lock b/Cargo.lock index c8ab45a..40ae122 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "alsa" version = "0.7.1" @@ -24,10 +33,62 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "autocrap" version = "0.1.0" dependencies = [ + "clap", + "colog", + "log", "midir", "rosc", "rusb", @@ -66,6 +127,73 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "clap" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" + +[[package]] +name = "colog" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c426b7af8d5e0ad79de6713996632ce31f0d68ba84068fb0d654b396e519df0" +dependencies = [ + "colored", + "env_logger", + "log", +] + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -102,6 +230,47 @@ dependencies = [ "core-foundation-sys", ] +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itoa" version = "1.0.11" @@ -117,6 +286,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" version = "0.2.155" @@ -273,6 +448,35 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + [[package]] name = "rosc" version = "0.10.1" @@ -336,6 +540,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "syn" version = "2.0.68" @@ -366,6 +576,12 @@ dependencies = [ "quote", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "vcpkg" version = "0.2.15" @@ -442,13 +658,62 @@ version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -457,38 +722,128 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/Cargo.toml b/Cargo.toml index 15f89d8..13b6193 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,9 +4,12 @@ version = "0.1.0" edition = "2021" [dependencies] +clap = { version = "4.5.9", features = ["derive"] } +colog = "1.3.0" +log = "0.4.22" midir = "0.9.1" rosc = "~0.10" rusb = "0.9" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -usb-ids = "1.2024.3" \ No newline at end of file +usb-ids = "1.2024.3" diff --git a/src/autocrap/interpreter.rs b/src/autocrap/interpreter.rs index 762cbc9..df8aba1 100644 --- a/src/autocrap/interpreter.rs +++ b/src/autocrap/interpreter.rs @@ -1,3 +1,4 @@ +use log::{warn, info}; use rosc::{OscMessage, OscType}; use super::config::{Config, CtrlKind, Mapping, MidiKind, MidiSpec, OnOffMode, RelativeMode}; @@ -29,11 +30,11 @@ impl Interpreter { } let Some(logic) = logic_opt else { - println!("warning: unhandled mapping {:?}", mapping); + warn!("unhandled mapping {:?}", mapping); continue; }; - println!("info: adding {:?}", logic); + info!("adding {:?}", logic); ctrls.push(logic); } } diff --git a/src/main.rs b/src/main.rs index 20f4c12..3890c64 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,8 @@ use std::{ error::Error, fs::File, io::BufReader, - net::{UdpSocket}, + net::UdpSocket, + path::PathBuf, sync::{ Arc, RwLock, mpsc @@ -12,6 +13,9 @@ use std::{ vec::Vec }; +use clap::Parser; +use colog; +use log::{error, warn, info, debug, trace}; use midir::{ MidiInput, MidiOutput, os::unix::{VirtualInput, VirtualOutput} @@ -47,15 +51,35 @@ struct Endpoint { direction: Direction, } +#[derive(Parser)] +#[command(version, about, long_about = None)] +struct Options { + /// Set a config file + #[arg(short, long, value_name = "FILE")] + config: PathBuf, + + /// Set logging level + #[arg(short, long)] + log: Option, +} + fn main() { run().unwrap(); } fn run() -> Result<()> { - let file = File::open("nocturn-midi.json")?; + let options = Options::parse(); + + let mut colog_builder = colog::default_builder(); + if let Some(ref filters_str) = options.log { + colog_builder.parse_filters(filters_str); + } + colog_builder.init(); + + let file = File::open(&options.config)?; let reader = BufReader::new(file); let config: Config = serde_json::from_reader(reader)?; - println!("config: {:?}", config); + info!("config: {:?}", config); let mut context = Context::new().unwrap(); @@ -65,25 +89,25 @@ fn run() -> Result<()> { let languages = handle.read_languages(DEFAULT_TIMEOUT).unwrap(); - println!("active configuration: {}", handle.active_configuration().unwrap()); - println!("languages: {:?}", languages); + info!("active configuration: {}", handle.active_configuration().unwrap()); + info!("languages: {:?}", languages); if !languages.is_empty() { let language = languages[0]; - println!( + info!( "manufacturer: {:?}", handle .read_manufacturer_string(language, &device_desc, DEFAULT_TIMEOUT) .ok() ); - println!( + info!( "product: {:?}", handle .read_product_string(language, &device_desc, DEFAULT_TIMEOUT) .ok() ); - println!( + info!( "serial number: {:?}", handle .read_serial_number_string(language, &device_desc, DEFAULT_TIMEOUT) @@ -96,8 +120,8 @@ fn run() -> Result<()> { let ctrl_out_endpoint = find_endpoint(&mut device, &device_desc, |e| e.config == config.out_endpoint && e.transfer_type == TransferType::Interrupt && e.direction == Direction::Out) .ok_or("control out endpoint not found").unwrap(); - println!("control in endpoint: {:?}", ctrl_in_endpoint); - println!("control out endpoint: {:?}", ctrl_out_endpoint); + info!("control in endpoint: {:?}", ctrl_in_endpoint); + info!("control out endpoint: {:?}", ctrl_out_endpoint); handle.set_auto_detach_kernel_driver(true).unwrap(); @@ -132,7 +156,7 @@ fn run() -> Result<()> { // handle.write_interrupt(ctrl_out_endpoint.address, &[0x00, 0x00], DEFAULT_TIMEOUT)?; }); } - None => println!("could not find device {:04x}:{:04x}", config.vendor_id, config.product_id), + None => error!("could not find device {:04x}:{:04x}", config.vendor_id, config.product_id), } Ok(()) @@ -213,7 +237,7 @@ fn configure_endpoint( endpoint: &Endpoint, ) -> Result<()> { // handle.set_active_configuration(endpoint.config)?; - println!("configure_endpoint {:?}", endpoint); + info!("configure_endpoint {:?}", endpoint); handle.claim_interface(endpoint.iface)?; // handle.set_alternate_setting(endpoint.iface, endpoint.setting)?; Ok(()) @@ -259,7 +283,7 @@ fn run_reader( continue; }; - // println!("read({:?}): {:02x?}", num_bytes, &all_bytes[..num_bytes]); + trace!("read({:?}): {:02x?}", num_bytes, &all_bytes[..num_bytes]); let mut i = 0; while i+1 < num_bytes { if all_bytes[i] == 0xb0 { @@ -270,13 +294,13 @@ fn run_reader( let bytes = &all_bytes[i..i+2]; i += 2; - // println!("bytes: {:02x?}", bytes); + trace!("bytes: {:02x?}", bytes); let num = bytes[0]; let val = bytes[1]; let Some(response) = interpreter.write().unwrap().handle_ctrl(num, val) else { - println!("unhandled data: {:02x?}", bytes); + warn!("unhandled data: {:02x?}", bytes); continue; }; @@ -286,7 +310,7 @@ fn run_reader( addr: addr, args: args, }); - // println!("osc out: {:?}", msg); + debug!("send osc: {:?}", msg); let msg_buf = encoder::encode(&msg)?; sock.send_to(&msg_buf, out_addr)?; @@ -295,13 +319,12 @@ fn run_reader( if let Some((_, out_conn)) = midi.as_mut() { if let Some(MidiResponse { data }) = response.midi { - // println!("send midi: {:02x?}", data); + debug!("send midi: {:02x?}", data); out_conn.send(&data)?; } } if let Some(CtrlResponse { data }) = response.ctrl { - // println!("ctrl: {:02x?}", data); ctrl_tx.send(data)?; } } @@ -314,9 +337,9 @@ fn run_writer( ctrl_rx: mpsc::Receiver> ) -> Result<()> { loop { - let ctrl_out = ctrl_rx.recv()?; - // println!("ctrl out: {:02x?}", ctrl_out); - handle.write_interrupt(endpoint.address, &ctrl_out, DEFAULT_TIMEOUT)?; + let data = ctrl_rx.recv()?; + debug!("send ctrl: {:02x?}", data); + handle.write_interrupt(endpoint.address, &data, DEFAULT_TIMEOUT)?; } } @@ -330,7 +353,7 @@ fn run_osc_receiver( }; let sock = UdpSocket::bind(in_addr)?; - println!("listening to {}", in_addr); + info!("listening to {}", in_addr); let mut buf = [0u8; rosc::decoder::MTU]; loop { @@ -339,13 +362,13 @@ fn run_osc_receiver( let (_, packet) = rosc::decoder::decode_udp(&buf[..size])?; match packet { OscPacket::Message(msg) => { - // println!("osc in: {} {:?}", msg.addr, msg.args); + debug!("recv osc: {} {:?}", msg.addr, msg.args); let Some(response) = interpreter.write().unwrap().handle_osc(&msg) else { - println!("unhandled osc message: with size {} from {}: {} {:?}", size, addr, msg.addr, msg.args); + warn!("unhandled osc message: with size {} from {}: {} {:?}", size, addr, msg.addr, msg.args); continue; }; - // println!("osc in response: {:?}", response); + trace!("osc in response: {:?}", response); let Some(CtrlResponse { data }) = response.ctrl else { continue; @@ -354,12 +377,13 @@ fn run_osc_receiver( ctrl_tx.send(data)? } OscPacket::Bundle(bundle) => { - println!("OSC Bundle: {:?}", bundle); + debug!("recv osc bundle: {:?}", bundle); + warn!("unhandled osc bundle: {:?}", bundle); } } } Err(e) => { - println!("error receiving from socket: {}", e); + error!("error receiving from socket: {}", e); break; } } @@ -411,13 +435,13 @@ fn run_midi_receiver( }; if let None = midi { - println!("no midi in port???"); + warn!("no midi in port???"); } loop { let msg = rx.recv().unwrap(); let Some(response) = interpreter.write().unwrap().handle_midi(&msg) else { - println!("unhandled midi message: {:?}", msg); + warn!("unhandled midi message: {:?}", msg); continue; };