From f925ac8116271eaef090071ceb2fe8a8b7138532 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Mon, 7 Jun 2021 05:00:10 +0200 Subject: [PATCH] added help and description to nodes --- src/dsp/mod.rs | 4 ++++ src/dsp/node_amp.rs | 3 +++ src/dsp/node_fbwr_fbrd.rs | 6 ++++++ src/dsp/node_out.rs | 3 +++ src/dsp/node_sampl.rs | 3 +++ src/dsp/node_sin.rs | 24 +++++++++++++++++++++++- src/dsp/node_test.rs | 3 +++ src/dsp/node_tseq.rs | 3 +++ 8 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/dsp/mod.rs b/src/dsp/mod.rs index 4a892b4..19f9b60 100644 --- a/src/dsp/mod.rs +++ b/src/dsp/mod.rs @@ -965,6 +965,8 @@ macro_rules! make_node_info_enum { outputs: Vec<&'static str>, input_help: Vec<&'static str>, output_help: Vec<&'static str>, + node_help: &'static str, + node_desc: &'static str, } impl $variant { @@ -980,6 +982,8 @@ macro_rules! make_node_info_enum { input_help, output_help: vec![$(crate::dsp::$variant::$out,)*], + node_help: crate::dsp::$variant::HELP, + node_desc: crate::dsp::$variant::DESC, } } diff --git a/src/dsp/node_amp.rs b/src/dsp/node_amp.rs index d49328d..517bbcd 100644 --- a/src/dsp/node_amp.rs +++ b/src/dsp/node_amp.rs @@ -22,6 +22,9 @@ pub struct Amp { } impl Amp { + pub const DESC : &'static str = r#""#; + pub const HELP : &'static str = r#""#; + pub fn new(_nid: &NodeId) -> Self { Self { } diff --git a/src/dsp/node_fbwr_fbrd.rs b/src/dsp/node_fbwr_fbrd.rs index fd23cc0..b594431 100644 --- a/src/dsp/node_fbwr_fbrd.rs +++ b/src/dsp/node_fbwr_fbrd.rs @@ -19,6 +19,9 @@ impl FbWr { } pub const inp : &'static str = "FbWr inp\nSignal input\nRange: (-1..1)\n"; + + pub const DESC : &'static str = r#""#; + pub const HELP : &'static str = r#""#; } impl DspNode for FbWr { @@ -64,6 +67,9 @@ impl FbRd { Use this to adjust the feedback amount.\nRange: (0..1)\n"; pub const sig : &'static str = "FbRd sig\nFeedback signal output.\nRange: (-1..1)\n"; + + pub const DESC : &'static str = r#""#; + pub const HELP : &'static str = r#""#; } impl DspNode for FbRd { diff --git a/src/dsp/node_out.rs b/src/dsp/node_out.rs index 829a9b4..30438e2 100644 --- a/src/dsp/node_out.rs +++ b/src/dsp/node_out.rs @@ -53,6 +53,9 @@ impl Out { pub const ch15: &'static str = "Out ch2\nAudio channel 2 (right)\nRange: (-1..1)"; pub const ch16: &'static str = "Out ch2\nAudio channel 2 (right)\nRange: (-1..1)"; pub const ch17: &'static str = "Out ch2\nAudio channel 2 (right)\nRange: (-1..1)"; + + pub const DESC : &'static str = r#""#; + pub const HELP : &'static str = r#""#; } impl DspNode for Out { diff --git a/src/dsp/node_sampl.rs b/src/dsp/node_sampl.rs index 15944fa..6950522 100644 --- a/src/dsp/node_sampl.rs +++ b/src/dsp/node_sampl.rs @@ -89,6 +89,9 @@ impl Sampl { pub const sig : &'static str = "Sampl sig\nSampler audio output\nRange: (-1..1)\n"; + + pub const DESC : &'static str = r#""#; + pub const HELP : &'static str = r#""#; } impl Sampl { diff --git a/src/dsp/node_sin.rs b/src/dsp/node_sin.rs index e919647..3441412 100644 --- a/src/dsp/node_sin.rs +++ b/src/dsp/node_sin.rs @@ -9,7 +9,6 @@ use crate::dsp::{ }; use crate::dsp::helpers::fast_sin; - /// A sine oscillator #[derive(Debug, Clone)] pub struct Sin { @@ -39,6 +38,29 @@ impl Sin { \nRange: (Knob -0.2 .. 0.2) / (Signal -1.0 .. 1.0)\n"; pub const sig : &'static str = "Sin sig\nOscillator signal output.\n\nRange: (-1..1)\n"; + + pub const DESC : &'static str = + r#"Sin - A Sine Oscillator + + This is a very simple oscillator that generates a + sine wave. + "#; + + pub const HELP : &'static str = + r#"Sin - A Sine Oscillator + + This is a very simple oscillator that generates a sine wave. + The 'freq' paramter specifies the frequency, and the 'det' parameter + allows you to detune the oscillator easily. + + You can send any signal to these input ports. The 'det' parameter takes + the same signal range as 'freq', which means, that a value of 0.1 detunes + by one octave. And a value 1.0 detunes by 10 octaves. This means that + for 'det' to be usefully modulated you need to attenuate the modulation input. + + You can do FM with this node, but for easy FM synthesis there are other + nodes available. + "#; } impl DspNode for Sin { diff --git a/src/dsp/node_test.rs b/src/dsp/node_test.rs index ffeb6ef..b1c65f7 100644 --- a/src/dsp/node_test.rs +++ b/src/dsp/node_test.rs @@ -31,6 +31,9 @@ pub struct Test { } impl Test { + pub const DESC : &'static str = r#""#; + pub const HELP : &'static str = r#""#; + pub fn new(_nid: &NodeId) -> Self { Self { } diff --git a/src/dsp/node_tseq.rs b/src/dsp/node_tseq.rs index 7291dcb..c82533d 100644 --- a/src/dsp/node_tseq.rs +++ b/src/dsp/node_tseq.rs @@ -80,6 +80,9 @@ impl TSeq { "TSeq gat5\nTrack 5 gate output\nRange: (-1..1)\n"; pub const gat6 : &'static str = "TSeq gat6\nTrack 6 gate output\nRange: (-1..1)\n"; + + pub const DESC : &'static str = r#""#; + pub const HELP : &'static str = r#""#; } impl DspNode for TSeq {