Improved top level documentation

This commit is contained in:
Weird Constructor 2022-07-24 07:34:45 +02:00
parent ed1ac581ce
commit ff202ea891
3 changed files with 56 additions and 4 deletions

View file

@ -10,3 +10,5 @@ similar bugs in the delay line (and all-pass & comb filters). Refactored
the cubic interpolation and tested it seperately now. the cubic interpolation and tested it seperately now.
* Feature: Matrix::get\_connections() returns information about the connections * Feature: Matrix::get\_connections() returns information about the connections
to the adjacent cells. to the adjacent cells.
* Feature: Added the MatrixCellChain abstraction for easy creation of DSP
chains on the hexagonal Matrix.

View file

@ -111,13 +111,16 @@ use hexodsp::*;
let (node_conf, mut node_exec) = new_node_engine(); let (node_conf, mut node_exec) = new_node_engine();
let mut matrix = Matrix::new(node_conf, 3, 3); let mut matrix = Matrix::new(node_conf, 3, 3);
let sin = NodeId::Sin(0); let sin = NodeId::Sin(0);
let amp = NodeId::Amp(0); let amp = NodeId::Amp(0);
let out = NodeId::Out(0);
matrix.place(0, 0, Cell::empty(sin) matrix.place(0, 0, Cell::empty(sin)
.out(None, None, sin.out("sig"))); .out(None, None, sin.out("sig")));
matrix.place(0, 1, Cell::empty(amp) matrix.place(0, 1, Cell::empty(amp)
.input(amp.inp("inp"), None, None)); .input(amp.inp("inp"), None, None)
.out(None, None, amp.out("sig")));
matrix.place(0, 2, Cell::empty(out)
.input(out.inp("inp"), None, None));
matrix.sync().unwrap(); matrix.sync().unwrap();
let gain_p = amp.inp_param("gain").unwrap(); let gain_p = amp.inp_param("gain").unwrap();
@ -128,6 +131,28 @@ let (out_l, out_r) = node_exec.test_run(0.11, true);
// samples now. // samples now.
``` ```
There is also a simplified version for easier setup of DSP chains
on the hexagonal grid, using the [crate::MatrixCellChain] abstraction:
```rust
use hexodsp::*;
let (node_conf, mut node_exec) = new_node_engine();
let mut matrix = Matrix::new(node_conf, 3, 3);
let mut chain = MatrixCellChain::new(CellDir::B);
chain.node_out("sin", "sig")
.node_io("amp", "inp", "sig")
.set_atom("gain", SAtom::param(0.25))
.node_inp("out", "ch1")
.place(&mut matrix, 0, 0);
matrix.sync().unwrap();
let (out_l, out_r) = node_exec.test_run(0.11, true);
// out_l and out_r contain two channels of audio
// samples now.
```
### State of Development ### State of Development
As of 2021-05-18: The architecture and it's functionality have been mostly As of 2021-05-18: The architecture and it's functionality have been mostly

View file

@ -113,13 +113,16 @@ use hexodsp::*;
let (node_conf, mut node_exec) = new_node_engine(); let (node_conf, mut node_exec) = new_node_engine();
let mut matrix = Matrix::new(node_conf, 3, 3); let mut matrix = Matrix::new(node_conf, 3, 3);
let sin = NodeId::Sin(0); let sin = NodeId::Sin(0);
let amp = NodeId::Amp(0); let amp = NodeId::Amp(0);
let out = NodeId::Out(0);
matrix.place(0, 0, Cell::empty(sin) matrix.place(0, 0, Cell::empty(sin)
.out(None, None, sin.out("sig"))); .out(None, None, sin.out("sig")));
matrix.place(0, 1, Cell::empty(amp) matrix.place(0, 1, Cell::empty(amp)
.input(amp.inp("inp"), None, None)); .input(amp.inp("inp"), None, None)
.out(None, None, amp.out("sig")));
matrix.place(0, 2, Cell::empty(out)
.input(out.inp("inp"), None, None));
matrix.sync().unwrap(); matrix.sync().unwrap();
let gain_p = amp.inp_param("gain").unwrap(); let gain_p = amp.inp_param("gain").unwrap();
@ -130,6 +133,28 @@ let (out_l, out_r) = node_exec.test_run(0.11, true);
// samples now. // samples now.
``` ```
There is also a simplified version for easier setup of DSP chains
on the hexagonal grid, using the [crate::MatrixCellChain] abstraction:
```rust
use hexodsp::*;
let (node_conf, mut node_exec) = new_node_engine();
let mut matrix = Matrix::new(node_conf, 3, 3);
let mut chain = MatrixCellChain::new(CellDir::B);
chain.node_out("sin", "sig")
.node_io("amp", "inp", "sig")
.set_atom("gain", SAtom::param(0.25))
.node_inp("out", "ch1")
.place(&mut matrix, 0, 0);
matrix.sync().unwrap();
let (out_l, out_r) = node_exec.test_run(0.11, true);
// out_l and out_r contain two channels of audio
// samples now.
```
## State of Development ## State of Development
As of 2021-05-18: The architecture and it's functionality have been mostly As of 2021-05-18: The architecture and it's functionality have been mostly