From 9efcafcb6df3bd47e90bca7fe325cc9d8112eae2 Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Tue, 17 Aug 2021 03:53:43 +0200 Subject: [PATCH] Fix some warnings --- src/dsp/helpers.rs | 7 +++++++ src/dsp/node_pverb.rs | 2 +- src/dsp/node_rndwk.rs | 3 +-- src/dsp/node_tslfo.rs | 6 +++--- src/dsp/node_vosc.rs | 2 +- tests/node_pverb.rs | 1 - 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/dsp/helpers.rs b/src/dsp/helpers.rs index 44ef44a..52a7043 100644 --- a/src/dsp/helpers.rs +++ b/src/dsp/helpers.rs @@ -829,9 +829,16 @@ macro_rules! fc { ($F: ident, $e: expr) => { F::from_f64($e).unwrap() } } +#[allow(dead_code)] #[inline] fn f(x: f64) -> F { F::from_f64(x).unwrap() } + +#[allow(dead_code)] +#[inline] fn fclamp(x: F, mi: F, mx: F) -> F { x.max(mi).min(mx) } + +#[allow(dead_code)] +#[inline] fn fclampc(x: F, mi: f64, mx: f64) -> F { x.max(f(mi)).min(f(mx)) } #[derive(Debug, Clone, Default)] diff --git a/src/dsp/node_pverb.rs b/src/dsp/node_pverb.rs index 5371f7e..24334b4 100644 --- a/src/dsp/node_pverb.rs +++ b/src/dsp/node_pverb.rs @@ -233,7 +233,7 @@ impl DspNode for PVerb { let out_l = &mut out_l[0]; let out_r = &mut out_r[0]; - let mut verb = &mut *self.verb; + let verb = &mut *self.verb; for frame in 0..ctx.nframes() { let (i_l, i_r) = (in_l.read(frame), in_r.read(frame)); diff --git a/src/dsp/node_rndwk.rs b/src/dsp/node_rndwk.rs index e97a8af..f0f01a1 100644 --- a/src/dsp/node_rndwk.rs +++ b/src/dsp/node_rndwk.rs @@ -6,7 +6,6 @@ use crate::nodes::{NodeAudioContext, NodeExecContext}; use crate::dsp::helpers::{Rng, Trigger, SlewValue}; use crate::dsp::{ NodeId, SAtom, ProcBuf, DspNode, LedPhaseVals, NodeContext, - GraphAtomData, GraphFun, }; /// A triggered random walker @@ -106,7 +105,7 @@ impl DspNode for RndWk { _atoms: &[SAtom], inputs: &[ProcBuf], outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals) { - use crate::dsp::{out, inp, denorm, denorm_offs, at}; + use crate::dsp::{out, inp, denorm}; let trig = inp::RndWk::trig(inputs); let step = inp::RndWk::step(inputs); diff --git a/src/dsp/node_tslfo.rs b/src/dsp/node_tslfo.rs index 549245b..436f600 100644 --- a/src/dsp/node_tslfo.rs +++ b/src/dsp/node_tslfo.rs @@ -70,7 +70,7 @@ impl DspNode for TsLFO { fn process( &mut self, ctx: &mut T, _ectx: &mut NodeExecContext, _nctx: &NodeContext, - atoms: &[SAtom], inputs: &[ProcBuf], + _atoms: &[SAtom], inputs: &[ProcBuf], outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals) { use crate::dsp::{out, inp, denorm}; @@ -80,7 +80,7 @@ impl DspNode for TsLFO { let rev = inp::TsLFO::rev(inputs); let out = out::TsLFO::sig(outputs); - let mut lfo = &mut *self.lfo; + let lfo = &mut *self.lfo; for frame in 0..ctx.nframes() { if self.trig.check_trigger(denorm::TsLFO::trig(trig, frame)) { @@ -103,7 +103,7 @@ impl DspNode for TsLFO { let mut lfo = TriSawLFO::new(); lfo.set_sample_rate(160.0); - Some(Box::new(move |gd: &dyn GraphAtomData, init: bool, _x: f32, xn: f32| -> f32 { + 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(); diff --git a/src/dsp/node_vosc.rs b/src/dsp/node_vosc.rs index 1433c62..f492cb6 100644 --- a/src/dsp/node_vosc.rs +++ b/src/dsp/node_vosc.rs @@ -131,7 +131,7 @@ impl DspNode for VOsc { let dist = dist.i() as u8; let oversample = ovrsmpl.i() == 1; - let mut osc = &mut self.osc; + let osc = &mut self.osc; if oversample { for frame in 0..ctx.nframes() { diff --git a/tests/node_pverb.rs b/tests/node_pverb.rs index cfa43a5..94ad8d2 100644 --- a/tests/node_pverb.rs +++ b/tests/node_pverb.rs @@ -44,7 +44,6 @@ fn setup_pverb(matrix: &mut Matrix) { fn check_node_pverb_dcy_1() { init_test!(matrix, node_exec, 3); - let ad_1 = NodeId::Ad(0); let pverb_1 = NodeId::PVerb(0); setup_pverb(matrix);