diff --git a/src/dsp/mod.rs b/src/dsp/mod.rs index aa2c6bc..d0081ca 100644 --- a/src/dsp/mod.rs +++ b/src/dsp/mod.rs @@ -32,6 +32,11 @@ pub type LedPhaseVals<'a> = &'a [Arc]; pub use satom::*; use crate::fa_out_mono; +use crate::fa_test_s; +use crate::fa_amp_neg_att; +use crate::fa_tseq_cmode; +use crate::fa_sampl_dclick; +use crate::fa_sampl_pmode; use node_amp::Amp; use node_sin::Sin; @@ -262,27 +267,6 @@ macro_rules! f_freq { ($formatter: expr, $v: expr, $denorm_v: expr) => { } } } - -// Formats Test s -macro_rules! fa_test_s { ($formatter: expr, $v: expr, $denorm_v: expr) => { { - let s = - match ($v.round() as usize) { - 0 => "Zero", - 1 => "One", - 2 => "Two", - 3 => "Three", - 4 => "Four", - 5 => "Five", - 6 => "Six", - 7 => "Seven", - 8 => "Eigth", - 9 => "Nine", - 10 => "Ten", - _ => "?", - }; - write!($formatter, "{}", s) -} } } - // norm-fun denorm-min // denorm-fun denorm-max define_exp!{n_gain d_gain 0.0, 2.0} @@ -315,11 +299,11 @@ macro_rules! node_list { (0 inp n_id d_id r_id f_def -1.0, 1.0, 0.0) (1 gain n_gain d_gain r_id f_def 0.0, 1.0, 1.0) (2 att n_att d_att r_id f_def 0.0, 1.0, 1.0) - {3 0 neg_att setting(1) f_def 0 1} + {3 0 neg_att setting(1) fa_amp_neg_att 0 1} [0 sig], tseq => TSeq UIType::Generic UICategory::CV (0 clock n_id d_id r_id f_def 0.0, 1.0, 0.0) - {1 0 cmode setting(1) f_def 0 2} + {1 0 cmode setting(1) fa_tseq_cmode 0 2} [0 trk1] [1 trk2] [2 trk3] @@ -333,8 +317,8 @@ macro_rules! node_list { (3 len n_id n_id r_id f_def 0.0, 1.0, 1.0) (4 dcms n_declick d_declick r_id f_def 0.0, 1.0, 3.14) {5 0 sample audio_unloaded("") f_def 0 0} - {6 1 pmode setting(0) f_def 0 1} - {7 2 dclick setting(0) f_def 0 1} + {6 1 pmode setting(0) fa_sampl_pmode 0 1} + {7 2 dclick setting(0) fa_sampl_dclick 0 1} [0 sig], sin => Sin UIType::Generic UICategory::Osc (0 freq n_pit d_pit r_id f_freq -1.0, 1.0, 440.0) @@ -360,35 +344,6 @@ macro_rules! node_list { } } -#[allow(non_snake_case)] -#[allow(non_upper_case_globals)] -pub mod labels { - pub mod Test { - pub const s : [&'static str; 11] = [ - "Zero", "One", "Two", "Three", "Four", - "Five", "Six", "Seven", "Eigth", "Nine", "Ten" - ]; - } - - pub mod Out { - pub const mono : [&'static str; 2] = ["Stereo", "Mono"]; - } - - pub mod Amp { - pub const neg_att : [&'static str; 2] = ["Allow", "Clip"]; - } - - pub mod TSeq { - pub const cmode : [&'static str; 3] = ["RowT", "PatT", "Phase"]; - } - - pub mod Sampl { - pub const sample : [&'static str; 0] = []; - pub const dclick : [&'static str; 2] = ["Off", "On"]; - pub const pmode : [&'static str; 2] = ["Loop", "OneShot"]; - } -} - impl UICategory { #[allow(unused_assignments)] pub fn get_node_ids(&self, mut skip: usize, mut fun: F) { @@ -553,23 +508,6 @@ macro_rules! make_node_info_enum { } } - pub fn setting_lbl(&self, lbl_idx: usize) -> Option<&'static str> { - match self.node { - NodeId::$v1 => None, - $(NodeId::$variant(_) => { - match self.idx { - $($in_at_idx => - if lbl_idx < crate::dsp::labels::$variant::$atom.len() { - Some(crate::dsp::labels::$variant::$atom[lbl_idx]) - } else { - None - },)* - _ => None, - } - }),+ - } - } - pub fn setting_min_max(&self) -> Option<(i64, i64)> { match self.node { NodeId::$v1 => None, diff --git a/src/dsp/node_amp.rs b/src/dsp/node_amp.rs index 65295f8..d49328d 100644 --- a/src/dsp/node_amp.rs +++ b/src/dsp/node_amp.rs @@ -5,6 +5,17 @@ use crate::nodes::{NodeAudioContext, NodeExecContext}; use crate::dsp::{NodeId, SAtom, ProcBuf, DspNode, LedPhaseVals}; +#[macro_export] +macro_rules! fa_amp_neg_att { ($formatter: expr, $v: expr, $denorm_v: expr) => { { + let s = + match ($v.round() as usize) { + 0 => "Allow", + 1 => "Clip", + _ => "?", + }; + write!($formatter, "{}", s) +} } } + /// A simple amplifier #[derive(Debug, Clone)] pub struct Amp { diff --git a/src/dsp/node_out.rs b/src/dsp/node_out.rs index 53ccdac..829a9b4 100644 --- a/src/dsp/node_out.rs +++ b/src/dsp/node_out.rs @@ -5,7 +5,6 @@ use crate::nodes::{NodeAudioContext, NodeExecContext}; use crate::dsp::{NodeId, SAtom, ProcBuf, inp, at, DspNode, LedPhaseVals}; -// Formats Out mono #[macro_export] macro_rules! fa_out_mono { ($formatter: expr, $v: expr, $denorm_v: expr) => { { let s = @@ -17,7 +16,6 @@ macro_rules! fa_out_mono { ($formatter: expr, $v: expr, $denorm_v: expr) => { { write!($formatter, "{}", s) } } } - /// The (stereo) output port of the plugin #[derive(Debug, Clone)] pub struct Out { diff --git a/src/dsp/node_sampl.rs b/src/dsp/node_sampl.rs index 434d957..2a0bc63 100644 --- a/src/dsp/node_sampl.rs +++ b/src/dsp/node_sampl.rs @@ -7,6 +7,28 @@ use crate::dsp::{NodeId, SAtom, ProcBuf, DspNode, LedPhaseVals}; use crate::dsp::{out, at, inp, denorm}; //, inp, denorm, denorm_v, inp_dir, at}; use super::helpers::Trigger; +#[macro_export] +macro_rules! fa_sampl_dclick { ($formatter: expr, $v: expr, $denorm_v: expr) => { { + let s = + match ($v.round() as usize) { + 0 => "Off", + 1 => "On", + _ => "?", + }; + write!($formatter, "{}", s) +} } } + +#[macro_export] +macro_rules! fa_sampl_pmode { ($formatter: expr, $v: expr, $denorm_v: expr) => { { + let s = + match ($v.round() as usize) { + 0 => "Loop", + 1 => "OneShot", + _ => "?", + }; + write!($formatter, "{}", s) +} } } + /// A simple amplifier #[derive(Debug, Clone)] pub struct Sampl { diff --git a/src/dsp/node_test.rs b/src/dsp/node_test.rs index 0c2e80b..ffeb6ef 100644 --- a/src/dsp/node_test.rs +++ b/src/dsp/node_test.rs @@ -5,6 +5,26 @@ use crate::nodes::{NodeAudioContext, NodeExecContext}; use crate::dsp::{NodeId, SAtom, ProcBuf, GraphFun, GraphAtomData, DspNode, LedPhaseVals}; +#[macro_export] +macro_rules! fa_test_s { ($formatter: expr, $v: expr, $denorm_v: expr) => { { + let s = + match ($v.round() as usize) { + 0 => "Zero", + 1 => "One", + 2 => "Two", + 3 => "Three", + 4 => "Four", + 5 => "Five", + 6 => "Six", + 7 => "Seven", + 8 => "Eigth", + 9 => "Nine", + 10 => "Ten", + _ => "?", + }; + write!($formatter, "{}", s) +} } } + /// A simple amplifier #[derive(Debug, Clone)] pub struct Test { diff --git a/src/dsp/node_tseq.rs b/src/dsp/node_tseq.rs index 0a0cd3a..9daa790 100644 --- a/src/dsp/node_tseq.rs +++ b/src/dsp/node_tseq.rs @@ -9,6 +9,19 @@ use crate::dsp::tracker::TrackerBackend; use crate::dsp::MAX_BLOCK_SIZE; +#[macro_export] +macro_rules! fa_tseq_cmode { ($formatter: expr, $v: expr, $denorm_v: expr) => { { + let s = + match ($v.round() as usize) { + 0 => "RowT", + 1 => "PatT", + 2 => "Phase", + _ => "?", + }; + write!($formatter, "{}", s) +} } } + + /// A tracker based sequencer #[derive(Debug)] pub struct TSeq {