pub struct WindowBuffer { /* private fields */ }Expand description
Implementations§
Source§impl WindowBuffer
impl WindowBuffer
Sourcepub fn try_new(win: usize, hop: usize) -> Result<Self, WindowError>
pub fn try_new(win: usize, hop: usize) -> Result<Self, WindowError>
{ true }
pub fn try_new(win: usize, hop: usize) -> Result<Self, WindowError>
{ ret.is_ok() == (win > 0 && hop > 0 && hop <= win) }
Fallible constructor: validates the window geometry and returns
WindowError instead of panicking.
win— window size in samples (must be > 0).hop— hop size in samples (must be > 0 and <=win).
Sourcepub fn extend(&mut self, samples: &[f32])
pub fn extend(&mut self, samples: &[f32])
{ true }
pub fn extend(&mut self, samples: &[f32])
{ true }
Append samples to the buffer.
Sourcepub fn try_pop(&mut self) -> Option<(usize, Vec<f32>)>
pub fn try_pop(&mut self) -> Option<(usize, Vec<f32>)>
{ true }
pub fn try_pop(&mut self) -> Option<(usize, Vec<f32>)>
{ ret.as_ref().map(|(_, w)| w.len() == self.win) }
Return the next full window if one is available.
Returns Some((global_start, buf[..win].to_vec())) where global_start is the
sample offset of this window relative to the start of the stream.
The window is cloned so that the internal buffer can advance immediately.
Sourcepub fn flush(&mut self) -> Option<(usize, Vec<f32>)>
pub fn flush(&mut self) -> Option<(usize, Vec<f32>)>
{ true }
pub fn flush(&mut self) -> Option<(usize, Vec<f32>)>
{ true }
Zero-pad the remaining buffer to win and return the final window.
Returns None if the buffer is empty.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
{ true }
pub fn is_empty(&self) -> bool
{ ret == (self.buf.len() == 0) }
Whether the buffer is currently empty.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
{ true }
pub fn len(&self) -> usize
{ ret == self.buf.len() }
Current length of the buffered samples.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
{ true }
pub fn clear(&mut self)
{ self.buf.is_empty() }
Clear all buffered samples and reset the next-start offset.
Sourcepub fn set_next_start(&mut self, start: usize)
pub fn set_next_start(&mut self, start: usize)
{ true }
pub fn set_next_start(&mut self, start: usize)
{ self.next_start == start }
Set the next-start offset to a specific value.
Trait Implementations§
Source§impl Clone for WindowBuffer
impl Clone for WindowBuffer
Auto Trait Implementations§
impl Freeze for WindowBuffer
impl RefUnwindSafe for WindowBuffer
impl Send for WindowBuffer
impl Sync for WindowBuffer
impl Unpin for WindowBuffer
impl UnsafeUnpin for WindowBuffer
impl UnwindSafe for WindowBuffer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more