From be4e9232cc05b96588b156d1c9f995f7eda41ec0 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Sat, 20 Aug 2022 17:27:08 +0200 Subject: [PATCH] Finished parameter access nodes --- CHANGELOG.md | 1 + src/dsp/mod.rs | 14 +++++----- src/dsp/node_ext.rs | 34 +++++++++++++++++------- src/lib.rs | 1 + src/nodes/node_exec.rs | 60 +++++++++++++++++++++++++++++++----------- tests/node_code.rs | 2 +- 6 files changed, 79 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c43afe..123b887 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,3 +19,4 @@ the scope handles for access to it's capture buffers. * Feature: Added the `FormFM` node that was contributed by Dimas Leenman (aka Skythedragon). * Feature: Added `MidiP` node for MIDI pitch/note input. * Feature: Added `MidiCC` node for MIDI CC input. +* Feature: Added `ExtA` to `ExtF` nodes for plugin parameter access. diff --git a/src/dsp/mod.rs b/src/dsp/mod.rs index 3aa73e6..b0def14 100644 --- a/src/dsp/mod.rs +++ b/src/dsp/mod.rs @@ -505,6 +505,8 @@ mod node_cqnt; #[allow(non_upper_case_globals)] mod node_delay; #[allow(non_upper_case_globals)] +mod node_ext; +#[allow(non_upper_case_globals)] mod node_fbwr_fbrd; #[allow(non_upper_case_globals)] mod node_formfm; @@ -513,8 +515,6 @@ mod node_map; #[allow(non_upper_case_globals)] mod node_midicc; #[allow(non_upper_case_globals)] -mod node_ext; -#[allow(non_upper_case_globals)] mod node_midip; #[allow(non_upper_case_globals)] mod node_mix3; @@ -602,17 +602,17 @@ use node_code::Code; use node_comb::Comb; use node_cqnt::CQnt; use node_delay::Delay; -use node_fbwr_fbrd::FbRd; -use node_fbwr_fbrd::FbWr; -use node_formfm::FormFM; -use node_map::Map; -use node_midicc::MidiCC; use node_ext::ExtA; use node_ext::ExtB; use node_ext::ExtC; use node_ext::ExtD; use node_ext::ExtE; use node_ext::ExtF; +use node_fbwr_fbrd::FbRd; +use node_fbwr_fbrd::FbWr; +use node_formfm::FormFM; +use node_map::Map; +use node_midicc::MidiCC; use node_midip::MidiP; use node_mix3::Mix3; use node_mux9::Mux9; diff --git a/src/dsp/node_ext.rs b/src/dsp/node_ext.rs index 86761fe..0ac033c 100644 --- a/src/dsp/node_ext.rs +++ b/src/dsp/node_ext.rs @@ -8,7 +8,6 @@ use crate::dsp::{ use crate::nodes::{NodeAudioContext, NodeExecContext}; use synfx_dsp::SlewValue; - macro_rules! define_ext { ($name: ident, $p1: ident, $p2: ident, $p3: ident) => { #[derive(Debug, Clone)] @@ -28,17 +27,32 @@ macro_rules! define_ext { pub const atv2: &'static str = "ExtA-F atv2\nAttenuverter for the A2 parameter\nRange: (-1..1)"; pub const atv3: &'static str = "ExtA-F atv3\nAttenuverter for the A3 parameter\nRange: (-1..1)"; - pub const sig1: &'static str = "ExtA-F sig1\nA1 output channel\nRange: (-1..1)"; - pub const sig2: &'static str = "ExtA-F sig2\nA2 output channel\nRange: (-1..1)"; - pub const sig3: &'static str = "ExtA-F sig3\nA3 output channel\nRange: (-1..1)"; + pub const sig1: &'static str = "ExtA-F sig1\nA-F1 output channel\nRange: (0..1)"; + pub const sig2: &'static str = "ExtA-F sig2\nA-F2 output channel\nRange: (0..1)"; + pub const sig3: &'static str = "ExtA-F sig3\nA-F3 output channel\nRange: (0..1)"; - pub const DESC: &'static str = "External Parameter Set A-F Input\n\n\ - \ - \ - \ - "; + pub const DESC: &'static str = "Ext. Parameter Set A-F Input\n\n\ + This node gives access to the 24 input parameters of the HexoSynth VST3/CLAP plugin. \ + A 'slew' limiter allows you to smooth out quick changes a bit if you need it. \ + Attenuverters (attenuators that can also invert) allow to reduce the amplitude \ + or invert the signal."; pub const HELP: &'static str = r#"External Parameter Set A-F Input - "#; + +This node gives access to the 24 input parameters of the +HexoSynth VST3/CLAP plugin. A 'slew' limiter allows you to smooth out quick +changes a bit if you need it. Attenuverters (attenuators that can also invert) +allow to reduce the amplitude or invert the signal. + +All instances of the nodes 'ExtA', 'ExtB', ..., 'ExtF' have access to the same +3 input parameters (A1-A3, B1-B3, ..., F1-F3). That means there is no +difference whether you use the same instance of different ones. +Except that you can of course set the `atv` and `slew` parameters to different +values. + +If you absolutely need more parameters to control the HexoSynth patch: +Keep in mind, that there is also the 'MidiCC' node, that allows HexoSynth to +react to MIDI CC messages. +"#; } impl DspNode for $name { diff --git a/src/lib.rs b/src/lib.rs index 136dff0..b2982a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,6 +64,7 @@ And following DSP nodes: | IO Util | Scope | Oscilloscope for up to 3 channels | | IO Util | MidiP | MIDI Pitch/Note input from plugin host, DAW or hardware | | IO Util | MidiCC | MIDI CC input from plugin host, DAW or hardware | +| IO Util | ExtA - ExtF | Access to plugin parameter sets A to F | ## API Examples diff --git a/src/nodes/node_exec.rs b/src/nodes/node_exec.rs index 46a7a2f..423c154 100644 --- a/src/nodes/node_exec.rs +++ b/src/nodes/node_exec.rs @@ -181,21 +181,51 @@ pub trait ExternalParams: Send + Sync { fn a1(&self) -> f32; fn a2(&self) -> f32; fn a3(&self) -> f32; - fn b1(&self) -> f32 { self.a1() } - fn b2(&self) -> f32 { self.a2() } - fn b3(&self) -> f32 { self.a3() } - fn c1(&self) -> f32 { self.a1() } - fn c2(&self) -> f32 { self.a2() } - fn c3(&self) -> f32 { self.a3() } - fn d1(&self) -> f32 { self.a1() } - fn d2(&self) -> f32 { self.a2() } - fn d3(&self) -> f32 { self.a3() } - fn e1(&self) -> f32 { self.a1() } - fn e2(&self) -> f32 { self.a2() } - fn e3(&self) -> f32 { self.a3() } - fn f1(&self) -> f32 { self.a1() } - fn f2(&self) -> f32 { self.a2() } - fn f3(&self) -> f32 { self.a3() } + fn b1(&self) -> f32 { + self.a1() + } + fn b2(&self) -> f32 { + self.a2() + } + fn b3(&self) -> f32 { + self.a3() + } + fn c1(&self) -> f32 { + self.a1() + } + fn c2(&self) -> f32 { + self.a2() + } + fn c3(&self) -> f32 { + self.a3() + } + fn d1(&self) -> f32 { + self.a1() + } + fn d2(&self) -> f32 { + self.a2() + } + fn d3(&self) -> f32 { + self.a3() + } + fn e1(&self) -> f32 { + self.a1() + } + fn e2(&self) -> f32 { + self.a2() + } + fn e3(&self) -> f32 { + self.a3() + } + fn f1(&self) -> f32 { + self.a1() + } + fn f2(&self) -> f32 { + self.a2() + } + fn f3(&self) -> f32 { + self.a3() + } } /// Contains global state that all nodes can access. diff --git a/tests/node_code.rs b/tests/node_code.rs index 2318ed7..780f4bb 100644 --- a/tests/node_code.rs +++ b/tests/node_code.rs @@ -59,7 +59,7 @@ fn check_node_code_state() { put_v(&mut block_fun, 0, 0, 3, "value", "220.0"); put_n(&mut block_fun, 0, 1, 2, "phase"); block_fun.shift_port(0, 1, 2, 0, false); // move reset up - block_fun.shift_port(0, 1, 2, 0, true); // move output down + block_fun.shift_port(0, 1, 2, 0, true); // move output down put_v(&mut block_fun, 0, 1, 4, "value", "2.0"); put_n(&mut block_fun, 0, 2, 3, "*"); put_n(&mut block_fun, 0, 3, 2, "-");