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

RAII wrapper for the circular buffer helper used by VAD. More...

#include <cxx-api.h>

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

Public Member Functions

void Destroy (const SherpaOnnxCircularBuffer *p) const
 Destroy the wrapped C handle.
 
void Push (const float *p, int32_t n) const
 Append samples to the buffer.
 
std::vector< float > Get (int32_t start_index, int32_t n) const
 Copy a contiguous span from the buffer.
 
void Pop (int32_t n) const
 Remove samples from the head of the buffer.
 
int32_t Size () const
 Return the number of stored samples.
 
int32_t Head () const
 Return the current head index.
 
void Reset () const
 Reset the buffer to empty.
 
- Public Member Functions inherited from sherpa_onnx::cxx::MoveOnly< CircularBuffer, SherpaOnnxCircularBuffer >
 MoveOnly ()=default
 Construct an empty wrapper.
 
 MoveOnly (const SherpaOnnxCircularBuffer *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 SherpaOnnxCircularBufferGet () const
 Return the wrapped raw pointer without transferring ownership.
 
const SherpaOnnxCircularBufferRelease ()
 Release ownership of the wrapped raw pointer.
 

Static Public Member Functions

static CircularBuffer Create (int32_t capacity)
 Create a circular buffer with the given capacity in samples.
 

Additional Inherited Members

- Protected Attributes inherited from sherpa_onnx::cxx::MoveOnly< CircularBuffer, SherpaOnnxCircularBuffer >
const SherpaOnnxCircularBufferp_
 

Detailed Description

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

Member Function Documentation

◆ Create()

static CircularBuffer sherpa_onnx::cxx::CircularBuffer::Create ( int32_t  capacity)
static

◆ Destroy()

void sherpa_onnx::cxx::CircularBuffer::Destroy ( const SherpaOnnxCircularBuffer p) const

◆ Get()

std::vector< float > sherpa_onnx::cxx::CircularBuffer::Get ( int32_t  start_index,
int32_t  n 
) const

◆ Head()

int32_t sherpa_onnx::cxx::CircularBuffer::Head ( ) const

◆ Pop()

void sherpa_onnx::cxx::CircularBuffer::Pop ( int32_t  n) const

◆ Push()

void sherpa_onnx::cxx::CircularBuffer::Push ( const float *  p,
int32_t  n 
) const

◆ Reset()

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

◆ Size()

int32_t sherpa_onnx::cxx::CircularBuffer::Size ( ) const

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