From 6bd070fcf3e6dea131ffe6498c0383f612b68644 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Sat, 20 Aug 2022 08:40:39 +0200 Subject: [PATCH] Small refactor --- src/dsp/node_exta.rs | 44 ++++++++++++++++++++++-------------------- src/dsp/node_midicc.rs | 1 - 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/dsp/node_exta.rs b/src/dsp/node_exta.rs index d1284fe..7f9c7d1 100644 --- a/src/dsp/node_exta.rs +++ b/src/dsp/node_exta.rs @@ -5,10 +5,9 @@ use crate::dsp::{ denorm, inp, out_idx, DspNode, LedPhaseVals, NodeContext, NodeId, ProcBuf, SAtom, }; -use crate::nodes::{HxMidiEvent, MidiEventPointer, NodeAudioContext, NodeExecContext}; +use crate::nodes::{NodeAudioContext, NodeExecContext}; use synfx_dsp::SlewValue; -/// The (stereo) output port of the plugin #[derive(Debug, Clone)] pub struct ExtA { slew1: SlewValue, @@ -20,23 +19,6 @@ impl ExtA { pub fn new(_nid: &NodeId) -> Self { Self { slew1: SlewValue::new(), slew2: SlewValue::new(), slew3: SlewValue::new() } } - - pub const slew: &'static str = "ExtA slew\nSlew limiter for the 3 parameters\nRange: (0..1)"; - pub const atv1: &'static str = "ExtA atv1\nAttenuverter for the A1 parameter\nRange: (-1..1)"; - pub const atv2: &'static str = "ExtA atv2\nAttenuverter for the A2 parameter\nRange: (-1..1)"; - pub const atv3: &'static str = "ExtA atv3\nAttenuverter for the A3 parameter\nRange: (-1..1)"; - - pub const sig1: &'static str = "ExtA sig1\nA1 output channel\nRange: (-1..1)"; - pub const sig2: &'static str = "ExtA sig2\nA2 output channel\nRange: (-1..1)"; - pub const sig3: &'static str = "ExtA sig3\nA3 output channel\nRange: (-1..1)"; - - pub const DESC: &'static str = "External Parameter Set A Input\n\n\ - \ - \ - \ - "; - pub const HELP: &'static str = r#"External Parameter Set A Input -"#; } impl DspNode for ExtA { @@ -53,7 +35,7 @@ impl DspNode for ExtA { ctx: &mut T, ectx: &mut NodeExecContext, _nctx: &NodeContext, - atoms: &[SAtom], + _atoms: &[SAtom], inputs: &[ProcBuf], outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals, @@ -87,6 +69,26 @@ impl DspNode for ExtA { } } - // ctx_vals[0].set(if change { 1.0 } else { 0.0 }); + let last_frame = ctx.nframes() - 1; + ctx_vals[0].set(sig1.read(last_frame)); } } + +impl ExtA { + pub const slew: &'static str = "ExtA slew\nSlew limiter for the 3 parameters\nRange: (0..1)"; + pub const atv1: &'static str = "ExtA atv1\nAttenuverter for the A1 parameter\nRange: (-1..1)"; + pub const atv2: &'static str = "ExtA atv2\nAttenuverter for the A2 parameter\nRange: (-1..1)"; + pub const atv3: &'static str = "ExtA atv3\nAttenuverter for the A3 parameter\nRange: (-1..1)"; + + pub const sig1: &'static str = "ExtA sig1\nA1 output channel\nRange: (-1..1)"; + pub const sig2: &'static str = "ExtA sig2\nA2 output channel\nRange: (-1..1)"; + pub const sig3: &'static str = "ExtA sig3\nA3 output channel\nRange: (-1..1)"; + + pub const DESC: &'static str = "External Parameter Set A Input\n\n\ + \ + \ + \ + "; + pub const HELP: &'static str = r#"External Parameter Set A Input +"#; +} diff --git a/src/dsp/node_midicc.rs b/src/dsp/node_midicc.rs index 5953db5..069a83d 100644 --- a/src/dsp/node_midicc.rs +++ b/src/dsp/node_midicc.rs @@ -15,7 +15,6 @@ macro_rules! fa_midicc_cc { }}; } -/// The (stereo) output port of the plugin #[derive(Debug, Clone)] pub struct MidiCC { cur_cc1: f32,