Struct Configuration

Source
pub struct Configuration { /* private fields */ }
Expand description

Structure containing configuration for a Fingerprinter.

Implementations§

Source§

impl Configuration

Source

pub fn with_id(self, id: u8) -> Self

Adds an ID to the configuration.

This ID is used for fingerprint compression.

Source

pub fn with_classifiers(self, classifiers: Vec<Classifier>) -> Self

Adds classifiers to the configuration.

Source

pub fn with_coefficients(self, coefficients: Vec<f64>) -> Self

Updates coefficients for internal chroma filter.

Source

pub fn with_interpolation(self, interpolate: bool) -> Self

Enables or disables interpolation.

Source

pub fn with_frame_size(self, frame_size: usize) -> Self

Sets number of samples in a single frame for FFT.

Source

pub fn with_frame_overlap(self, frame_overlap: usize) -> Self

Sets number of samples overlapping between two consecutive frames for FFT.

Source

pub fn with_removed_silence(self, silence_threshold: u32) -> Self

Enables removal of silence with a specified threshold.

Source

pub fn sample_rate(&self) -> u32

Target sample rate for fingerprint calculation.

Source

pub fn preset_test1() -> Self

Examples found in repository?
examples/test.rs (line 14)
13fn main() {
14    let mut printer = Fingerprinter::new(&Configuration::preset_test1());
15    printer.start(11025, 2).unwrap();
16    printer.consume(&read_s16le("data/test_stereo_44100.raw"));
17    printer.finish();
18
19    assert_eq!(
20        printer.fingerprint(),
21        &[
22            3086176501, 3077772469, 3077638581, 3052408789, 3048228821, 3046201301, 3042148311,
23            3037102035, 2969993073, 3041294129, 3045483313, 3046514967, 3050712326, 3040164098,
24            3040163847, 3073719559, 3073733965, 3212169693, 3212169693, 3220542455, 3220542399,
25            3212152503, 3077933717, 3086327509, 3080034295, 4120237047, 4119197543, 4119295527,
26            4123424293, 1975934501, 2110152245, 2111233559, 2144501255, 1005778439, 1001636359,
27            1005683463, 1005682948, 1005686104, 991003132, 991031785, 995223531, 995190635,
28            1003562858
29        ]
30    );
31}
Source

pub fn preset_test2() -> Self

Source

pub fn preset_test3() -> Self

Source

pub fn preset_test4() -> Self

Source

pub fn preset_test5() -> Self

Source

pub fn id(&self) -> u8

The algorithm ID of this configuration (only used for fingerprint compression).

Source

pub fn item_duration_in_seconds(&self) -> f32

A duration of a single item from the fingerprint.

Source

pub fn delay(&self) -> usize

Get the delay.

Trait Implementations§

Source§

impl Clone for Configuration

Source§

fn clone(&self) -> Configuration

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Configuration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Configuration

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> From<&'a Configuration> for FingerprintCompressor<'a>

Source§

fn from(value: &'a Configuration) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.