fixed warnings

This commit is contained in:
Weird Constructor 2021-06-07 05:03:29 +02:00
parent b88f79b87b
commit a846242218
6 changed files with 16 additions and 16 deletions

View file

@ -2,8 +2,6 @@ use hexodsp::*;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
use std::rc::Rc;
use std::cell::RefCell;
fn main() { fn main() {
let (mut node_conf, node_exec) = new_node_engine(); let (mut node_conf, node_exec) = new_node_engine();

View file

@ -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 round {
$(pub mod $variant { $(pub mod $variant {
$(#[inline] pub fn $para(x: f32, coarse: bool) -> f32 { $r_fun!(x, coarse) })* $(#[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 out_count(&self) -> usize { self.outputs.len() }
pub fn in_count(&self) -> usize { self.inputs.len() } pub fn in_count(&self) -> usize { self.inputs.len() }
pub fn at_count(&self) -> usize { self.atoms.len() } pub fn at_count(&self) -> usize { self.atoms.len() }

View file

@ -33,8 +33,8 @@ impl DspNode for FbWr {
#[inline] #[inline]
fn process<T: NodeAudioContext>( fn process<T: NodeAudioContext>(
&mut self, ctx: &mut T, ectx: &mut NodeExecContext, &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) _outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals)
{ {
use crate::dsp::{inp}; use crate::dsp::{inp};
@ -81,7 +81,7 @@ impl DspNode for FbRd {
#[inline] #[inline]
fn process<T: NodeAudioContext>( fn process<T: NodeAudioContext>(
&mut self, ctx: &mut T, ectx: &mut NodeExecContext, &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) outputs: &mut [ProcBuf], ctx_vals: LedPhaseVals)
{ {
use crate::dsp::{out, inp, denorm}; use crate::dsp::{out, inp, denorm};

View file

@ -4,7 +4,7 @@
use crate::nodes::{NodeAudioContext, NodeExecContext}; use crate::nodes::{NodeAudioContext, NodeExecContext};
use crate::dsp::{ use crate::dsp::{
NodeId, SAtom, ProcBuf, denorm, denorm_offs, NodeId, SAtom, ProcBuf, denorm_offs,
out, inp, DspNode, LedPhaseVals out, inp, DspNode, LedPhaseVals
}; };
use crate::dsp::helpers::fast_sin; use crate::dsp::helpers::fast_sin;

View file

@ -5,7 +5,7 @@
use super::{ use super::{
GraphMessage, QuickMessage, DropMsg, NodeProg, GraphMessage, QuickMessage, DropMsg, NodeProg,
UNUSED_MONITOR_IDX, MAX_ALLOCATED_NODES, MAX_SMOOTHERS, 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::dsp::{NodeId, Node, MAX_BLOCK_SIZE};
use crate::util::{Smoother, AtomicFloat}; use crate::util::{Smoother, AtomicFloat};
@ -117,10 +117,8 @@ impl FeedbackBuffer {
self.buffer = [0.0; MAX_FB_DELAY_SIZE]; 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.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, // The delay sample count maximum is defined by MAX_FB_DELAY_SRATE,
// after that the feedback delays become shorter than they should be // after that the feedback delays become shorter than they should be
// and things won't sound the same at sample rate // 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 // For more elaborate and longer delays an extra delay node should
// be used before FbWr or after FbRd. // 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; self.read_ptr = 0;
} }
@ -146,7 +147,7 @@ impl FeedbackBuffer {
#[inline] #[inline]
pub fn read(&mut self) -> f32 { pub fn read(&mut self) -> f32 {
if self.sample_count > 0 { if self.sample_count > 0 {
self.sample_count - 1; self.sample_count -= 1;
self.read_ptr = (self.read_ptr + 1) % MAX_FB_DELAY_SIZE; self.read_ptr = (self.read_ptr + 1) % MAX_FB_DELAY_SIZE;
let s = self.buffer[self.read_ptr]; let s = self.buffer[self.read_ptr];
s s

View file

@ -67,10 +67,9 @@ fn check_node_sampl_long_freq() {
matrix.sync().unwrap(); matrix.sync().unwrap();
let sample_p = smpl.inp_param("sample").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")); 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); let fft = run_and_get_fft4096(&mut node_exec, 800, 100.0);
assert_eq!(fft[0], (441, 1014)); assert_eq!(fft[0], (441, 1014));
@ -94,7 +93,6 @@ fn check_node_sampl_detune() {
matrix.sync().unwrap(); matrix.sync().unwrap();
let sample_p = smpl.inp_param("sample").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(); let det_p = smpl.inp_param("det").unwrap();
matrix.set_param(sample_p, SAtom::audio_unloaded("tests/sample_sin.wav")); matrix.set_param(sample_p, SAtom::audio_unloaded("tests/sample_sin.wav"));