pub struct Configuration { /* private fields */ }
Expand description
Structure containing configuration for a Fingerprinter.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn with_id(self, id: u8) -> Self
pub fn with_id(self, id: u8) -> Self
Adds an ID to the configuration.
This ID is used for fingerprint compression.
Sourcepub fn with_classifiers(self, classifiers: Vec<Classifier>) -> Self
pub fn with_classifiers(self, classifiers: Vec<Classifier>) -> Self
Adds classifiers to the configuration.
Sourcepub fn with_coefficients(self, coefficients: Vec<f64>) -> Self
pub fn with_coefficients(self, coefficients: Vec<f64>) -> Self
Updates coefficients for internal chroma filter.
Sourcepub fn with_interpolation(self, interpolate: bool) -> Self
pub fn with_interpolation(self, interpolate: bool) -> Self
Enables or disables interpolation.
Sourcepub fn with_frame_size(self, frame_size: usize) -> Self
pub fn with_frame_size(self, frame_size: usize) -> Self
Sets number of samples in a single frame for FFT.
Sourcepub fn with_frame_overlap(self, frame_overlap: usize) -> Self
pub fn with_frame_overlap(self, frame_overlap: usize) -> Self
Sets number of samples overlapping between two consecutive frames for FFT.
Sourcepub fn with_removed_silence(self, silence_threshold: u32) -> Self
pub fn with_removed_silence(self, silence_threshold: u32) -> Self
Enables removal of silence with a specified threshold.
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Target sample rate for fingerprint calculation.
Sourcepub fn preset_test1() -> Self
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}
pub fn preset_test2() -> Self
pub fn preset_test3() -> Self
pub fn preset_test4() -> Self
pub fn preset_test5() -> Self
Sourcepub fn id(&self) -> u8
pub fn id(&self) -> u8
The algorithm ID of this configuration (only used for fingerprint compression).
Sourcepub fn item_duration_in_seconds(&self) -> f32
pub fn item_duration_in_seconds(&self) -> f32
A duration of a single item from the fingerprint.
Trait Implementations§
Source§impl Clone for Configuration
impl Clone for Configuration
Source§fn clone(&self) -> Configuration
fn clone(&self) -> Configuration
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Configuration
impl Debug for Configuration
Source§impl Default for Configuration
impl Default for Configuration
Source§impl<'a> From<&'a Configuration> for FingerprintCompressor<'a>
impl<'a> From<&'a Configuration> for FingerprintCompressor<'a>
Source§fn from(value: &'a Configuration) -> Self
fn from(value: &'a Configuration) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Configuration
impl RefUnwindSafe for Configuration
impl Send for Configuration
impl Sync for Configuration
impl Unpin for Configuration
impl UnwindSafe for Configuration
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