pub struct WindowLoader<'a> { /* private fields */ }Expand description
Streams HaloWindows of a RecordingSource, reading ahead on a background thread.
Implementations§
Source§impl<'a> WindowLoader<'a>
impl<'a> WindowLoader<'a>
Sourcepub fn new(source: &'a dyn RecordingSource) -> Self
pub fn new(source: &'a dyn RecordingSource) -> Self
Loader over all channels of source.
Sourcepub fn with_channels(
source: &'a dyn RecordingSource,
channels: Vec<usize>,
) -> Self
pub fn with_channels( source: &'a dyn RecordingSource, channels: Vec<usize>, ) -> Self
Loader over channels of source, in that order.
Sourcepub fn source(&self) -> &'a dyn RecordingSource
pub fn source(&self) -> &'a dyn RecordingSource
The recording read.
Sourcepub fn stream<F>(&self, windows: &[HaloWindow], f: F) -> DspResult<()>
pub fn stream<F>(&self, windows: &[HaloWindow], f: F) -> DspResult<()>
Calls f(&window, samples) for every window of windows, in order: samples is the
channel-major [channels, window.read_len()] block of scaled values
(RecordingSource::read). Any subset works (a full super::ChunkSchedule, every
n-th window, isolated windows); the next window is read while f runs.
Sourcepub fn stream_while<F>(&self, windows: &[HaloWindow], f: F) -> DspResult<()>
pub fn stream_while<F>(&self, windows: &[HaloWindow], f: F) -> DspResult<()>
Like Self::stream until f returns false (e.g. once enough data is gathered): no
window after that one is passed to f, and reading stops.
Sourcepub fn stream_stored<F>(&self, windows: &[HaloWindow], f: F) -> DspResult<()>
pub fn stream_stored<F>(&self, windows: &[HaloWindow], f: F) -> DspResult<()>
Like Self::stream with the stored values (RecordingSource::read_stored):
info().format little-endian bytes, channel-major, before gain and offset.
Sourcepub fn stream_stored_while<F>(
&self,
windows: &[HaloWindow],
f: F,
) -> DspResult<()>
pub fn stream_stored_while<F>( &self, windows: &[HaloWindow], f: F, ) -> DspResult<()>
Like Self::stream_stored until f returns false.
Sourcepub fn stream_owned_while<F>(
&self,
windows: &[HaloWindow],
f: F,
) -> DspResult<()>
pub fn stream_owned_while<F>( &self, windows: &[HaloWindow], f: F, ) -> DspResult<()>
Like Self::stream_while, handing f each window as an owned buffer: the reading
thread allocates and fills it, so a consumer that moves it on (e.g. into a device upload)
copies nothing on the calling thread. At most one window is read ahead.
Sourcepub fn stream_stored_owned_while<F>(
&self,
windows: &[HaloWindow],
f: F,
) -> DspResult<()>
pub fn stream_stored_owned_while<F>( &self, windows: &[HaloWindow], f: F, ) -> DspResult<()>
Self::stream_owned_while with the stored values (RecordingSource::read_stored).
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for WindowLoader<'a>
impl<'a> !UnwindSafe for WindowLoader<'a>
impl<'a> Forget for WindowLoader<'a>
impl<'a> Freeze for WindowLoader<'a>
impl<'a> Send for WindowLoader<'a>
impl<'a> Sync for WindowLoader<'a>
impl<'a> Unpin for WindowLoader<'a>
impl<'a> UnsafeUnpin for WindowLoader<'a>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
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