Skip to content

Commit 104359c

Browse files
committed
Clean up
1 parent f067c9b commit 104359c

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

inputmodule-control/src/inputmodule.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,11 @@ fn input_eq_cmd(serialdevs: &Vec<String>) {
681681
move |info, samples| {
682682
analyzer.analyze(samples);
683683

684+
let sampled_volume = samples.volume(0.3) * 400.0;
685+
let display_max_width = 34.0;
686+
684687
info.spectrum.fill_from(&analyzer.average());
685-
info.volume = samples.volume(0.3) * 400.0;
688+
info.volume = if sampled_volume < 34.0 { sampled_volume } else { display_max_width};
686689
info.beat = info.spectrum.slice(50.0, 100.0).max() * 0.01;
687690
info
688691
},
@@ -697,21 +700,11 @@ fn input_eq_cmd(serialdevs: &Vec<String>) {
697700
for serialdev in serialdevs {
698701
eq_cmd(
699702
serialdev,
700-
&[
701-
info.volume as u8,
702-
info.volume as u8,
703-
info.volume as u8,
704-
info.volume as u8,
705-
info.volume as u8,
706-
info.volume as u8,
707-
info.volume as u8,
708-
info.volume as u8,
709-
info.volume as u8,
710-
],
703+
&[info.volume as u8; 9]
711704
)
712705
}
713706
});
714-
thread::sleep(Duration::from_millis(30));
707+
thread::sleep(Duration::from_millis(15));
715708
}
716709
}
717710

0 commit comments

Comments
 (0)