From 51133291605b663ff475d2992da79f7736c8eb75 Mon Sep 17 00:00:00 2001 From: David Huss <dh@atoav.com> Date: Fri, 18 Jun 2021 12:50:43 +0200 Subject: [PATCH] Add minor corrections --- README.md | 4 ++-- src/main.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8b7e854..06f1350 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ A matrix mixer allows you to send any input to any number of outputs. Internal c -The pattern for the OSC addresses is as follows: `/chn/1/send/2 <volume>`. This would set the send volume of input `1` to output `2`. The value `<volume>` should be a float, where a value of `0.0` equals -inf dB, `1.0` equals 0 dB and `7.0` equals +18 dB. +The pattern for the OSC addresses is as follows: `/chn/1/send/2 <volume>`. This would set the send volume of input `1` to output `2`. The value `<volume>` should be a float, where a value of `0.0` equals -inf dB, `1.0` equals 0 dB and `8.0` equals roughly +18 dB. If you are curious how to calculate this: `dB = 20.0 × log10(float)` @@ -27,4 +27,4 @@ If you are curious how to calculate this: `dB = 20.0 × log10(float)` 1. Clone this repository with git 2. Make sure you have rust installed then within the project directory run `cargo build --release` 3. Grab the resulting hexmatrix binary from the `./target` directory -4. Run it \ No newline at end of file +4. Run it diff --git a/src/main.rs b/src/main.rs index dba16f0..6b171d1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,13 +44,13 @@ static VOLS16: [AtomicUsize; 16] = arr![AtomicUsize::new(0); 16]; fn main() { // Receive OSC-Packets at this address - let addr = SocketAddrV4::from_str("127.0.0.1:7011").unwrap(); + let addr = SocketAddrV4::from_str("127.0.0.1:7011").expect("Please use a valid IP:Port addr"); let sock = UdpSocket::bind(addr).unwrap(); let mut buf = [0u8; rosc::decoder::MTU]; // Create new jack client (visible e.g. in Catia) let (client, _status) = - jack::Client::new("Hexmatrix", jack::ClientOptions::NO_START_SERVER).unwrap(); + jack::Client::new("Hexmatrix", jack::ClientOptions::NO_START_SERVER).expect("Couldn't connect to jack server. Not running?"); // Open n Jack Input Ports via arr! macro. let mut i = 0u16; @@ -206,7 +206,7 @@ fn process_message(msg: &OscMessage) { match (maybe_input, maybe_output, maybe_volume) { (Some(input), Some(output), Some(volume)) => { - println!("ᐅ OSC: Set Volume of Input {} at Output {} to {:.8} ({:.2} dB)", input, output, volume.max(0.0), (20.0* volume.max(0.0).log(10.0))); + println!("ᐅ OSC: Set Volume of Input {} at Output {} to {:.8} ({:.8} dB)", input, output, volume.max(0.0), (20.0* volume.max(0.0).log(10.0))); match input { 1 => VOLS1[output-1].store((volume * usize::MAX as f32) as usize, Ordering::Relaxed), 2 => VOLS2[output-1].store((volume * usize::MAX as f32) as usize, Ordering::Relaxed), -- GitLab