From 2df27bec853cf3aac65db5768695de8daf174094 Mon Sep 17 00:00:00 2001 From: Keenan Tims Date: Mon, 13 Nov 2023 13:41:44 -0800 Subject: [PATCH] Clean up unused members / includes --- src/analyzer.rs | 16 +++------------- src/main.rs | 8 +++----- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/analyzer.rs b/src/analyzer.rs index f0c4410..77a06a1 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -1,11 +1,8 @@ -use num::complex::ComplexFloat; -use num::traits::real::Real; -use num::traits::AsPrimitive; -use num::{Float, FromPrimitive, Num, Signed, ToPrimitive}; +use num::{Float, FromPrimitive, Num, ToPrimitive}; use realfft::{RealFftPlanner, RealToComplex}; use ringbuf::{HeapRb, Rb}; use rustfft::num_complex::Complex; -use rustfft::{Fft, FftNum}; +use rustfft::FftNum; use std::fmt::{Debug, Display}; use std::iter::repeat; @@ -137,7 +134,7 @@ impl { fft_length: usize, sample_rate: U, channels: usize, - norm_factor: U, bin_freqs: Vec, - planner: RealFftPlanner, processor: Arc>, window: HanningWindow, @@ -240,13 +235,11 @@ impl FftAnalyzer { samples: repeat(0) @@ -335,9 +328,6 @@ impl FftAnalyzer f32 { - self.audio_buf.lock().unwrap().read_since_last_update as f32 / self.fft_length as f32 - } } impl< diff --git a/src/main.rs b/src/main.rs index eac2b43..934462d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; use egui::epaint::Hsva; use egui::Widget; -use egui_plot::{log_grid_spacer, GridInput, GridMark, Legend, Line, Plot}; +use egui_plot::{GridInput, GridMark, Legend, Line, Plot}; use std::mem::swap; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -10,12 +10,9 @@ use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::{Arc, Mutex}; use std::thread::{self, JoinHandle}; -use log::debug; - mod analyzer; use analyzer::{ - lin_to_db, Analyzer, FftAnalysis, FftAnalyzer, FftMeasurement, FftMeasurementValue, - PeakFreqAmplitude, + lin_to_db, Analyzer, FftAnalysis, FftAnalyzer, FftMeasurementValue, PeakFreqAmplitude, }; use crate::analyzer::RmsAmplitudeMeasurement; @@ -200,6 +197,7 @@ impl MyApp { let plot_data = last_fft_result.plot_data.lock().unwrap(); let plot_min = plot_data.plot_min.min(-120.0); let plot_max = plot_data.plot_max.max(0.0); + // TODO: Need coordinates_formatter for log and linear plots let mut plot = Plot::new("FFT") .allow_drag(false) .include_y(plot_min)