pub struct MockTurn { /* private fields */ }Expand description
A deterministic turn analyzer for tests (no ONNX).
Two modes:
- silence mode (default): mirrors the pipecat fallback — the turn is
completeonce accumulated post-speech silence exceedsstop_secs; - scripted mode (
MockTurn::with_script): eachanalyze_turnreturns the next scripted(is_complete, probability)for precise tests.
Implementations§
Source§impl MockTurn
impl MockTurn
Sourcepub fn new(sample_rate: u32, window_samples: usize) -> Self
pub fn new(sample_rate: u32, window_samples: usize) -> Self
A silence-driven mock for sample_rate, consuming window_samples-sample
windows, with default TurnParams.
Sourcepub fn with_stop_secs(
sample_rate: u32,
window_samples: usize,
stop_secs: f32,
) -> Self
pub fn with_stop_secs( sample_rate: u32, window_samples: usize, stop_secs: f32, ) -> Self
A silence-driven mock with an explicit stop_secs.
Sourcepub fn with_script(
sample_rate: u32,
window_samples: usize,
script: Vec<(bool, f32)>,
) -> Self
pub fn with_script( sample_rate: u32, window_samples: usize, script: Vec<(bool, f32)>, ) -> Self
A scripted mock returning successive (is_complete, probability) results
(the last entry repeats once exhausted).
Sourcepub fn window_samples(&self) -> usize
pub fn window_samples(&self) -> usize
The window size (samples) this mock consumes per analysis.
Trait Implementations§
Source§impl TurnAnalyzer for MockTurn
impl TurnAnalyzer for MockTurn
Source§fn analyze_turn(&mut self, audio: &AudioFrame, vad: VadState) -> TurnPrediction
fn analyze_turn(&mut self, audio: &AudioFrame, vad: VadState) -> TurnPrediction
Given accumulated speech + the VAD edge, predict whether the turn is
complete.
fn set_params(&mut self, params: TurnParams)
Auto Trait Implementations§
impl Freeze for MockTurn
impl RefUnwindSafe for MockTurn
impl Send for MockTurn
impl Sync for MockTurn
impl Unpin for MockTurn
impl UnsafeUnpin for MockTurn
impl UnwindSafe for MockTurn
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