main: cleanup

This commit is contained in:
Thomas Kolb 2021-02-21 19:45:03 +01:00
parent 001af5f0f3
commit ded8a7c21f

View file

@ -82,20 +82,13 @@ fn main()
continue; continue;
} }
// run the signal processing
{ {
let mut s = sigproc.borrow_mut(); let mut s = sigproc.borrow_mut();
s.import_i16_mono_from_iter(samples.iter()).unwrap(); s.import_i16_mono_from_iter(samples.iter()).unwrap();
s.update_fft().unwrap(); s.update_fft().unwrap();
} }
let energy_bass = sigproc.borrow().get_energy_in_band( 0.0, 400.0);
let energy_mid = sigproc.borrow().get_energy_in_band( 400.0, 4000.0);
let energy_treble = sigproc.borrow().get_energy_in_band(4000.0, config::SAMP_RATE/2.0);
// dump the output
println!("Bass: {:11.2} Mid: {:11.2} Treble: {:11.2}", energy_bass, energy_mid, energy_treble);
// call the periodic function in the user script // call the periodic function in the user script
match script.periodic() { match script.periodic() {
Ok(_) => (), Ok(_) => (),