pub struct BargeInDetector { /* private fields */ }Expand description
Barge-in detector — checks whether user speech should interrupt model output.
Implementations§
Source§impl BargeInDetector
impl BargeInDetector
Sourcepub fn new(config: BargeInConfig) -> Self
pub fn new(config: BargeInConfig) -> Self
Create a new barge-in detector.
Sourcepub fn check(
&mut self,
current_phase: SessionPhase,
vad_is_speaking: bool,
) -> BargeInAction
pub fn check( &mut self, current_phase: SessionPhase, vad_is_speaking: bool, ) -> BargeInAction
Check whether a VAD speech detection during model output should trigger barge-in.
Call this when the VAD detects speech while the session is in ModelSpeaking phase.
When tentative mode is enabled, the sequence is:
- First speech frame →
Duck(volume)(reduce playback volume) - Sustained speech reaching
min_speech_frames→Interrupt(flush and signal) - Silence before confirmation →
Restore(false positive)
When tentative mode is disabled, the legacy behavior applies:
Noneuntilmin_speech_framesconsecutive frames →Interrupt
Sourcepub fn execute_barge_in(jitter_buffer: &mut AudioJitterBuffer) -> SessionCommand
pub fn execute_barge_in(jitter_buffer: &mut AudioJitterBuffer) -> SessionCommand
Execute the barge-in sequence:
- Flush the jitter buffer (instant silence)
- Return the command to signal activity start
The caller is responsible for sending the command and transitioning the FSM.
Auto Trait Implementations§
impl Freeze for BargeInDetector
impl RefUnwindSafe for BargeInDetector
impl Send for BargeInDetector
impl Sync for BargeInDetector
impl Unpin for BargeInDetector
impl UnwindSafe for BargeInDetector
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