pub struct SpectrumTap { /* private fields */ }Expand description
Lock-free sample tap used by the analyzer view.
The audio worker writes samples here without taking locks. UI-side commands can snapshot the latest window and compute FFT data off the audio path.
Implementations§
Source§impl SpectrumTap
impl SpectrumTap
Sourcepub fn new(sample_rate_hz: u32) -> Self
pub fn new(sample_rate_hz: u32) -> Self
Creates a new lock-free tap with preallocated sample storage.
Sourcepub fn set_sample_rate_hz(&self, sample_rate_hz: u32)
pub fn set_sample_rate_hz(&self, sample_rate_hz: u32)
Updates sample rate metadata read by analyzer commands.
Sourcepub fn sample_rate_hz(&self) -> u32
pub fn sample_rate_hz(&self) -> u32
Returns the latest sample rate metadata.
Sourcepub fn push_sample(&self, sample: f32)
pub fn push_sample(&self, sample: f32)
Writes one processed sample into the circular tap buffer.
Sourcepub fn snapshot_window(&self) -> Vec<f32>
pub fn snapshot_window(&self) -> Vec<f32>
Returns a chronologically ordered snapshot of the current ring buffer.
Auto Trait Implementations§
impl !Freeze for SpectrumTap
impl !RefUnwindSafe for SpectrumTap
impl Send for SpectrumTap
impl Sync for SpectrumTap
impl Unpin for SpectrumTap
impl UnsafeUnpin for SpectrumTap
impl UnwindSafe for SpectrumTap
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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