From 718f46154ff22bca8f732dbdd549f5b18e4b5306 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Tue, 8 Jun 2021 03:56:40 +0200 Subject: [PATCH] improving documentation --- src/dsp/mod.rs | 14 ++++++++++++++ src/dsp/node_sin.rs | 29 ++++++++++++++--------------- src/lib.rs | 2 +- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/dsp/mod.rs b/src/dsp/mod.rs index 6e42d56..cf7d936 100644 --- a/src/dsp/mod.rs +++ b/src/dsp/mod.rs @@ -1102,6 +1102,20 @@ macro_rules! make_node_info_enum { $(NodeInfo::$variant(n) => n.1.out_count()),+ } } + + pub fn desc(&self) -> &'static str { + match self { + NodeInfo::$v1 => "", + $(NodeInfo::$variant(n) => n.1.desc()),+ + } + } + + pub fn help(&self) -> &'static str { + match self { + NodeInfo::$v1 => "", + $(NodeInfo::$variant(n) => n.1.help()),+ + } + } } } } diff --git a/src/dsp/node_sin.rs b/src/dsp/node_sin.rs index 6971e7c..1dcc9d4 100644 --- a/src/dsp/node_sin.rs +++ b/src/dsp/node_sin.rs @@ -40,27 +40,26 @@ impl Sin { "Sin sig\nOscillator signal output.\n\nRange: (-1..1)\n"; pub const DESC : &'static str = - r#"Sin - A Sine Oscillator +r#"Sine Oscillator - This is a very simple oscillator that generates a - sine wave. - "#; +This is a very simple oscillator that generates a sine wave. +"#; pub const HELP : &'static str = - r#"Sin - A Sine Oscillator +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. +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 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. - "#; +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/lib.rs b/src/lib.rs index 3674924..a154244 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -264,7 +264,7 @@ mod util; pub use nodes::{new_node_engine, NodeConfigurator, NodeExecutor}; pub use cell_dir::CellDir; pub use matrix::{Matrix, Cell}; -pub use dsp::{NodeId, SAtom}; +pub use dsp::{NodeId, SAtom, NodeInfo}; pub use matrix_repr::load_patch_from_file; pub use matrix_repr::save_patch_to_file; pub use sample_lib::{SampleLibrary, SampleLoadError};