From 51453bae16d69881d1dcc7cd8737957e6c512854 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Sun, 24 Jul 2022 12:19:49 +0200 Subject: [PATCH] reformatting --- src/chain_builder.rs | 15 +++++++-------- src/lib.rs | 4 ++-- tests/common/mod.rs | 2 +- tests/node_ad.rs | 4 +--- tests/node_delay.rs | 15 +++++++++++++-- 5 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/chain_builder.rs b/src/chain_builder.rs index 6d47d6b..4ad0d72 100644 --- a/src/chain_builder.rs +++ b/src/chain_builder.rs @@ -22,7 +22,6 @@ The [crate::MatrixCellChain] abstractions allows very easy placement of DSP sign ``` */ - use crate::{Cell, CellDir, Matrix, NodeId, ParamId, SAtom}; use std::collections::HashMap; @@ -75,12 +74,7 @@ impl MatrixCellChain { /// /// The direction is used to guide the placement of the cells. pub fn new(dir: CellDir) -> Self { - Self { - dir, - chain: vec![], - error: None, - param_idx: 0, - } + Self { dir, chain: vec![], error: None, param_idx: 0 } } fn output_dir(&self) -> CellDir { @@ -226,7 +220,12 @@ impl MatrixCellChain { /// /// If any error occured while building the chain (such as bad input/output names /// or unknown parameters), it will be returned here. - pub fn place(&mut self, matrix: &mut Matrix, at_x: usize, at_y: usize) -> Result<(), ChainError> { + pub fn place( + &mut self, + matrix: &mut Matrix, + at_x: usize, + at_y: usize, + ) -> Result<(), ChainError> { if let Some(err) = self.error.take() { return Err(err); } diff --git a/src/lib.rs b/src/lib.rs index f68aa3a..034e480 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -301,6 +301,7 @@ projects and authors, I can't relicense it. */ pub mod cell_dir; +pub mod chain_builder; #[allow(unused_macros, non_snake_case)] pub mod dsp; pub mod log; @@ -309,10 +310,10 @@ pub mod matrix_repr; pub mod monitor; pub mod nodes; pub mod sample_lib; -pub mod chain_builder; mod util; pub use cell_dir::CellDir; +pub use chain_builder::MatrixCellChain; pub use dsp::{NodeId, NodeInfo, ParamId, SAtom}; pub use log::log; pub use matrix::{Cell, Matrix}; @@ -320,7 +321,6 @@ pub use matrix_repr::load_patch_from_file; pub use matrix_repr::save_patch_to_file; pub use nodes::{new_node_engine, NodeConfigurator, NodeExecutor}; pub use sample_lib::{SampleLibrary, SampleLoadError}; -pub use chain_builder::MatrixCellChain; pub struct Context<'a, 'b, 'c, 'd> { pub nframes: usize, diff --git a/tests/common/mod.rs b/tests/common/mod.rs index d6ff59b..80785d7 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -5,8 +5,8 @@ pub use hexodsp::dsp::*; pub use hexodsp::matrix::*; pub use hexodsp::nodes::new_node_engine; -pub use hexodsp::NodeExecutor; pub use hexodsp::MatrixCellChain; +pub use hexodsp::NodeExecutor; use hound; diff --git a/tests/node_ad.rs b/tests/node_ad.rs index ba1e3d8..59dfccf 100644 --- a/tests/node_ad.rs +++ b/tests/node_ad.rs @@ -11,9 +11,7 @@ fn check_node_ad_1() { let mut matrix = Matrix::new(node_conf, 3, 3); let mut chain = MatrixCellChain::new(CellDir::B); - chain.node_out("ad", "sig") - .node_inp("out", "ch1") - .place(&mut matrix, 0, 0).unwrap(); + chain.node_out("ad", "sig").node_inp("out", "ch1").place(&mut matrix, 0, 0).unwrap(); matrix.sync().unwrap(); let ad = NodeId::Ad(0); diff --git a/tests/node_delay.rs b/tests/node_delay.rs index 1bf5a7d..23a16e5 100644 --- a/tests/node_delay.rs +++ b/tests/node_delay.rs @@ -119,9 +119,20 @@ fn check_node_delay_2() { vec![ // 10ms smoothing time for "inp" 0.001133, // 30ms delaytime just mixing the 0.5: - 0.5, 0.5, 0.5, // the delayed smoothing ramp (10ms): + 0.5, + 0.5, + 0.5, // the delayed smoothing ramp (10ms): 0.950001113, // the delay + input signal: - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0 ] ); }