Skip to content

Commit

Permalink
fix peak meter
Browse files Browse the repository at this point in the history
  • Loading branch information
aizcutei committed Jul 12, 2024
1 parent 132bffd commit fd9d7d5
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 20 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ anyhow = "1.0"
rustfft = "6.2.0"
realfft = "3.3.0"
ruhear = "0.1.0"
log = "0.4"
rayon = "1.10"
# log = "0.4"
# rayon = "1.10"
# crossbeam-channel = "0.5.12"
puffin = { version = "0.19", optional = true }
puffin_http = { version = "0.16", optional = true }
Expand Down
12 changes: 5 additions & 7 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ use crate::frame::*;
use crate::setting::*;
use crate::utils::*;

// use crossbeam_channel::unbounded;
// use crossbeam_channel::{Receiver, Sender};
use eframe::egui::{self, ViewportCommand};
use eframe::wgpu::core::storage;
use eframe::wgpu::rwh::HasWindowHandle;
use egui::*;
use rayon::prelude::*;
use std::sync::atomic::AtomicU32;
use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::{Arc, Mutex};
use std::sync::{
atomic::AtomicU32,
mpsc::{channel, Receiver, Sender},
Arc, Mutex,
};
use std::{thread, vec};

/// We derive Deserialize/Serialize so we can persist app state on shutdown.
Expand Down
8 changes: 2 additions & 6 deletions src/audio/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub fn get_callback(
buf.osc.even_trun = !buf.osc.even_trun;
}
}
if buf.osc.raw.len() >= 2400 && buf.osc.even_trun {
if buf.osc.raw.len() >= 2200 && buf.osc.even_trun {
send_data.oscilloscope = OscilloscopeSendData {
len: buf.osc.raw.len(),
data: buf.osc.raw.clone(),
Expand Down Expand Up @@ -247,11 +247,7 @@ pub fn get_callback(
}
}
// in case of buffer overflow
if buf.osc.raw.len() >= 4096 {
send_data.oscilloscope = OscilloscopeSendData {
len: buf.osc.raw.len(),
data: buf.osc.raw.clone(),
};
if buf.osc.raw.len() >= 8192 {
buf.osc.clear();
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/frame/vectorscope_meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::setting::*;
use crate::utils::*;
use crate::NanometersApp;
use egui::*;
use rayon::iter::IntoParallelRefIterator;
// use rayon::iter::IntoParallelRefIterator;

const SQRT2_2: f32 = 0.7071067811865476;
const SQRT2_4: f32 = 0.3535533905932738;
Expand Down
2 changes: 1 addition & 1 deletion src/frame/waveform_meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::setting::*;
use crate::utils::*;
use crate::NanometersApp;
use egui::*;
use rayon::prelude::*;
// use rayon::prelude::*;
use rustfft::num_traits::WrappingSub;

impl NanometersApp {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/data_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl Default for SendData {
fn default() -> Self {
Self {
waveform: WaveformSendData::new(),
iir: vec![0.0; 2],
iir: Vec::new(),
db: DBData::new(),
vectorscope: VectorscopeSendData::new(),
spectrum: RawData::new(),
Expand Down

0 comments on commit fd9d7d5

Please sign in to comment.