pub struct Interpolator<P>(pub P);Expand description
Adapt a scalar optional-input stage to chunk output mode.
The inner processor is called with Some(x) once and then None N-1 times
to synthesize one output chunk from one input sample.
This is convenient for polyphase interpolators and other stages whose natural
scalar interface is Option<X> -> Y. Unlike crate::ChunkOut, this
preserves stream phase and still runs the recursive inner stage once per
output sample.
See also Decimator for the inverse direction.
§Examples
use dsp_process::{FnSplitProcess, Interpolator, SplitProcess};
let proc = Interpolator(FnSplitProcess(|_: &mut (), x: Option<i32>| {
x.unwrap_or_default()
}));
let mut state = ();
assert_eq!(proc.process(&mut state, 7), [7, 0, 0]);Tuple Fields§
§0: PTrait Implementations§
Source§impl<P: Clone> Clone for Interpolator<P>
impl<P: Clone> Clone for Interpolator<P>
Source§fn clone(&self) -> Interpolator<P>
fn clone(&self) -> Interpolator<P>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<P: Debug> Debug for Interpolator<P>
impl<P: Debug> Debug for Interpolator<P>
Source§impl<P: Default> Default for Interpolator<P>
impl<P: Default> Default for Interpolator<P>
Source§fn default() -> Interpolator<P>
fn default() -> Interpolator<P>
Returns the “default value” for a type. Read more
Source§impl<X: Copy, C, S> SplitInplace<X, S> for Interpolator<C>where
Self: SplitProcess<X, X, S>,
impl<X: Copy, C, S> SplitInplace<X, S> for Interpolator<C>where
Self: SplitProcess<X, X, S>,
Source§impl<X: Copy, Y, C: SplitProcess<Option<X>, Y, S>, S, const N: usize> SplitProcess<X, [Y; N], S> for Interpolator<C>
impl<X: Copy, Y, C: SplitProcess<Option<X>, Y, S>, S, const N: usize> SplitProcess<X, [Y; N], S> for Interpolator<C>
Auto Trait Implementations§
impl<P> Freeze for Interpolator<P>where
P: Freeze,
impl<P> RefUnwindSafe for Interpolator<P>where
P: RefUnwindSafe,
impl<P> Send for Interpolator<P>where
P: Send,
impl<P> Sync for Interpolator<P>where
P: Sync,
impl<P> Unpin for Interpolator<P>where
P: Unpin,
impl<P> UnsafeUnpin for Interpolator<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for Interpolator<P>where
P: UnwindSafe,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, X, S, T, const L: usize> SplitViewInplace<ViewMut<'a, X, FrameMajor, L>, S> for T
impl<'a, X, S, T, const L: usize> SplitViewInplace<ViewMut<'a, X, FrameMajor, L>, S> for T
Source§fn inplace_view(&self, state: &mut S, xy: ViewMut<'a, X, FrameMajor, L>)
fn inplace_view(&self, state: &mut S, xy: ViewMut<'a, X, FrameMajor, L>)
Process one typed view in place.
Source§impl<'a, 'b, X, Y, S, T, const L: usize> SplitViewProcess<View<'a, X, FrameMajor, L>, ViewMut<'b, Y, FrameMajor, L>, S> for T
impl<'a, 'b, X, Y, S, T, const L: usize> SplitViewProcess<View<'a, X, FrameMajor, L>, ViewMut<'b, Y, FrameMajor, L>, S> for T
Source§fn process_view(
&self,
state: &mut S,
x: View<'a, X, FrameMajor, L>,
y: ViewMut<'b, Y, FrameMajor, L>,
)
fn process_view( &self, state: &mut S, x: View<'a, X, FrameMajor, L>, y: ViewMut<'b, Y, FrameMajor, L>, )
Process one typed input view into one typed output view.