diff --git a/examples/jack_demo_node_api.rs b/examples/jack_demo_node_api.rs index d487f3b..05c9eae 100644 --- a/examples/jack_demo_node_api.rs +++ b/examples/jack_demo_node_api.rs @@ -2,8 +2,6 @@ use hexodsp::*; use std::sync::Arc; use std::sync::Mutex; -use std::rc::Rc; -use std::cell::RefCell; fn main() { let (mut node_conf, node_exec) = new_node_engine(); diff --git a/src/dsp/mod.rs b/src/dsp/mod.rs index 19f9b60..6e42d56 100644 --- a/src/dsp/mod.rs +++ b/src/dsp/mod.rs @@ -865,7 +865,7 @@ macro_rules! make_node_info_enum { } } - #[allow(non_snake_case)] + #[allow(non_snake_case, unused_variables)] pub mod round { $(pub mod $variant { $(#[inline] pub fn $para(x: f32, coarse: bool) -> f32 { $r_fun!(x, coarse) })* @@ -1025,6 +1025,9 @@ macro_rules! make_node_info_enum { } } + pub fn desc(&self) -> &'static str { self.node_desc } + pub fn help(&self) -> &'static str { self.node_help } + pub fn out_count(&self) -> usize { self.outputs.len() } pub fn in_count(&self) -> usize { self.inputs.len() } pub fn at_count(&self) -> usize { self.atoms.len() } diff --git a/src/dsp/node_fbwr_fbrd.rs b/src/dsp/node_fbwr_fbrd.rs index b594431..d104c69 100644 --- a/src/dsp/node_fbwr_fbrd.rs +++ b/src/dsp/node_fbwr_fbrd.rs @@ -33,8 +33,8 @@ impl DspNode for FbWr { #[inline] fn process( &mut self, ctx: &mut T, ectx: &mut NodeExecContext, - atoms: &[SAtom], _params: &[ProcBuf], inputs: &[ProcBuf], - outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals) + _atoms: &[SAtom], _params: &[ProcBuf], inputs: &[ProcBuf], + _outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals) { use crate::dsp::{inp}; @@ -81,7 +81,7 @@ impl DspNode for FbRd { #[inline] fn process( &mut self, ctx: &mut T, ectx: &mut NodeExecContext, - atoms: &[SAtom], _params: &[ProcBuf], inputs: &[ProcBuf], + _atoms: &[SAtom], _params: &[ProcBuf], inputs: &[ProcBuf], outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals) { use crate::dsp::{out, inp, denorm}; diff --git a/src/dsp/node_sin.rs b/src/dsp/node_sin.rs index 3441412..6971e7c 100644 --- a/src/dsp/node_sin.rs +++ b/src/dsp/node_sin.rs @@ -4,7 +4,7 @@ use crate::nodes::{NodeAudioContext, NodeExecContext}; use crate::dsp::{ - NodeId, SAtom, ProcBuf, denorm, denorm_offs, + NodeId, SAtom, ProcBuf, denorm_offs, out, inp, DspNode, LedPhaseVals }; use crate::dsp::helpers::fast_sin; diff --git a/src/nodes/node_exec.rs b/src/nodes/node_exec.rs index 3acbe76..ae69c8f 100644 --- a/src/nodes/node_exec.rs +++ b/src/nodes/node_exec.rs @@ -5,7 +5,7 @@ use super::{ GraphMessage, QuickMessage, DropMsg, NodeProg, UNUSED_MONITOR_IDX, MAX_ALLOCATED_NODES, MAX_SMOOTHERS, - MAX_FB_DELAY_SIZE, FB_DELAY_TIME_US, + MAX_FB_DELAY_SIZE }; use crate::dsp::{NodeId, Node, MAX_BLOCK_SIZE}; use crate::util::{Smoother, AtomicFloat}; @@ -117,10 +117,8 @@ impl FeedbackBuffer { self.buffer = [0.0; MAX_FB_DELAY_SIZE]; } - pub fn set_sample_rate(&mut self, sr: f32) { + pub fn set_sample_rate(&mut self, _sr: f32) { self.buffer = [0.0; MAX_FB_DELAY_SIZE]; - self.write_ptr = 0; - self.sample_count = 0; // The delay sample count maximum is defined by MAX_FB_DELAY_SRATE, // after that the feedback delays become shorter than they should be // and things won't sound the same at sample rate @@ -132,7 +130,10 @@ impl FeedbackBuffer { // // For more elaborate and longer delays an extra delay node should // be used before FbWr or after FbRd. - let delay_sample_count = (sr as usize * FB_DELAY_TIME_US) / 1000000; + + // let delay_sample_count = (sr as usize * FB_DELAY_TIME_US) / 1000000; + self.write_ptr = 0; + self.sample_count = 0; self.read_ptr = 0; } @@ -146,7 +147,7 @@ impl FeedbackBuffer { #[inline] pub fn read(&mut self) -> f32 { if self.sample_count > 0 { - self.sample_count - 1; + self.sample_count -= 1; self.read_ptr = (self.read_ptr + 1) % MAX_FB_DELAY_SIZE; let s = self.buffer[self.read_ptr]; s diff --git a/tests/node_sampl.rs b/tests/node_sampl.rs index cadd212..6492a87 100644 --- a/tests/node_sampl.rs +++ b/tests/node_sampl.rs @@ -67,10 +67,9 @@ fn check_node_sampl_long_freq() { matrix.sync().unwrap(); let sample_p = smpl.inp_param("sample").unwrap(); - let freq_p = smpl.inp_param("freq").unwrap(); matrix.set_param(sample_p, SAtom::audio_unloaded("tests/sample_sin_long.wav")); - let (out_l, _) = run_no_input(&mut node_exec, 0.05); + run_no_input(&mut node_exec, 0.05); let fft = run_and_get_fft4096(&mut node_exec, 800, 100.0); assert_eq!(fft[0], (441, 1014)); @@ -94,7 +93,6 @@ fn check_node_sampl_detune() { matrix.sync().unwrap(); let sample_p = smpl.inp_param("sample").unwrap(); - let freq_p = smpl.inp_param("freq").unwrap(); let det_p = smpl.inp_param("det").unwrap(); matrix.set_param(sample_p, SAtom::audio_unloaded("tests/sample_sin.wav"));