pub struct FftProcessorImpl<ST> { /* private fields */ }
Expand description
An FFT processor with overlap and windowing.
This processor will collect samples onto a circular buffer and perform FFTs whenever hop size is reached.
Implementations§
Source§impl<ST: FftNum + Sum + Float + FloatConst> FftProcessorImpl<ST>
impl<ST: FftNum + Sum + Float + FloatConst> FftProcessorImpl<ST>
Sourcepub fn new(options: FftProcessorOptions) -> Self
pub fn new(options: FftProcessorOptions) -> Self
Constructs a new FftProcessor
- size: Size of the FFT
- direction: Direction of the FFT
- overlap_ratio: 0.0 will do no overlap, 0.5 will do half a window of overlap and 0.75 will do 3/4 window overlap
- window_function: The window function to use
Sourcepub fn buffer_mut(&mut self) -> &mut Vec<Complex<ST>>
pub fn buffer_mut(&mut self) -> &mut Vec<Complex<ST>>
Get a mutable reference to the FFT bins buffer
pub fn input_mut(&mut self) -> &mut [ST]
Sourcepub fn scratch_mut(&mut self) -> &mut Vec<Complex<ST>>
pub fn scratch_mut(&mut self) -> &mut Vec<Complex<ST>>
Get a mutable reference to the scratch buffer
Sourcepub fn step_len(&self) -> usize
pub fn step_len(&self) -> usize
Get the hop size of this processor. This is the number of samples between each FFT.
Sourcepub fn process_fft_buffer(&mut self, samples: &mut [Complex<ST>])
pub fn process_fft_buffer(&mut self, samples: &mut [Complex<ST>])
Manually process an external FFT buffer in-place.
Sourcepub fn has_changed(&self) -> bool
pub fn has_changed(&self) -> bool
Returns true if an FFT has just been performed on the last call to s_process
Sourcepub fn input_buffer_sum(&self) -> ST
pub fn input_buffer_sum(&self) -> ST
Returns the sum of the power of the current input buffer window.
Sourcepub fn perform_fft(&mut self, start_idx: usize)
pub fn perform_fft(&mut self, start_idx: usize)
Manually perform an FFT; offset the input buffer by a certain index.
Trait Implementations§
Source§impl<ST: FftNum + Sum + Float + FloatConst> Default for FftProcessorImpl<ST>
impl<ST: FftNum + Sum + Float + FloatConst> Default for FftProcessorImpl<ST>
Source§impl<ST: FftNum + Float + Sum + FloatConst> MonoAudioProcessor for FftProcessorImpl<ST>
impl<ST: FftNum + Float + Sum + FloatConst> MonoAudioProcessor for FftProcessorImpl<ST>
type SampleType = ST
fn m_process( &mut self, _context: &mut AudioContext, sample: Self::SampleType, ) -> Self::SampleType
fn m_prepare(&mut self, _context: &mut AudioContext)
Auto Trait Implementations§
impl<ST> Freeze for FftProcessorImpl<ST>
impl<ST> !RefUnwindSafe for FftProcessorImpl<ST>
impl<ST> Send for FftProcessorImpl<ST>where
ST: Send,
impl<ST> Sync for FftProcessorImpl<ST>where
ST: Sync,
impl<ST> Unpin for FftProcessorImpl<ST>where
ST: Unpin,
impl<ST> !UnwindSafe for FftProcessorImpl<ST>
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