pub struct CachedRecording { /* private fields */ }Implementations§
Source§impl CachedRecording
impl CachedRecording
Sourcepub fn wrap(
inner: Box<dyn RecordingSource>,
budget_bytes: usize,
) -> Box<dyn RecordingSource>
pub fn wrap( inner: Box<dyn RecordingSource>, budget_bytes: usize, ) -> Box<dyn RecordingSource>
Wraps inner when it is stored in chunks, keeping up to budget_bytes of decoded chunks
(at least one); other sources are returned unchanged.
Trait Implementations§
Source§impl RecordingSource for CachedRecording
impl RecordingSource for CachedRecording
fn info(&self) -> &RecordingInfo
Source§fn chunk_samples(&self) -> Option<u64>
fn chunk_samples(&self) -> Option<u64>
Samples per storage chunk along time, for formats stored in independently decoded chunks
(Zarr, NWB, mtscomp). Reads covering whole multiples of it, aligned to it, decode each
chunk once;
None when every range costs the same (memory-mapped, in-memory, procedural).Source§fn read(
&self,
channels: &[usize],
samples: Range<u64>,
out: &mut [f32],
) -> DspResult<()>
fn read( &self, channels: &[usize], samples: Range<u64>, out: &mut [f32], ) -> DspResult<()>
Reads
samples of every channel in channels into out, channel-major and scaled to each
channel’s unit (ChannelInfo):
out[i * n..(i + 1) * n] holds channels[i], where n = samples.end - samples.start.Source§fn read_native(
&self,
samples: Range<u64>,
out: &mut [f32],
) -> DspResult<MemoryOrder>
fn read_native( &self, samples: Range<u64>, out: &mut [f32], ) -> DspResult<MemoryOrder>
Reads
samples of every channel, scaled, in the order the source stores them, and returns
that order: MemoryOrder::ChannelMajor fills out as Self::read of all channels;
MemoryOrder::TimeMajor fills out[t * channels + c]. Whole-recording passes (min/max
summaries) use it to skip the transposition read does for time-major sources. Read moreSource§fn read_stored(
&self,
channels: &[usize],
samples: Range<u64>,
out: &mut [u8],
) -> DspResult<()>
fn read_stored( &self, channels: &[usize], samples: Range<u64>, out: &mut [u8], ) -> DspResult<()>
Reads the stored values (
info().format, little-endian, before each channel’s gain and
offset) of samples of every channel in channels into out, channel-major:
out holds channels.len() · n · format.bytes() bytes. Lets pipelines move compact integer
samples and scale them on the device. Read morefn read_channel( &self, channel: usize, samples: Range<u64>, out: &mut [f32], ) -> Result<(), DspError>
Source§fn read_chunk(
&self,
channels: &[usize],
samples: Range<u64>,
) -> Result<SignalChunk, DspError>
fn read_chunk( &self, channels: &[usize], samples: Range<u64>, ) -> Result<SignalChunk, DspError>
Reads into a newly allocated channel-major
SignalChunk.Auto Trait Implementations§
impl !Freeze for CachedRecording
impl !RefUnwindSafe for CachedRecording
impl !UnwindSafe for CachedRecording
impl Forget for CachedRecording
impl Move for CachedRecording
impl Send for CachedRecording
impl Sync for CachedRecording
impl Unpin for CachedRecording
impl UnsafeUnpin for CachedRecording
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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