pub struct SampleProcessor { /* private fields */ }Expand description
Prepares the samples of the fetcher for the crate::BarProcessor.
Implementations§
Source§impl SampleProcessor
impl SampleProcessor
Sourcepub fn new(fetcher: Box<dyn Fetcher>) -> Self
pub fn new(fetcher: Box<dyn Fetcher>) -> Self
Creates a new instance with the given fetcher where the audio samples are fetched from.
Examples found in repository?
More examples
examples/custom_system_fetcher.rs (line 27)
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}Sourcepub fn process_next_samples(&mut self)
pub fn process_next_samples(&mut self)
Tell the processor to take some samples of the fetcher and prepare them for the crate::BarProcessors.
Examples found in repository?
More examples
examples/custom_system_fetcher.rs (line 31)
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}Auto Trait Implementations§
impl Freeze for SampleProcessor
impl !RefUnwindSafe for SampleProcessor
impl !Send for SampleProcessor
impl !Sync for SampleProcessor
impl Unpin for SampleProcessor
impl !UnwindSafe for SampleProcessor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.