diff --git a/src/dsp/mod.rs b/src/dsp/mod.rs index e7ebc22..72010ea 100644 --- a/src/dsp/mod.rs +++ b/src/dsp/mod.rs @@ -51,7 +51,7 @@ use crate::fa_sampl_dir; use crate::fa_ad_mult; use crate::fa_delay_mode; use crate::fa_noise_mode; -use crate::fa_map_k; +use crate::fa_map_mode; use node_amp::Amp; use node_sin::Sin; @@ -432,10 +432,10 @@ macro_rules! node_list { map => Map UIType::Generic UICategory::CV (0 inp n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) (1 atv n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) - (2 imin n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) - (3 imax n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) - (4 omin n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) - (5 omax n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) + (2 offs n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) + (3 min n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) + (4 max n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0) + {5 0 mode setting(0) fa_map_mode 0 1} [0 sig], tseq => TSeq UIType::Generic UICategory::CV (0 clock n_id d_id r_id f_def stp_d 0.0, 1.0, 0.0) diff --git a/src/dsp/node_map.rs b/src/dsp/node_map.rs index 63c5576..4f40a9d 100644 --- a/src/dsp/node_map.rs +++ b/src/dsp/node_map.rs @@ -6,8 +6,14 @@ use crate::nodes::{NodeAudioContext, NodeExecContext}; use crate::dsp::{NodeId, SAtom, ProcBuf, DspNode, LedPhaseVals}; #[macro_export] -macro_rules! fa_map_k { ($formatter: expr, $v: expr, $denorm_v: expr) => { { - write!($formatter, "{}", $v) +macro_rules! fa_map_mode { ($formatter: expr, $v: expr, $denorm_v: expr) => { { + let s = + match ($v.round() as usize) { + 0 => "Bipolar", + 1 => "Unipolar", + _ => "?", + }; + write!($formatter, "{}", s) } } } /// A simple amplifier @@ -24,14 +30,14 @@ impl Map { "Map inp\nSignal input\nRange: (-1..1)\n"; pub const atv : &'static str = "Map atv\n\nRange: (0..1)\n"; - pub const imin : &'static str = - "Map imin\n\nRange: (0..1)\n"; - pub const imax : &'static str = - "Map imax\n\nRange: (0..1)\n"; - pub const omin : &'static str = - "Map omin\n\nRange: (0..1)\n"; - pub const omax : &'static str = - "Map omax\n\nRange: (0..1)\n"; + pub const offs : &'static str = + "Map offs\nSignal input offset\nRange: (-1..1)\n"; + pub const min : &'static str = + "Map min\n\nRange: (0..1)\n"; + pub const max : &'static str = + "Map max\n\nRange: (0..1)\n"; + pub const mode : &'static str = + "Map mode\n"; pub const sig : &'static str = "Map sig\nMapped signal output\nRange: (-1..1)\n"; pub const DESC : &'static str =