Struct FftProcessorImpl

Source
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>

Source

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
Source

pub fn size(&self) -> usize

The number of frequency bins this FFT processor operates with

Source

pub fn buffer(&self) -> &Vec<Complex<ST>>

Get a reference to the FFT bins buffer

Source

pub fn fft(&self) -> &Arc<dyn Fft<ST>>

Get a reference to the rustfft instance

Source

pub fn buffer_mut(&mut self) -> &mut Vec<Complex<ST>>

Get a mutable reference to the FFT bins buffer

Source

pub fn input_mut(&mut self) -> &mut [ST]

Source

pub fn scratch_mut(&mut self) -> &mut Vec<Complex<ST>>

Get a mutable reference to the scratch buffer

Source

pub fn step_len(&self) -> usize

Get the hop size of this processor. This is the number of samples between each FFT.

Source

pub fn process_fft_buffer(&mut self, samples: &mut [Complex<ST>])

Manually process an external FFT buffer in-place.

Source

pub fn has_changed(&self) -> bool

Returns true if an FFT has just been performed on the last call to s_process

Source

pub fn input_buffer_sum(&self) -> ST

Returns the sum of the power of the current input buffer window.

Source

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>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<ST: FftNum + Float + Sum + FloatConst> MonoAudioProcessor for FftProcessorImpl<ST>

Source§

type SampleType = ST

Source§

fn m_process( &mut self, _context: &mut AudioContext, sample: Self::SampleType, ) -> Self::SampleType

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.