Renamed TsLfo to TsLFO

This commit is contained in:
Weird Constructor 2021-08-13 05:13:17 +02:00
parent c65ca730b1
commit 369bc720b9
2 changed files with 19 additions and 19 deletions

View file

@ -104,7 +104,7 @@ use node_bosc::BOsc;
use node_vosc::VOsc;
use node_biqfilt::BiqFilt;
use node_comb::Comb;
use node_tslfo::TsLfo;
use node_tslfo::TsLFO;
use node_pverb::PVerb;
use node_rndwk::RndWk;
@ -749,7 +749,7 @@ macro_rules! node_list {
{6 0 mult setting(0) fa_ad_mult 0 2}
[0 sig]
[1 eoet],
tslfo => TsLfo UIType::Generic UICategory::Mod
tslfo => TsLFO UIType::Generic UICategory::Mod
(0 time n_lfot d_lfot r_lfot f_lfot stp_f 0.0, 1.0, 1000.0)
(1 trig n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0)
(2 rev n_id d_id r_id f_def stp_d 0.0, 1.0, 0.5)

View file

@ -10,12 +10,12 @@ use crate::dsp::{
use super::helpers::{TriSawLFO, Trigger};
#[derive(Debug, Clone)]
pub struct TsLfo {
pub struct TsLFO {
lfo: Box<TriSawLFO<f64>>,
trig: Trigger,
}
impl TsLfo {
impl TsLFO {
pub fn new(_nid: &NodeId) -> Self {
Self {
lfo: Box::new(TriSawLFO::new()),
@ -24,26 +24,26 @@ impl TsLfo {
}
pub const time : &'static str =
"TsLfo time\nThe frequency or period time of the LFO, goes all the \
"TsLFO time\nThe frequency or period time of the LFO, goes all the \
way from 0.1ms up to 30s. Please note, that the text entry is always \
in milliseconds.\nRange: (0..1)\n";
pub const trig : &'static str =
"TsLfo trig\nTriggers a phase reset of the LFO.\nRange: (0..1)\n";
"TsLFO trig\nTriggers a phase reset of the LFO.\nRange: (0..1)\n";
pub const rev : &'static str =
"TsLfo rev\nThe reverse point of the LFO waveform. At 0.5 the LFO \
"TsLFO rev\nThe reverse point of the LFO waveform. At 0.5 the LFO \
will follow a triangle waveform. At 0.0 or 1.0 the LFO waveform will \
be (almost) a (reversed) saw tooth. Node: A perfect sawtooth can not be \
achieved with this oscillator, as there will always be a minimal \
rise/fall time.\nRange: (0..1)\n";
pub const sig : &'static str =
"TsLfo sig\nThe LFO output.\nRange: (0..1)";
"TsLFO sig\nThe LFO output.\nRange: (0..1)";
pub const DESC : &'static str =
r#"TriSaw LFO
This simple LFO has a configurable waveform. You can blend between triangular to sawtooth waveforms using the 'rev' parameter.
"#;
pub const HELP : &'static str =
r#"TsLfo - TriSaw LFO
r#"TsLFO - TriSaw LFO
This simple LFO has a configurable waveform. You can blend between
triangular to sawtooth waveforms using the 'rev' parameter.
@ -54,7 +54,7 @@ kind of like an envelope.
}
impl DspNode for TsLfo {
impl DspNode for TsLFO {
fn outputs() -> usize { 1 }
fn set_sample_rate(&mut self, srate: f32) {
@ -75,23 +75,23 @@ impl DspNode for TsLfo {
{
use crate::dsp::{out, inp, denorm};
let time = inp::TsLfo::time(inputs);
let trig = inp::TsLfo::trig(inputs);
let rev = inp::TsLfo::rev(inputs);
let out = out::TsLfo::sig(outputs);
let time = inp::TsLFO::time(inputs);
let trig = inp::TsLFO::trig(inputs);
let rev = inp::TsLFO::rev(inputs);
let out = out::TsLFO::sig(outputs);
let mut lfo = &mut *self.lfo;
for frame in 0..ctx.nframes() {
if self.trig.check_trigger(denorm::TsLfo::trig(trig, frame)) {
if self.trig.check_trigger(denorm::TsLFO::trig(trig, frame)) {
lfo.reset();
}
let time_ms = denorm::TsLfo::time(time, frame).clamp(0.1, 300000.0);
let time_ms = denorm::TsLFO::time(time, frame).clamp(0.1, 300000.0);
lfo.set(
(1000.0 / time_ms) as f64,
denorm::TsLfo::rev(rev, frame) as f64);
denorm::TsLFO::rev(rev, frame) as f64);
out.write(frame, lfo.next_unipolar() as f32);
}
@ -106,8 +106,8 @@ impl DspNode for TsLfo {
Some(Box::new(move |gd: &dyn GraphAtomData, init: bool, _x: f32, xn: f32| -> f32 {
if init {
lfo.reset();
let time_idx = NodeId::TsLfo(0).inp_param("time").unwrap().inp();
let rev_idx = NodeId::TsLfo(0).inp_param("rev").unwrap().inp();
let time_idx = NodeId::TsLFO(0).inp_param("time").unwrap().inp();
let rev_idx = NodeId::TsLFO(0).inp_param("rev").unwrap().inp();
let time = gd.get_norm(time_idx as u32).sqrt();
let rev = gd.get_norm(rev_idx as u32);