pub struct BeatDetector {
mode: BeatDetectionMode,
last_trigger: Option<Instant>,
enabled: bool,
}Expand description
Beat detector for automatic preset changing.
Fields§
§mode: BeatDetectionModeCurrent detection mode
last_trigger: Option<Instant>Last time a preset change was triggered
enabled: boolEnable/disable detection
Implementations§
Source§impl BeatDetector
impl BeatDetector
Sourcepub fn with_mode(mode: BeatDetectionMode) -> Self
pub fn with_mode(mode: BeatDetectionMode) -> Self
Create a beat detector with specific mode.
Sourcepub fn set_mode(&mut self, mode: BeatDetectionMode)
pub fn set_mode(&mut self, mode: BeatDetectionMode)
Set the detection mode.
Sourcepub fn mode(&self) -> &BeatDetectionMode
pub fn mode(&self) -> &BeatDetectionMode
Get the current mode.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if detection is enabled.
Sourcepub fn should_change_preset(
&mut self,
bass: f32,
_mid: f32,
treb: f32,
) -> Option<PresetChange>
pub fn should_change_preset( &mut self, bass: f32, _mid: f32, treb: f32, ) -> Option<PresetChange>
Check if a preset change should be triggered based on audio levels.
Sourcefn get_min_delay(&self) -> Duration
fn get_min_delay(&self) -> Duration
Get the minimum delay for the current mode.
Trait Implementations§
Source§impl Clone for BeatDetector
impl Clone for BeatDetector
Source§fn clone(&self) -> BeatDetector
fn clone(&self) -> BeatDetector
Returns a duplicate 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 BeatDetector
impl Debug for BeatDetector
Auto Trait Implementations§
impl Freeze for BeatDetector
impl RefUnwindSafe for BeatDetector
impl Send for BeatDetector
impl Sync for BeatDetector
impl Unpin for BeatDetector
impl UnwindSafe for BeatDetector
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().