custom_system_fetcher/
custom_system_fetcher.rs

1use shady_audio::{
2    fetcher::{SystemAudioFetcher, SystemAudioFetcherDescriptor},
3    util::DeviceType,
4    BarProcessor, BarProcessorConfig, SampleProcessor,
5};
6
7fn main() {
8    // get a list of all available devices
9    let available_output_devices = shady_audio::util::get_device_names(DeviceType::Output)
10        .expect("Output devices exists for the given host");
11
12    println!("{:#?}", available_output_devices);
13
14    // choose one
15    let device = shady_audio::util::get_device(
16        available_output_devices.first().unwrap(),
17        DeviceType::Output,
18    )
19    .unwrap()
20    .unwrap();
21
22    let descriptor = SystemAudioFetcherDescriptor {
23        device,
24        ..Default::default()
25    };
26
27    let mut sample_processor = SampleProcessor::new(SystemAudioFetcher::new(&descriptor).unwrap());
28    let mut bar_processor = BarProcessor::new(&sample_processor, BarProcessorConfig::default());
29
30    // start creating the bars
31    sample_processor.process_next_samples();
32    bar_processor.process_bars(&sample_processor);
33}