Display an equlizer looking animation with random values.
(serialdevs: &Vec<String>)
| 660 | |
| 661 | /// Display an equlizer looking animation with random values. |
| 662 | fn 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 |
no test coverage detected