pub struct StreamingHaitsma { /* private fields */ }Expand description
Streaming Haitsma–Kalker fingerprinter.
Trivially incremental: each output bit-frame depends only on the
current and previous frames’ band energies, so we just keep one
previous-frame energy vector. No spectrogram window, no peak picker,
no per-second adaptive threshold. Per-push CPU cost is proportional
to the number of new samples, independent of total stream length,
and latency is bounded by the STFT window length (n_fft / sr ≈ 410 ms) — much lower than the landmark extractors.
Output is bit-exactly equivalent to Haitsma::extract.
Implementations§
Source§impl StreamingHaitsma
impl StreamingHaitsma
Sourcepub fn new(cfg: HaitsmaConfig) -> Self
pub fn new(cfg: HaitsmaConfig) -> Self
Sourcepub fn try_new(cfg: HaitsmaConfig) -> Result<Self>
pub fn try_new(cfg: HaitsmaConfig) -> Result<Self>
Fallible constructor — returns AfpError::Config on invalid
fmin/fmax/Nyquist instead of panicking.
Sourcepub fn config(&self) -> &HaitsmaConfig
pub fn config(&self) -> &HaitsmaConfig
Borrow the configuration this stream was built with.
Trait Implementations§
Source§impl Default for StreamingHaitsma
impl Default for StreamingHaitsma
Source§impl StreamingFingerprinter for StreamingHaitsma
impl StreamingFingerprinter for StreamingHaitsma
Source§fn required_sample_rate(&self) -> u32
fn required_sample_rate(&self) -> u32
Sample rate, in hertz, the stream expects its input at. Read more
Source§fn push(&mut self, samples: &[f32]) -> Result<Vec<(TimestampMs, Self::Frame)>>
fn push(&mut self, samples: &[f32]) -> Result<Vec<(TimestampMs, Self::Frame)>>
Feed PCM samples and return any fingerprints that became available
during this push. Read more
Source§fn push_with<F>(&mut self, samples: &[f32], callback: F) -> Result<usize>
fn push_with<F>(&mut self, samples: &[f32], callback: F) -> Result<usize>
Feed PCM samples and invoke
callback for each fingerprint frame
that became available during this push. Read moreSource§fn flush(&mut self) -> Result<Vec<(TimestampMs, Self::Frame)>>
fn flush(&mut self) -> Result<Vec<(TimestampMs, Self::Frame)>>
Drain any pending fingerprint material at end-of-stream. Read more
Source§fn flush_with<F>(&mut self, callback: F) -> Result<usize>
fn flush_with<F>(&mut self, callback: F) -> Result<usize>
Drain any pending fingerprint material at end-of-stream, invoking
callback for each frame. Read moreSource§fn latency_ms(&self) -> u32
fn latency_ms(&self) -> u32
Conservative upper bound on emission latency: from the time a
sample enters
push to the time the fingerprint covering it
is returned.Source§fn push_strict(
&mut self,
samples: &[f32],
) -> Result<Vec<(TimestampMs, Self::Frame)>>
fn push_strict( &mut self, samples: &[f32], ) -> Result<Vec<(TimestampMs, Self::Frame)>>
impl ZeroAllocStreaming for StreamingHaitsma
Auto Trait Implementations§
impl !RefUnwindSafe for StreamingHaitsma
impl !UnwindSafe for StreamingHaitsma
impl Freeze for StreamingHaitsma
impl Send for StreamingHaitsma
impl Sync for StreamingHaitsma
impl Unpin for StreamingHaitsma
impl UnsafeUnpin for StreamingHaitsma
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> 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>
Converts
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>
Converts
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)
Converts
&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)
Converts
&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
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