sherpa-onnx C API 1.0
Public C API and C++ wrapper for sherpa-onnx
Loading...
Searching...
No Matches
sherpa_onnx::cxx::VoiceActivityDetector Class Reference

RAII wrapper for voice activity detection. More...

#include <cxx-api.h>

+ Inheritance diagram for sherpa_onnx::cxx::VoiceActivityDetector:
+ Collaboration diagram for sherpa_onnx::cxx::VoiceActivityDetector:

Public Member Functions

void Destroy (const SherpaOnnxVoiceActivityDetector *p) const
 Destroy the wrapped C handle.
 
void AcceptWaveform (const float *samples, int32_t n) const
 Feed more audio samples to the detector.
 
bool IsEmpty () const
 Check whether no speech segments are currently queued.
 
bool IsDetected () const
 Check whether speech is currently detected.
 
void Pop () const
 Remove the front queued speech segment.
 
void Clear () const
 Remove all queued speech segments.
 
SpeechSegment Front () const
 Return the front queued speech segment.
 
std::shared_ptr< SpeechSegmentFrontPtr () const
 Like Front(), but returns the segment in a shared pointer.
 
void Reset () const
 Reset the detector state.
 
void Flush () const
 Flush buffered context at end of input.
 
- Public Member Functions inherited from sherpa_onnx::cxx::MoveOnly< VoiceActivityDetector, SherpaOnnxVoiceActivityDetector >
 MoveOnly ()=default
 Construct an empty wrapper.
 
 MoveOnly (const SherpaOnnxVoiceActivityDetector *p)
 Construct a wrapper from a raw C handle.
 
 MoveOnly (const MoveOnly &)=delete
 
 MoveOnly (MoveOnly &&other)
 
 ~MoveOnly ()
 Destroy the wrapped handle if present.
 
MoveOnlyoperator= (const MoveOnly &)=delete
 
MoveOnlyoperator= (MoveOnly &&other)
 
const SherpaOnnxVoiceActivityDetectorGet () const
 Return the wrapped raw pointer without transferring ownership.
 
const SherpaOnnxVoiceActivityDetectorRelease ()
 Release ownership of the wrapped raw pointer.
 

Static Public Member Functions

static VoiceActivityDetector Create (const VadModelConfig &config, float buffer_size_in_seconds)
 Create a VAD instance.
 

Additional Inherited Members

- Protected Attributes inherited from sherpa_onnx::cxx::MoveOnly< VoiceActivityDetector, SherpaOnnxVoiceActivityDetector >
const SherpaOnnxVoiceActivityDetectorp_
 

Detailed Description

The wrapper collects detected speech segments internally. Use IsEmpty(), Front(), and Pop() to consume them.

Definition at line 1417 of file cxx-api.h.

Member Function Documentation

◆ AcceptWaveform()

void sherpa_onnx::cxx::VoiceActivityDetector::AcceptWaveform ( const float *  samples,
int32_t  n 
) const

◆ Clear()

void sherpa_onnx::cxx::VoiceActivityDetector::Clear ( ) const

◆ Create()

static VoiceActivityDetector sherpa_onnx::cxx::VoiceActivityDetector::Create ( const VadModelConfig config,
float  buffer_size_in_seconds 
)
static

◆ Destroy()

void sherpa_onnx::cxx::VoiceActivityDetector::Destroy ( const SherpaOnnxVoiceActivityDetector p) const

◆ Flush()

void sherpa_onnx::cxx::VoiceActivityDetector::Flush ( ) const

◆ Front()

SpeechSegment sherpa_onnx::cxx::VoiceActivityDetector::Front ( ) const

◆ FrontPtr()

std::shared_ptr< SpeechSegment > sherpa_onnx::cxx::VoiceActivityDetector::FrontPtr ( ) const

◆ IsDetected()

bool sherpa_onnx::cxx::VoiceActivityDetector::IsDetected ( ) const

◆ IsEmpty()

bool sherpa_onnx::cxx::VoiceActivityDetector::IsEmpty ( ) const

◆ Pop()

void sherpa_onnx::cxx::VoiceActivityDetector::Pop ( ) const

◆ Reset()

void sherpa_onnx::cxx::VoiceActivityDetector::Reset ( ) const

The documentation for this class was generated from the following file: