pub struct Resampler { /* private fields */ }Expand description
A band-limited converter from one sample rate to another.
Implementations§
Source§impl Resampler
impl Resampler
Sourcepub fn new(source_rate: u32, target_rate: u32) -> Result<Self, ResampleError>
pub fn new(source_rate: u32, target_rate: u32) -> Result<Self, ResampleError>
A converter from source_rate to target_rate.
Builds the whole coefficient table, so call it off the real-time thread.
§Errors
Either rate is zero or above MAX_RESAMPLE_RATE, or the ratio exceeds
MAX_DOWNSAMPLE_FACTOR.
Sourcepub const fn source_rate(&self) -> u32
pub const fn source_rate(&self) -> u32
Source samples per second.
Sourcepub const fn target_rate(&self) -> u32
pub const fn target_rate(&self) -> u32
Output samples per second.
Sourcepub const fn is_identity(&self) -> bool
pub const fn is_identity(&self) -> bool
Whether the two rates are equal: output sample n is source sample n.
Sourcepub fn target_at_or_after(&self, source: i64) -> i64
pub fn target_at_or_after(&self, source: i64) -> i64
The first output sample at or after source sample source.
Sourcepub fn target_known_before(&self, source_end: i64) -> i64
pub fn target_known_before(&self, source_end: i64) -> i64
The first output sample that weighs a source sample at or after source_end.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Resampler
impl Freeze for Resampler
impl Move for Resampler
impl RefUnwindSafe for Resampler
impl Send for Resamplerwhere
RawVecInner: Send,
impl Sync for Resamplerwhere
RawVecInner: Sync,
impl Unpin for Resampler
impl UnsafeUnpin for Resampler
impl UnwindSafe for Resamplerwhere
RawVecInner: 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