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 here, so call it off the real-time thread.
§Errors
Either rate is zero or above MAX_RESAMPLE_RATE, or the source rate
is more than MAX_DOWNSAMPLE_FACTOR times the target rate.
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: every output before it is known once the source is known
up to source_end.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Resampler
impl RefUnwindSafe for Resampler
impl Send for Resampler
impl Sync for Resampler
impl Unpin for Resampler
impl UnsafeUnpin for Resampler
impl UnwindSafe for Resampler
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