[−][src]Struct dasp_signal::interpolate::Converter
A signal type that converts the rate at which frames are yielded from some source signal to some target rate.
Other names for sample::interpolate::Converter
might include:
- Sample rate converter.
- {Up/Down}sampler.
- Sample interpolater.
- Sample decimator.
Implementations
impl<S, I> Converter<S, I> where
S: Signal,
I: Interpolator,
[src]
S: Signal,
I: Interpolator,
pub fn from_hz_to_hz(
source: S,
interpolator: I,
source_hz: f64,
target_hz: f64
) -> Self
[src]
source: S,
interpolator: I,
source_hz: f64,
target_hz: f64
) -> Self
Construct a new Converter
from the source frames and the source and target sample rates
(in Hz).
pub fn scale_playback_hz(source: S, interpolator: I, scale: f64) -> Self
[src]
Construct a new Converter
from the source frames and the amount by which the current
playback rate (not sample rate) should be multiplied to reach the new playback
rate.
For example, if our source_frames
is a sine wave oscillating at a frequency of 2hz and
we wanted to convert it to a frequency of 3hz, the given scale
should be 1.5
.
pub fn scale_sample_hz(source: S, interpolator: I, scale: f64) -> Self
[src]
Construct a new Converter
from the source frames and the amount by which the current
sample rate (not playback rate) should be multiplied to reach the new sample
rate.
If our source_frames
are being sampled at a rate of 44_100hz and we want to
convert to a sample rate of 96_000hz, the given scale
should be 96_000.0 / 44_100.0
.
This is the same as calling Converter::scale_playback_hz(source_frames, 1.0 / scale)
.
pub fn set_hz_to_hz(&mut self, source_hz: f64, target_hz: f64)
[src]
Update the source_to_target_ratio
internally given the source and target hz.
This method might be useful for changing the sample rate during playback.
pub fn set_playback_hz_scale(&mut self, scale: f64)
[src]
Update the source_to_target_ratio
internally given a new playback rate multiplier.
This method is useful for dynamically changing rates.
pub fn set_sample_hz_scale(&mut self, scale: f64)
[src]
Update the source_to_target_ratio
internally given a new sample rate multiplier.
This method is useful for dynamically changing rates.
pub fn source(&self) -> &S
[src]
Borrow the source_frames
Interpolator from the Converter
.
pub fn source_mut(&mut self) -> &mut S
[src]
Mutably borrow the source_frames
Iterator from the Converter
.
pub fn into_source(self) -> S
[src]
Drop self
and return the internal source_frames
Iterator.
Trait Implementations
impl<S: Clone, I: Clone> Clone for Converter<S, I> where
S: Signal,
I: Interpolator,
[src]
S: Signal,
I: Interpolator,
impl<S, I> Signal for Converter<S, I> where
S: Signal,
I: Interpolator<Frame = S::Frame>,
[src]
S: Signal,
I: Interpolator<Frame = S::Frame>,
type Frame = S::Frame
The Frame
type returned by the Signal
.
fn next(&mut self) -> Self::Frame
[src]
fn is_exhausted(&self) -> bool
[src]
fn map<M, F>(self, map: M) -> Map<Self, M, F> where
Self: Sized,
M: FnMut(Self::Frame) -> F,
F: Frame,
[src]
Self: Sized,
M: FnMut(Self::Frame) -> F,
F: Frame,
fn zip_map<O, M, F>(self, other: O, map: M) -> ZipMap<Self, O, M, F> where
Self: Sized,
M: FnMut(Self::Frame, O::Frame) -> F,
O: Signal,
F: Frame,
[src]
Self: Sized,
M: FnMut(Self::Frame, O::Frame) -> F,
O: Signal,
F: Frame,
fn add_amp<S>(self, other: S) -> AddAmp<Self, S> where
Self: Sized,
S: Signal,
S::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
[src]
Self: Sized,
S: Signal,
S::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
fn mul_amp<S>(self, other: S) -> MulAmp<Self, S> where
Self: Sized,
S: Signal,
S::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
[src]
Self: Sized,
S: Signal,
S::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
fn offset_amp(
self,
offset: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> OffsetAmp<Self> where
Self: Sized,
[src]
self,
offset: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> OffsetAmp<Self> where
Self: Sized,
fn scale_amp(
self,
amp: <<Self::Frame as Frame>::Sample as Sample>::Float
) -> ScaleAmp<Self> where
Self: Sized,
[src]
self,
amp: <<Self::Frame as Frame>::Sample as Sample>::Float
) -> ScaleAmp<Self> where
Self: Sized,
fn offset_amp_per_channel<F>(self, amp_frame: F) -> OffsetAmpPerChannel<Self, F> where
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
[src]
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
fn scale_amp_per_channel<F>(self, amp_frame: F) -> ScaleAmpPerChannel<Self, F> where
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
[src]
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
fn mul_hz<M, I>(self, interpolator: I, mul_per_frame: M) -> MulHz<Self, M, I> where
Self: Sized,
M: Signal<Frame = f64>,
I: Interpolator,
[src]
Self: Sized,
M: Signal<Frame = f64>,
I: Interpolator,
fn from_hz_to_hz<I>(
self,
interpolator: I,
source_hz: f64,
target_hz: f64
) -> Converter<Self, I> where
Self: Sized,
I: Interpolator,
[src]
self,
interpolator: I,
source_hz: f64,
target_hz: f64
) -> Converter<Self, I> where
Self: Sized,
I: Interpolator,
fn scale_hz<I>(self, interpolator: I, multi: f64) -> Converter<Self, I> where
Self: Sized,
I: Interpolator,
[src]
Self: Sized,
I: Interpolator,
fn delay(self, n_frames: usize) -> Delay<Self> where
Self: Sized,
[src]
Self: Sized,
fn into_interleaved_samples(self) -> IntoInterleavedSamples<Self> where
Self: Sized,
[src]
Self: Sized,
fn clip_amp(
self,
thresh: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> ClipAmp<Self> where
Self: Sized,
[src]
self,
thresh: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> ClipAmp<Self> where
Self: Sized,
fn inspect<F>(self, inspect: F) -> Inspect<Self, F> where
Self: Sized,
F: FnMut(&Self::Frame),
[src]
Self: Sized,
F: FnMut(&Self::Frame),
fn fork<S>(self, ring_buffer: Bounded<S>) -> Fork<Self, S> where
Self: Sized,
S: SliceMut<Element = Self::Frame>,
[src]
Self: Sized,
S: SliceMut<Element = Self::Frame>,
fn take(self, n: usize) -> Take<Self> where
Self: Sized,
[src]
Self: Sized,
fn until_exhausted(self) -> UntilExhausted<Self> where
Self: Sized,
[src]
Self: Sized,
fn buffered<S>(self, ring_buffer: Bounded<S>) -> Buffered<Self, S> where
Self: Sized,
S: Slice<Element = Self::Frame> + SliceMut,
[src]
Self: Sized,
S: Slice<Element = Self::Frame> + SliceMut,
fn by_ref(&mut self) -> &mut Self where
Self: Sized,
[src]
Self: Sized,
Auto Trait Implementations
impl<S, I> RefUnwindSafe for Converter<S, I> where
I: RefUnwindSafe,
S: RefUnwindSafe,
I: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, I> Send for Converter<S, I> where
I: Send,
S: Send,
I: Send,
S: Send,
impl<S, I> Sync for Converter<S, I> where
I: Sync,
S: Sync,
I: Sync,
S: Sync,
impl<S, I> Unpin for Converter<S, I> where
I: Unpin,
S: Unpin,
I: Unpin,
S: Unpin,
impl<S, I> UnwindSafe for Converter<S, I> where
I: UnwindSafe,
S: UnwindSafe,
I: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<S, T> Duplex<S> for T where
T: FromSample<S> + ToSample<S>,
[src]
T: FromSample<S> + ToSample<S>,
impl<T> From<T> for T
[src]
impl<S> FromSample<S> for S
[src]
fn from_sample_(s: S) -> S
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SignalBus for T where
T: Signal,
[src]
T: Signal,
impl<T> SignalEnvelope for T where
T: Signal,
[src]
T: Signal,
fn detect_envelope<D>(
self,
detector: Detector<Self::Frame, D>
) -> DetectEnvelope<Self, D> where
Self: Sized,
D: Detect<Self::Frame>,
[src]
self,
detector: Detector<Self::Frame, D>
) -> DetectEnvelope<Self, D> where
Self: Sized,
D: Detect<Self::Frame>,
impl<T> SignalRms for T where
T: Signal,
[src]
T: Signal,
fn rms<S>(self, ring_buffer: Fixed<S>) -> Rms<Self, S> where
Self: Sized,
S: Slice<Element = <Self::Frame as Frame>::Float> + SliceMut,
[src]
Self: Sized,
S: Slice<Element = <Self::Frame as Frame>::Float> + SliceMut,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> ToSample<U> for T where
U: FromSample<T>,
[src]
U: FromSample<T>,
fn to_sample_(self) -> U
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,