added help and description to nodes

This commit is contained in:
Weird Constructor 2021-06-07 05:00:10 +02:00
parent c09477d50f
commit f925ac8116
8 changed files with 48 additions and 1 deletions

View file

@ -965,6 +965,8 @@ macro_rules! make_node_info_enum {
outputs: Vec<&'static str>, outputs: Vec<&'static str>,
input_help: Vec<&'static str>, input_help: Vec<&'static str>,
output_help: Vec<&'static str>, output_help: Vec<&'static str>,
node_help: &'static str,
node_desc: &'static str,
} }
impl $variant { impl $variant {
@ -980,6 +982,8 @@ macro_rules! make_node_info_enum {
input_help, input_help,
output_help: vec![$(crate::dsp::$variant::$out,)*], output_help: vec![$(crate::dsp::$variant::$out,)*],
node_help: crate::dsp::$variant::HELP,
node_desc: crate::dsp::$variant::DESC,
} }
} }

View file

@ -22,6 +22,9 @@ pub struct Amp {
} }
impl Amp { impl Amp {
pub const DESC : &'static str = r#""#;
pub const HELP : &'static str = r#""#;
pub fn new(_nid: &NodeId) -> Self { pub fn new(_nid: &NodeId) -> Self {
Self { Self {
} }

View file

@ -19,6 +19,9 @@ impl FbWr {
} }
pub const inp : &'static str = pub const inp : &'static str =
"FbWr inp\nSignal input\nRange: (-1..1)\n"; "FbWr inp\nSignal input\nRange: (-1..1)\n";
pub const DESC : &'static str = r#""#;
pub const HELP : &'static str = r#""#;
} }
impl DspNode for FbWr { impl DspNode for FbWr {
@ -64,6 +67,9 @@ impl FbRd {
Use this to adjust the feedback amount.\nRange: (0..1)\n"; Use this to adjust the feedback amount.\nRange: (0..1)\n";
pub const sig : &'static str = pub const sig : &'static str =
"FbRd sig\nFeedback signal output.\nRange: (-1..1)\n"; "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 { impl DspNode for FbRd {

View file

@ -53,6 +53,9 @@ impl Out {
pub const ch15: &'static str = "Out ch2\nAudio channel 2 (right)\nRange: (-1..1)"; 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 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 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 { impl DspNode for Out {

View file

@ -89,6 +89,9 @@ impl Sampl {
pub const sig : &'static str = pub const sig : &'static str =
"Sampl sig\nSampler audio output\nRange: (-1..1)\n"; "Sampl sig\nSampler audio output\nRange: (-1..1)\n";
pub const DESC : &'static str = r#""#;
pub const HELP : &'static str = r#""#;
} }
impl Sampl { impl Sampl {

View file

@ -9,7 +9,6 @@ use crate::dsp::{
}; };
use crate::dsp::helpers::fast_sin; use crate::dsp::helpers::fast_sin;
/// A sine oscillator /// A sine oscillator
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Sin { pub struct Sin {
@ -39,6 +38,29 @@ impl Sin {
\nRange: (Knob -0.2 .. 0.2) / (Signal -1.0 .. 1.0)\n"; \nRange: (Knob -0.2 .. 0.2) / (Signal -1.0 .. 1.0)\n";
pub const sig : &'static str = pub const sig : &'static str =
"Sin sig\nOscillator signal output.\n\nRange: (-1..1)\n"; "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 { impl DspNode for Sin {

View file

@ -31,6 +31,9 @@ pub struct Test {
} }
impl Test { impl Test {
pub const DESC : &'static str = r#""#;
pub const HELP : &'static str = r#""#;
pub fn new(_nid: &NodeId) -> Self { pub fn new(_nid: &NodeId) -> Self {
Self { Self {
} }

View file

@ -80,6 +80,9 @@ impl TSeq {
"TSeq gat5\nTrack 5 gate output\nRange: (-1..1)\n"; "TSeq gat5\nTrack 5 gate output\nRange: (-1..1)\n";
pub const gat6 : &'static str = pub const gat6 : &'static str =
"TSeq gat6\nTrack 6 gate output\nRange: (-1..1)\n"; "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 { impl DspNode for TSeq {