diff --git a/README.md b/README.md index 8b7e854bee1aa295ec6591a6523540b639a6c459..06f13509c8d4ebe928e8bc19f81aacac4b93e179 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 dba16f0d7d255e4a5ed97379278ef465bff3ccdb..6b171d14fe2008851ab3b35a2ea1212d7f7ad2e0 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),