MCPcopy Index your code
hub / github.com/FrameworkComputer/inputmodule-rs / random_eq_cmd

Function random_eq_cmd

inputmodule-control/src/inputmodule.rs:662–678  ·  view source on GitHub ↗

Display an equlizer looking animation with random values.

(serialdevs: &Vec<String>)

Source from the content-addressed store, hash-verified

660
661/// Display an equlizer looking animation with random values.
662fn random_eq_cmd(serialdevs: &Vec<String>) {
663 loop {
664 // Lower values more likely, makes it look nicer
665 //weights = [i*i for i in range(33, 0, -1)]
666 let population: Vec<u8> = (1..34).collect();
667 let mut rng = thread_rng();
668 let vals = population
669 .choose_multiple_weighted(&mut rng, 9, |item| (34 - item) ^ 2)
670 .unwrap()
671 .copied()
672 .collect::<Vec<_>>();
673 for serialdev in serialdevs {
674 eq_cmd(serialdev, vals.as_slice());
675 }
676 thread::sleep(Duration::from_millis(200));
677 }
678}
679
680#[cfg(feature = "audio-visualizations")]
681/// The data-type for storing analyzer results

Callers 1

serial_commandsFunction · 0.85

Calls 2

eq_cmdFunction · 0.85
unwrapMethod · 0.80

Tested by

no test coverage detected