pub struct Pyramid { /* private fields */ }Expand description
A min/max pyramid of one recording, in memory or in a file.
Implementations§
Source§impl Pyramid
impl Pyramid
Sourcepub fn in_memory(source: &dyn RecordingSource, base: u64) -> DspResult<Self>
pub fn in_memory(source: &dyn RecordingSource, base: u64) -> DspResult<Self>
An empty pyramid of source in memory, with level-0 buckets of base samples
(MEMORY_BASE unless there is a reason otherwise).
Sourcepub fn open_file(
path: &Path,
identity: &PyramidIdentity,
base: u64,
) -> DspResult<Option<Self>>
pub fn open_file( path: &Path, identity: &PyramidIdentity, base: u64, ) -> DspResult<Option<Self>>
The complete pyramid file at path built from identity with level-0 bucket base;
None when it is missing, incomplete or built from something else.
Sourcepub fn create_file(
path: &Path,
identity: &PyramidIdentity,
base: u64,
) -> DspResult<Self>
pub fn create_file( path: &Path, identity: &PyramidIdentity, base: u64, ) -> DspResult<Self>
A new, empty pyramid file at path (replacing any other) to fill.
Sourcepub fn open_or_create(
source: &dyn RecordingSource,
recording: Option<(&Path, &str)>,
) -> DspResult<(Self, bool)>
pub fn open_or_create( source: &dyn RecordingSource, recording: Option<(&Path, &str)>, ) -> DspResult<(Self, bool)>
The pyramid of source source_id of the recording at path, base FILE_BASE: the
complete file next to it, else a new file there, else (no path, or a folder that cannot
be written) one in memory at MEMORY_BASE. Returns it and whether it is complete.
pub fn base(&self) -> u64
pub fn samples(&self) -> u64
Sourcepub fn page_samples(&self) -> u64
pub fn page_samples(&self) -> u64
Samples per page (the unit of filling).
Sourcepub fn covers(&self, start: u64, end: u64) -> bool
pub fn covers(&self, start: u64, end: u64) -> bool
Whether every page holding samples start..end is built.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether every bucket of every level is built.
Sourcepub fn fill(
&self,
source: &dyn RecordingSource,
start: u64,
end: u64,
block_values: usize,
stop: impl Fn() -> bool + Sync,
) -> DspResult<bool>
pub fn fill( &self, source: &dyn RecordingSource, start: u64, end: u64, block_values: usize, stop: impl Fn() -> bool + Sync, ) -> DspResult<bool>
Builds the pages holding samples start..end that are not built yet, reading every
channel in the source’s native order, consecutive pages together (up to block_values
values per read, at least one page), reading ahead while pages are built. Returns
Ok(false) when stop returned true before a read; pages built until then are kept. A
file is marked complete once every page is built.
Sourcepub fn envelope(
&self,
channels: &[usize],
start: u64,
end: u64,
width: usize,
out: &mut [[f32; 2]],
) -> DspResult<bool>
pub fn envelope( &self, channels: &[usize], start: u64, end: u64, width: usize, out: &mut [[f32; 2]], ) -> DspResult<bool>
[min, max] per pixel column of samples start..end for each of channels, written
row by row into out (channels.len() × width). Columns not built yet, or holding only
NaN samples, are NaN. Returns false (leaving out untouched) when a column spans fewer
than base samples: read those windows from the recording.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Pyramid
impl Forget for Pyramid
impl Move for Pyramid
impl RefUnwindSafe for Pyramid
impl Unpin for Pyramid
impl UnsafeUnpin for Pyramid
impl UnwindSafe for Pyramid
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