pub struct AdaptiveRateController { /* private fields */ }Expand description
Adaptive rate controller that adjusts based on buffer levels
Implementations§
Source§impl AdaptiveRateController
impl AdaptiveRateController
Sourcepub fn new(initial_rate: f32, min_rate: f32, max_rate: f32) -> Self
pub fn new(initial_rate: f32, min_rate: f32, max_rate: f32) -> Self
Create new adaptive rate controller
Sourcepub fn adjust_rate(&mut self, fill_level: f32)
pub fn adjust_rate(&mut self, fill_level: f32)
Adjust rate based on buffer fill level
Sourcepub fn try_consume(&mut self, n_samples: usize) -> bool
pub fn try_consume(&mut self, n_samples: usize) -> bool
Try to consume tokens
Sourcepub fn current_rate(&self) -> f32
pub fn current_rate(&self) -> f32
Get current rate
Auto Trait Implementations§
impl Freeze for AdaptiveRateController
impl RefUnwindSafe for AdaptiveRateController
impl Send for AdaptiveRateController
impl Sync for AdaptiveRateController
impl Unpin for AdaptiveRateController
impl UnwindSafe for AdaptiveRateController
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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>
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