pub struct EstimateFirer { /* private fields */ }Expand description
Fires EstimatePlan events as cumulative delivered audio crosses
each estimate’s start time (scaled by time_scale to account for the
engine’s actual speech rate). Owns the plan so it can be moved into
’static callbacks.
Implementations§
Source§impl EstimateFirer
impl EstimateFirer
Sourcepub fn new(plan: EstimatePlan, time_scale: f32) -> Self
pub fn new(plan: EstimatePlan, time_scale: f32) -> Self
Create a firer for plan. time_scale converts estimate seconds
into delivered-audio seconds (e.g. 1/speed for engines whose
rate parameter compresses duration; 1.0 when estimates already
match delivery).
Sourcepub fn on_samples(
&mut self,
samples: u64,
rate_now: Option<u32>,
fire: &mut dyn FnMut(&EstimateEvent),
)
pub fn on_samples( &mut self, samples: u64, rate_now: Option<u32>, fire: &mut dyn FnMut(&EstimateEvent), )
Record samples newly-emitted PCM16-mono samples and fire every
estimate whose (scaled) start time has been reached.
Sourcepub fn flush(&mut self, fire: &mut dyn FnMut(&EstimateEvent))
pub fn flush(&mut self, fire: &mut dyn FnMut(&EstimateEvent))
Fire every remaining estimate (stream ended before their times).
Auto Trait Implementations§
impl Freeze for EstimateFirer
impl RefUnwindSafe for EstimateFirer
impl Send for EstimateFirer
impl Sync for EstimateFirer
impl Unpin for EstimateFirer
impl UnsafeUnpin for EstimateFirer
impl UnwindSafe for EstimateFirer
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